From 61b932c635ce8c596c002ec1e1c2e5f931b8acbd Mon Sep 17 00:00:00 2001 From: Pedro Henrique Ferreira Figueiredo Date: Sat, 20 Mar 2021 10:38:59 -0300 Subject: [PATCH] Flutter 2.0 and Null Safety compatibility --- CHANGELOG.md | 3 + example/pubspec.lock | 347 +++++--------------------- example/pubspec.yaml | 2 +- flutter_page_indicator.iml | 1 - lib/flutter_page_indicator.dart | 14 +- pubspec.lock | 333 ++++-------------------- pubspec.yaml | 4 +- test/flutter_page_indicator_test.dart | 7 - 8 files changed, 122 insertions(+), 589 deletions(-) delete mode 100644 test/flutter_page_indicator_test.dart diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c70a41..0e69e20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## [0.1.0] + * Flutter 2.0 and Null Safety compatibility + ## [0.0.3] * Fix bugs * Support loop mode for layout: PageIndicatorLayout.COLOR & PageIndicatorLayout.COLOR. diff --git a/example/pubspec.lock b/example/pubspec.lock index 92859fa..a69e214 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -1,76 +1,62 @@ # Generated by pub -# See https://www.dartlang.org/tools/pub/glossary#lockfile +# See https://dart.dev/tools/pub/glossary#lockfile packages: - analyzer: - dependency: transitive - description: - name: analyzer - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.32.4" - args: - dependency: transitive - description: - name: args - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.5.0" async: dependency: transitive description: name: async - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.5.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" - charcode: + version: "2.1.0" + characters: dependency: transitive description: - name: charcode - url: "https://pub.flutter-io.cn" + name: characters + url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" - collection: - dependency: transitive - description: - name: collection - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.14.11" - convert: + version: "1.1.0" + charcode: dependency: transitive description: - name: convert - url: "https://pub.flutter-io.cn" + name: charcode + url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" - crypto: + version: "1.2.0" + clock: dependency: transitive description: - name: crypto - url: "https://pub.flutter-io.cn" + name: clock + url: "https://pub.dartlang.org" source: hosted - version: "2.0.6" - csslib: + version: "1.1.0" + collection: dependency: transitive description: - name: csslib - url: "https://pub.flutter-io.cn" + name: collection + url: "https://pub.dartlang.org" source: hosted - version: "0.14.5" + version: "1.15.0" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.1.2" + version: "0.1.3" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" flutter: dependency: "direct main" description: flutter @@ -88,312 +74,95 @@ packages: description: flutter source: sdk version: "0.0.0" - front_end: - dependency: transitive - description: - name: front_end - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.1.4" - glob: - dependency: transitive - description: - name: glob - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.1.7" - html: - dependency: transitive - description: - name: html - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.13.3+3" - http: - dependency: transitive - description: - name: http - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.11.3+17" - http_multi_server: - dependency: transitive - description: - name: http_multi_server - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.0.5" - http_parser: - dependency: transitive - description: - name: http_parser - url: "https://pub.flutter-io.cn" - source: hosted - version: "3.1.3" - io: - dependency: transitive - description: - name: io - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.3.3" - js: - dependency: transitive - description: - name: js - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.6.1+1" - json_rpc_2: - dependency: transitive - description: - name: json_rpc_2 - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.0.9" - kernel: - dependency: transitive - description: - name: kernel - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.3.4" - logging: - dependency: transitive - description: - name: logging - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.11.3+2" matcher: dependency: transitive description: name: matcher - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.12.3+1" + version: "0.12.10" meta: dependency: transitive description: name: meta - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.1.6" - mime: - dependency: transitive - description: - name: mime - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.9.6+2" - multi_server_socket: - dependency: transitive - description: - name: multi_server_socket - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.0.2" - node_preamble: - dependency: transitive - description: - name: node_preamble - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.4.4" - package_config: - dependency: transitive - description: - name: package_config - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.0.5" - package_resolver: - dependency: transitive - description: - name: package_resolver - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.0.4" + version: "1.3.0" path: dependency: transitive description: name: path - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.6.2" - plugin: - dependency: transitive - description: - name: plugin - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.2.0+3" - pool: - dependency: transitive - description: - name: pool - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.3.6" - pub_semver: - dependency: transitive - description: - name: pub_semver - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.4.2" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.0.0+1" - shelf: - dependency: transitive - description: - name: shelf - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.7.3+3" - shelf_packages_handler: - dependency: transitive - description: - name: shelf_packages_handler - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" - shelf_static: - dependency: transitive - description: - name: shelf_static - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.2.8" - shelf_web_socket: - dependency: transitive - description: - name: shelf_web_socket - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.2.2+4" + version: "1.8.0" sky_engine: dependency: transitive description: flutter source: sdk version: "0.0.99" - source_map_stack_trace: - dependency: transitive - description: - name: source_map_stack_trace - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.1.5" - source_maps: - dependency: transitive - description: - name: source_maps - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.10.7" source_span: dependency: transitive description: name: source_span - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.4.1" + version: "1.8.0" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.6.8" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" - test: + version: "1.2.0" + test_api: dependency: transitive description: - name: test - url: "https://pub.flutter-io.cn" + name: test_api + url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "0.2.19" transformer_page_view: dependency: "direct main" description: - path: "/Users/jzoom/SourceCode/transformer_page_view" + path: "/Users/pedro/dev/PESSOAL/tmp/transformer_page_view" relative: false source: path - version: "0.1.0" + version: "0.2.0" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" - utf: - dependency: transitive - description: - name: utf - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.9.0+5" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.0.8" - vm_service_client: - dependency: transitive - description: - name: vm_service_client - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.2.6" - watcher: - dependency: transitive - description: - name: watcher - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.9.7+10" - web_socket_channel: - dependency: transitive - description: - name: web_socket_channel - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.0.9" - yaml: - dependency: transitive - description: - name: yaml - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "2.1.15" + version: "2.1.0" sdks: - dart: ">=2.0.0-dev.68.0 <3.0.0" - flutter: ">=0.1.4 <3.0.0" + dart: ">=2.12.0 <3.0.0" + flutter: ">=0.1.4" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 59144dc..d6978fe 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -24,7 +24,7 @@ dependencies: path: ../ transformer_page_view: - path: /Users/jzoom/SourceCode/transformer_page_view + path: /Users/pedro/dev/PESSOAL/tmp/transformer_page_view dev_dependencies: flutter_test: diff --git a/flutter_page_indicator.iml b/flutter_page_indicator.iml index 75456de..3570fe3 100644 --- a/flutter_page_indicator.iml +++ b/flutter_page_indicator.iml @@ -16,7 +16,6 @@ - diff --git a/lib/flutter_page_indicator.dart b/lib/flutter_page_indicator.dart index 1ab652c..641e8d5 100644 --- a/lib/flutter_page_indicator.dart +++ b/lib/flutter_page_indicator.dart @@ -123,12 +123,12 @@ class ScalePainter extends BasePainter { : radius + ((index + 1) * (size + space)); double progress = page - index; - _paint.color = Color.lerp(widget.activeColor, widget.color, progress); + _paint.color = Color.lerp(widget.activeColor, widget.color, progress)!; //last canvas.drawCircle(new Offset(radius + (index * (size + space)), radius), lerp(radius, radius * widget.scale, progress), _paint); //first - _paint.color = Color.lerp(widget.color, widget.activeColor, progress); + _paint.color = Color.lerp(widget.color, widget.activeColor, progress)!; canvas.drawCircle(new Offset(secondOffset, radius), lerp(radius * widget.scale, radius, progress), _paint); } @@ -154,12 +154,12 @@ class ColorPainter extends BasePainter { ? radius : radius + ((index + 1) * (size + space)); - _paint.color = Color.lerp(widget.activeColor, widget.color, progress); + _paint.color = Color.lerp(widget.activeColor, widget.color, progress)!; //left canvas.drawCircle( new Offset(radius + (index * (size + space)), radius), radius, _paint); //right - _paint.color = Color.lerp(widget.color, widget.activeColor, progress); + _paint.color = Color.lerp(widget.color, widget.activeColor, progress)!; canvas.drawCircle(new Offset(secondOffset, radius), radius, _paint); } } @@ -330,12 +330,12 @@ class PageIndicator extends StatefulWidget { final double activeSize; PageIndicator( - {Key key, + {Key? key, this.size: 20.0, this.space: 5.0, - this.count, + required this.count, this.activeSize: 20.0, - this.controller, + required this.controller, this.color: Colors.white30, this.layout: PageIndicatorLayout.SLIDE, this.activeColor: Colors.white, diff --git a/pubspec.lock b/pubspec.lock index 8c0490c..6b57a99 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,69 +1,55 @@ # Generated by pub -# See https://www.dartlang.org/tools/pub/glossary#lockfile +# See https://dart.dev/tools/pub/glossary#lockfile packages: - analyzer: - dependency: transitive - description: - name: analyzer - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.32.4" - args: - dependency: transitive - description: - name: args - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.5.0" async: dependency: transitive description: name: async - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.5.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" - charcode: + version: "2.1.0" + characters: dependency: transitive description: - name: charcode - url: "https://pub.flutter-io.cn" + name: characters + url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" - collection: + version: "1.1.0" + charcode: dependency: transitive description: - name: collection - url: "https://pub.flutter-io.cn" + name: charcode + url: "https://pub.dartlang.org" source: hosted - version: "1.14.11" - convert: + version: "1.2.0" + clock: dependency: transitive description: - name: convert - url: "https://pub.flutter-io.cn" + name: clock + url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" - crypto: + version: "1.1.0" + collection: dependency: transitive description: - name: crypto - url: "https://pub.flutter-io.cn" + name: collection + url: "https://pub.dartlang.org" source: hosted - version: "2.0.6" - csslib: + version: "1.15.0" + fake_async: dependency: transitive description: - name: csslib - url: "https://pub.flutter-io.cn" + name: fake_async + url: "https://pub.dartlang.org" source: hosted - version: "0.14.5" + version: "1.2.0" flutter: dependency: "direct main" description: flutter @@ -74,305 +60,88 @@ packages: description: flutter source: sdk version: "0.0.0" - front_end: - dependency: transitive - description: - name: front_end - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.1.4" - glob: - dependency: transitive - description: - name: glob - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.1.7" - html: - dependency: transitive - description: - name: html - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.13.3+3" - http: - dependency: transitive - description: - name: http - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.11.3+17" - http_multi_server: - dependency: transitive - description: - name: http_multi_server - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.0.5" - http_parser: - dependency: transitive - description: - name: http_parser - url: "https://pub.flutter-io.cn" - source: hosted - version: "3.1.3" - io: - dependency: transitive - description: - name: io - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.3.3" - js: - dependency: transitive - description: - name: js - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.6.1+1" - json_rpc_2: - dependency: transitive - description: - name: json_rpc_2 - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.0.9" - kernel: - dependency: transitive - description: - name: kernel - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.3.4" - logging: - dependency: transitive - description: - name: logging - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.11.3+2" matcher: dependency: transitive description: name: matcher - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.12.3+1" + version: "0.12.10" meta: dependency: transitive description: name: meta - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.1.6" - mime: - dependency: transitive - description: - name: mime - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.9.6+2" - multi_server_socket: - dependency: transitive - description: - name: multi_server_socket - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.0.2" - node_preamble: - dependency: transitive - description: - name: node_preamble - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.4.4" - package_config: - dependency: transitive - description: - name: package_config - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.0.5" - package_resolver: - dependency: transitive - description: - name: package_resolver - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "1.3.0" path: dependency: transitive description: name: path - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.6.2" - plugin: - dependency: transitive - description: - name: plugin - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.2.0+3" - pool: - dependency: transitive - description: - name: pool - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.3.6" - pub_semver: - dependency: transitive - description: - name: pub_semver - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.4.2" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.0.0+1" - shelf: - dependency: transitive - description: - name: shelf - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.7.3+3" - shelf_packages_handler: - dependency: transitive - description: - name: shelf_packages_handler - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.0.4" - shelf_static: - dependency: transitive - description: - name: shelf_static - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.2.8" - shelf_web_socket: - dependency: transitive - description: - name: shelf_web_socket - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.2.2+4" + version: "1.8.0" sky_engine: dependency: transitive description: flutter source: sdk version: "0.0.99" - source_map_stack_trace: - dependency: transitive - description: - name: source_map_stack_trace - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.1.5" - source_maps: - dependency: transitive - description: - name: source_maps - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.10.7" source_span: dependency: transitive description: name: source_span - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.4.1" + version: "1.8.0" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.6.8" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" - test: + version: "1.2.0" + test_api: dependency: transitive description: - name: test - url: "https://pub.flutter-io.cn" + name: test_api + url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "0.2.19" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.1.6" - utf: - dependency: transitive - description: - name: utf - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.9.0+5" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.0.8" - vm_service_client: - dependency: transitive - description: - name: vm_service_client - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.2.6" - watcher: - dependency: transitive - description: - name: watcher - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.9.7+10" - web_socket_channel: - dependency: transitive - description: - name: web_socket_channel - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.0.9" - yaml: - dependency: transitive - description: - name: yaml - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "2.1.15" + version: "2.1.0" sdks: - dart: ">=2.0.0-dev.68.0 <3.0.0" - flutter: ">=0.1.4 <3.0.0" + dart: ">=2.12.0-0.0 <3.0.0" + flutter: ">=0.1.4" diff --git a/pubspec.yaml b/pubspec.yaml index d4dfab8..8345126 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_page_indicator description: Page indicator for flutter, with multiple build-in layouts. -version: 0.0.3 +version: 0.1.0 author: JZoom homepage: https://github.com/jzoom/flutter_page_indicator @@ -9,7 +9,7 @@ dependencies: sdk: flutter environment: - sdk: ">=2.0.0-dev.48.0 <3.0.0" + sdk: '>=2.12.0 <3.0.0' flutter: ">=0.1.4 <3.0.0" diff --git a/test/flutter_page_indicator_test.dart b/test/flutter_page_indicator_test.dart deleted file mode 100644 index dd83cf8..0000000 --- a/test/flutter_page_indicator_test.dart +++ /dev/null @@ -1,7 +0,0 @@ -import 'package:test/test.dart'; - -import 'package:flutter_page_indicator/flutter_page_indicator.dart'; - -void main() { - test('adds one to input values', () {}); -}