Skip to content

Commit 393d140

Browse files
committed
feat: released v2.1.0
1 parent 6b2c005 commit 393d140

11 files changed

+159
-3
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## [2.1.0] - 06-Mar-2022.
2+
* Added support for web platform
3+
14
## [2.0.0] - 06-Nov-2021.
25
* Support for FormBuilder 7.*
36

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// Generated file. Do not edit.
3+
//
4+
5+
// ignore_for_file: directives_ordering
6+
// ignore_for_file: lines_longer_than_80_chars
7+
8+
import 'package:file_picker/_internal/file_picker_web.dart';
9+
10+
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
11+
12+
// ignore: public_member_api_docs
13+
void registerPlugins(Registrar registrar) {
14+
FilePickerWeb.registerWith(registrar);
15+
registrar.registerMessageHandler();
16+
}

example/web/favicon.png

917 Bytes
Loading

example/web/icons/Icon-192.png

5.17 KB
Loading

example/web/icons/Icon-512.png

8.06 KB
Loading
5.46 KB
Loading
20.5 KB
Loading

example/web/index.html

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<!--
5+
If you are serving your web app in a path other than the root, change the
6+
href value below to reflect the base path you are serving from.
7+
8+
The path provided below has to start and end with a slash "/" in order for
9+
it to work correctly.
10+
11+
For more details:
12+
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
13+
14+
This is a placeholder for base href that will be replaced by the value of
15+
the `--base-href` argument provided to `flutter build`.
16+
-->
17+
<base href="$FLUTTER_BASE_HREF">
18+
19+
<meta charset="UTF-8">
20+
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
21+
<meta name="description" content="A new Flutter project.">
22+
23+
<!-- iOS meta tags & icons -->
24+
<meta name="apple-mobile-web-app-capable" content="yes">
25+
<meta name="apple-mobile-web-app-status-bar-style" content="black">
26+
<meta name="apple-mobile-web-app-title" content="example">
27+
<link rel="apple-touch-icon" href="icons/Icon-192.png">
28+
29+
<!-- Favicon -->
30+
<link rel="icon" type="image/png" href="favicon.png"/>
31+
32+
<title>example</title>
33+
<link rel="manifest" href="manifest.json">
34+
</head>
35+
<body>
36+
<!-- This script installs service_worker.js to provide PWA functionality to
37+
application. For more information, see:
38+
https://developers.google.com/web/fundamentals/primers/service-workers -->
39+
<script>
40+
var serviceWorkerVersion = null;
41+
var scriptLoaded = false;
42+
function loadMainDartJs() {
43+
if (scriptLoaded) {
44+
return;
45+
}
46+
scriptLoaded = true;
47+
var scriptTag = document.createElement('script');
48+
scriptTag.src = 'main.dart.js';
49+
scriptTag.type = 'application/javascript';
50+
document.body.append(scriptTag);
51+
}
52+
53+
if ('serviceWorker' in navigator) {
54+
// Service workers are supported. Use them.
55+
window.addEventListener('load', function () {
56+
// Wait for registration to finish before dropping the <script> tag.
57+
// Otherwise, the browser will load the script multiple times,
58+
// potentially different versions.
59+
var serviceWorkerUrl = 'flutter_service_worker.js?v=' + serviceWorkerVersion;
60+
navigator.serviceWorker.register(serviceWorkerUrl)
61+
.then((reg) => {
62+
function waitForActivation(serviceWorker) {
63+
serviceWorker.addEventListener('statechange', () => {
64+
if (serviceWorker.state == 'activated') {
65+
console.log('Installed new service worker.');
66+
loadMainDartJs();
67+
}
68+
});
69+
}
70+
if (!reg.active && (reg.installing || reg.waiting)) {
71+
// No active web worker and we have installed or are installing
72+
// one for the first time. Simply wait for it to activate.
73+
waitForActivation(reg.installing || reg.waiting);
74+
} else if (!reg.active.scriptURL.endsWith(serviceWorkerVersion)) {
75+
// When the app updates the serviceWorkerVersion changes, so we
76+
// need to ask the service worker to update.
77+
console.log('New service worker available.');
78+
reg.update();
79+
waitForActivation(reg.installing);
80+
} else {
81+
// Existing service worker is still good.
82+
console.log('Loading app from service worker.');
83+
loadMainDartJs();
84+
}
85+
});
86+
87+
// If service worker doesn't succeed in a reasonable amount of time,
88+
// fallback to plaint <script> tag.
89+
setTimeout(() => {
90+
if (!scriptLoaded) {
91+
console.warn(
92+
'Failed to load app from service worker. Falling back to plain <script> tag.',
93+
);
94+
loadMainDartJs();
95+
}
96+
}, 4000);
97+
});
98+
} else {
99+
// Service workers not supported. Just drop the <script> tag.
100+
loadMainDartJs();
101+
}
102+
</script>
103+
</body>
104+
</html>

example/web/manifest.json

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "example",
3+
"short_name": "example",
4+
"start_url": ".",
5+
"display": "standalone",
6+
"background_color": "#0175C2",
7+
"theme_color": "#0175C2",
8+
"description": "A new Flutter project.",
9+
"orientation": "portrait-primary",
10+
"prefer_related_applications": false,
11+
"icons": [
12+
{
13+
"src": "icons/Icon-192.png",
14+
"sizes": "192x192",
15+
"type": "image/png"
16+
},
17+
{
18+
"src": "icons/Icon-512.png",
19+
"sizes": "512x512",
20+
"type": "image/png"
21+
},
22+
{
23+
"src": "icons/Icon-maskable-192.png",
24+
"sizes": "192x192",
25+
"type": "image/png",
26+
"purpose": "maskable"
27+
},
28+
{
29+
"src": "icons/Icon-maskable-512.png",
30+
"sizes": "512x512",
31+
"type": "image/png",
32+
"purpose": "maskable"
33+
}
34+
]
35+
}

lib/src/form_builder_file_picker.dart

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import 'package:community_material_icon/community_material_icon.dart';
55
import 'package:file_picker/file_picker.dart';
66
import 'package:flutter/foundation.dart' show kIsWeb;
77
import 'package:flutter/material.dart';
8-
import 'package:flutter/rendering.dart';
9-
import 'package:flutter/widgets.dart';
108
import 'package:flutter_form_builder/flutter_form_builder.dart';
119
import 'package:permission_handler/permission_handler.dart';
1210

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: form_builder_file_picker
22
description: FilePicker Field for flutter_form_builder package. Used to select files as part of form input.
3-
version: 2.0.0
3+
version: 2.1.0
44
homepage: https://github.com/danvick/form_builder_file_picker
55

66
environment:

0 commit comments

Comments
 (0)