Skip to content

Commit 4ecd06f

Browse files
authored
Merge pull request #42 from WilliamCunhaCardoso/issue-41
Flutter 2.5 update
2 parents e3f659b + 06d20dd commit 4ecd06f

13 files changed

+268
-163
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,7 @@
2323
## [1.0.0]
2424

2525
* Migrate to NNBD
26+
27+
## [1.1.0]
28+
29+
* Migration to Flutter 2.5

example/analysis_options.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This file configures the analyzer, which statically analyzes Dart code to
2+
# check for errors, warnings, and lints.
3+
#
4+
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5+
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6+
# invoked from the command line by running `flutter analyze`.
7+
8+
# The following line activates a set of recommended lints for Flutter apps,
9+
# packages, and plugins designed to encourage good coding practices.
10+
include: package:flutter_lints/flutter.yaml
11+
12+
linter:
13+
# The lint rules applied to this project can be customized in the
14+
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
15+
# included above or to enable additional rules. A list of all available lints
16+
# and their documentation is published at
17+
# https://dart-lang.github.io/linter/lints/index.html.
18+
#
19+
# Instead of disabling a lint rule for the entire project in the
20+
# section below, it can also be suppressed for a single line of code
21+
# or a specific dart file by using the `// ignore: name_of_lint` and
22+
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
23+
# producing the lint.
24+
rules:
25+
# avoid_print: false # Uncomment to disable the `avoid_print` rule
26+
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27+
28+
# Additional information about this file can be found at
29+
# https://dart.dev/guides/language/analysis-options

example/pubspec.yaml

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
1-
name: example
1+
name: reorderable_list
22
description: Reorderable list view example
3-
author: Matej Knopp <matej.knopp@gmail.com>
43
homepage: https://github.com/knopp/flutter_reorderable_list
54
publish_to: none
65

7-
# The following defines the version and build number for your application.
8-
# A version number is three numbers separated by dots, like 1.2.43
9-
# followed by an optional build number separated by a +.
10-
# Both the version and the builder number may be overridden in flutter
11-
# build by specifying --build-name and --build-number, respectively.
12-
# Read more about versioning at semver.org.
136
version: 1.0.0+1
147

158
environment:
16-
sdk: '>=2.12.0 <3.0.0'
9+
sdk: ">=2.12.0 <3.0.0"
1710

1811
dependencies:
1912
flutter:
@@ -30,45 +23,6 @@ dev_dependencies:
3023
flutter_test:
3124
sdk: flutter
3225

33-
34-
# For information on the generic Dart part of this file, see the
35-
# following page: https://www.dartlang.org/tools/pub/pubspec
36-
3726
# The following section is specific to Flutter.
3827
flutter:
39-
40-
# The following line ensures that the Material Icons font is
41-
# included with your application, so that you can use the icons in
42-
# the material Icons class.
4328
uses-material-design: true
44-
45-
# To add assets to your application, add an assets section, like this:
46-
# assets:
47-
# - images/a_dot_burr.jpeg
48-
# - images/a_dot_ham.jpeg
49-
50-
# An image asset can refer to one or more resolution-specific "variants", see
51-
# https://flutter.io/assets-and-images/#resolution-aware.
52-
53-
# For details regarding adding assets from package dependencies, see
54-
# https://flutter.io/assets-and-images/#from-packages
55-
56-
# To add custom fonts to your application, add a fonts section here,
57-
# in this "flutter" section. Each entry in this list should have a
58-
# "family" key with the font family name, and a "fonts" key with a
59-
# list giving the asset and other descriptors for the font. For
60-
# example:
61-
# fonts:
62-
# - family: Schyler
63-
# fonts:
64-
# - asset: fonts/Schyler-Regular.ttf
65-
# - asset: fonts/Schyler-Italic.ttf
66-
# style: italic
67-
# - family: Trajan Pro
68-
# fonts:
69-
# - asset: fonts/TrajanPro.ttf
70-
# - asset: fonts/TrajanPro_Bold.ttf
71-
# weight: 700
72-
#
73-
# For details regarding fonts from package dependencies,
74-
# see https://flutter.io/custom-fonts/#from-packages

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

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
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+
<title>example</title>
30+
<link rel="manifest" href="manifest.json">
31+
</head>
32+
<body>
33+
<!-- This script installs service_worker.js to provide PWA functionality to
34+
application. For more information, see:
35+
https://developers.google.com/web/fundamentals/primers/service-workers -->
36+
<script>
37+
var serviceWorkerVersion = null;
38+
var scriptLoaded = false;
39+
function loadMainDartJs() {
40+
if (scriptLoaded) {
41+
return;
42+
}
43+
scriptLoaded = true;
44+
var scriptTag = document.createElement('script');
45+
scriptTag.src = 'main.dart.js';
46+
scriptTag.type = 'application/javascript';
47+
document.body.append(scriptTag);
48+
}
49+
50+
if ('serviceWorker' in navigator) {
51+
// Service workers are supported. Use them.
52+
window.addEventListener('load', function () {
53+
// Wait for registration to finish before dropping the <script> tag.
54+
// Otherwise, the browser will load the script multiple times,
55+
// potentially different versions.
56+
var serviceWorkerUrl = 'flutter_service_worker.js?v=' + serviceWorkerVersion;
57+
navigator.serviceWorker.register(serviceWorkerUrl)
58+
.then((reg) => {
59+
function waitForActivation(serviceWorker) {
60+
serviceWorker.addEventListener('statechange', () => {
61+
if (serviceWorker.state == 'activated') {
62+
console.log('Installed new service worker.');
63+
loadMainDartJs();
64+
}
65+
});
66+
}
67+
if (!reg.active && (reg.installing || reg.waiting)) {
68+
// No active web worker and we have installed or are installing
69+
// one for the first time. Simply wait for it to activate.
70+
waitForActivation(reg.installing || reg.waiting);
71+
} else if (!reg.active.scriptURL.endsWith(serviceWorkerVersion)) {
72+
// When the app updates the serviceWorkerVersion changes, so we
73+
// need to ask the service worker to update.
74+
console.log('New service worker available.');
75+
reg.update();
76+
waitForActivation(reg.installing);
77+
} else {
78+
// Existing service worker is still good.
79+
console.log('Loading app from service worker.');
80+
loadMainDartJs();
81+
}
82+
});
83+
84+
// If service worker doesn't succeed in a reasonable amount of time,
85+
// fallback to plaint <script> tag.
86+
setTimeout(() => {
87+
if (!scriptLoaded) {
88+
console.warn(
89+
'Failed to load app from service worker. Falling back to plain <script> tag.',
90+
);
91+
loadMainDartJs();
92+
}
93+
}, 4000);
94+
});
95+
} else {
96+
// Service workers not supported. Just drop the <script> tag.
97+
loadMainDartJs();
98+
}
99+
</script>
100+
</body>
101+
</html>

example/web/manifest.json

Lines changed: 35 additions & 0 deletions
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+
}

0 commit comments

Comments
 (0)