From cda9f86ae58db1eb1e0e3ff4e03132f1d217538c Mon Sep 17 00:00:00 2001 From: OutdatedGuy Date: Tue, 9 May 2023 01:25:43 +0530 Subject: [PATCH 1/6] chore: updated .gitignore by latest template --- .gitignore | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 59ab426..d920ae6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,30 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp .DS_Store -.dart_tool/ -.idea +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ -.packages -.pub/ +# IntelliJ related +*.iml +*.ipr +*.iws .idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. .vscode/ +# Flutter/Dart/Pub related +# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. +/pubspec.lock +**/doc/api/ +.dart_tool/ +.packages build/ -coverage/ -ios/.generated/ -ios/Flutter/Generated.xcconfig -ios/Runner/GeneratedPluginRegistrant.* From 931c0c91253b13468af2d3e5b6324e8b133536a8 Mon Sep 17 00:00:00 2001 From: OutdatedGuy Date: Tue, 9 May 2023 01:28:45 +0530 Subject: [PATCH 2/6] chore: remove unnecessary root pubspec.lock file Modified example pubspec.lock to support latest stable release --- example/pubspec.lock | 32 ++++---- pubspec.lock | 181 ------------------------------------------- 2 files changed, 16 insertions(+), 197 deletions(-) delete mode 100644 pubspec.lock diff --git a/example/pubspec.lock b/example/pubspec.lock index 8cc0d52..795ad95 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -21,10 +21,10 @@ packages: dependency: transitive description: name: characters - sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.2.1" clock: dependency: transitive description: @@ -37,10 +37,10 @@ packages: dependency: transitive description: name: collection - sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" + sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 url: "https://pub.dev" source: hosted - version: "1.17.1" + version: "1.17.0" fake_async: dependency: transitive description: @@ -68,7 +68,7 @@ packages: path: ".." relative: true source: path - version: "5.1.0" + version: "5.2.0" flutter_test: dependency: "direct dev" description: flutter @@ -78,10 +78,10 @@ packages: dependency: transitive description: name: js - sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" url: "https://pub.dev" source: hosted - version: "0.6.7" + version: "0.6.5" lints: dependency: transitive description: @@ -94,10 +94,10 @@ packages: dependency: transitive description: name: matcher - sha256: c94db23593b89766cda57aab9ac311e3616cf87c6fa4e9749df032f66f30dcb8 + sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" url: "https://pub.dev" source: hosted - version: "0.12.14" + version: "0.12.13" material_color_utilities: dependency: transitive description: @@ -110,18 +110,18 @@ packages: dependency: transitive description: name: meta - sha256: "12307e7f0605ce3da64cf0db90e5fcab0869f3ca03f76be6bb2991ce0a55e82b" + sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.8.0" path: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.8.2" sky_engine: dependency: transitive description: flutter @@ -171,10 +171,10 @@ packages: dependency: transitive description: name: test_api - sha256: "6182294da5abf431177fccc1ee02401f6df30f766bc6130a0852c6b6d7ee6b2d" + sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 url: "https://pub.dev" source: hosted - version: "0.4.18" + version: "0.4.16" vector_math: dependency: transitive description: @@ -184,5 +184,5 @@ packages: source: hosted version: "2.1.4" sdks: - dart: ">=2.19.0 <4.0.0" + dart: ">=2.18.0 <3.0.0" flutter: ">=2.0.0" diff --git a/pubspec.lock b/pubspec.lock deleted file mode 100644 index ad5eb68..0000000 --- a/pubspec.lock +++ /dev/null @@ -1,181 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - async: - dependency: transitive - description: - name: async - sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 - url: "https://pub.dev" - source: hosted - version: "2.10.0" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - characters: - dependency: transitive - description: - name: characters - sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" - url: "https://pub.dev" - source: hosted - version: "1.3.0" - clock: - dependency: transitive - description: - name: clock - sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf - url: "https://pub.dev" - source: hosted - version: "1.1.1" - collection: - dependency: transitive - description: - name: collection - sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" - url: "https://pub.dev" - source: hosted - version: "1.17.1" - fake_async: - dependency: transitive - description: - name: fake_async - sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" - url: "https://pub.dev" - source: hosted - version: "1.3.1" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_lints: - dependency: "direct dev" - description: - name: flutter_lints - sha256: aeb0b80a8b3709709c9cc496cdc027c5b3216796bc0af0ce1007eaf24464fd4c - url: "https://pub.dev" - source: hosted - version: "2.0.1" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - js: - dependency: transitive - description: - name: js - sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 - url: "https://pub.dev" - source: hosted - version: "0.6.7" - lints: - dependency: transitive - description: - name: lints - sha256: "5e4a9cd06d447758280a8ac2405101e0e2094d2a1dbdd3756aec3fe7775ba593" - url: "https://pub.dev" - source: hosted - version: "2.0.1" - matcher: - dependency: transitive - description: - name: matcher - sha256: c94db23593b89766cda57aab9ac311e3616cf87c6fa4e9749df032f66f30dcb8 - url: "https://pub.dev" - source: hosted - version: "0.12.14" - material_color_utilities: - dependency: transitive - description: - name: material_color_utilities - sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 - url: "https://pub.dev" - source: hosted - version: "0.2.0" - meta: - dependency: transitive - description: - name: meta - sha256: "12307e7f0605ce3da64cf0db90e5fcab0869f3ca03f76be6bb2991ce0a55e82b" - url: "https://pub.dev" - source: hosted - version: "1.9.0" - path: - dependency: transitive - description: - name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" - url: "https://pub.dev" - source: hosted - version: "1.8.3" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.99" - source_span: - dependency: transitive - description: - name: source_span - sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 - url: "https://pub.dev" - source: hosted - version: "1.9.1" - stack_trace: - dependency: transitive - description: - name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 - url: "https://pub.dev" - source: hosted - version: "1.11.0" - stream_channel: - dependency: transitive - description: - name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - string_scanner: - dependency: transitive - description: - name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" - url: "https://pub.dev" - source: hosted - version: "1.2.0" - term_glyph: - dependency: transitive - description: - name: term_glyph - sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 - url: "https://pub.dev" - source: hosted - version: "1.2.1" - test_api: - dependency: transitive - description: - name: test_api - sha256: "6182294da5abf431177fccc1ee02401f6df30f766bc6130a0852c6b6d7ee6b2d" - url: "https://pub.dev" - source: hosted - version: "0.4.18" - vector_math: - dependency: transitive - description: - name: vector_math - sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" - url: "https://pub.dev" - source: hosted - version: "2.1.4" -sdks: - dart: ">=2.19.0 <4.0.0" - flutter: ">=2.0.0" From 24d8b4ca41212219e5528c46eaae0f865dba502e Mon Sep 17 00:00:00 2001 From: OutdatedGuy Date: Tue, 9 May 2023 02:06:33 +0530 Subject: [PATCH 3/6] style: formatted code according to dart standards Ran `dart fix --apply` and `dart format .` to format code --- analysis_options.yaml | 1 + example/analysis_options.yaml | 28 ++++++ example/lib/main.dart | 8 +- lib/src/chasing_dots.dart | 25 +++-- lib/src/circle.dart | 32 +++++-- lib/src/cube_grid.dart | 58 ++++++++--- lib/src/dancing_square.dart | 43 +++++++-- lib/src/double_bounce.dart | 29 ++++-- lib/src/dual_ring.dart | 30 ++++-- lib/src/fading_circle.dart | 32 +++++-- lib/src/fading_cube.dart | 25 +++-- lib/src/fading_four.dart | 29 ++++-- lib/src/fading_grid.dart | 24 +++-- lib/src/folding_cube.dart | 44 ++++++--- lib/src/hour_glass.dart | 14 ++- lib/src/piano_wave.dart | 40 ++++++-- lib/src/pouring_hour_glass.dart | 38 ++++++-- lib/src/pouring_hour_glass_refined.dart | 64 ++++++++++--- lib/src/pulse.dart | 20 +++- lib/src/pulsing_grid.dart | 32 +++++-- lib/src/pumping_heart.dart | 22 +++-- lib/src/ring.dart | 33 +++++-- lib/src/ripple.dart | 44 ++++++--- lib/src/rotating_circle.dart | 41 ++++++-- lib/src/rotating_plain.dart | 29 ++++-- lib/src/spinning_circle.dart | 25 +++-- lib/src/spinning_lines.dart | 20 ++-- lib/src/square_circle.dart | 36 ++++--- lib/src/three_bounce.dart | 32 +++++-- lib/src/three_in_out.dart | 50 ++++++---- lib/src/tweens/delay_tween.dart | 10 +- lib/src/wandering_cubes.dart | 38 ++++++-- lib/src/wave.dart | 51 +++++++--- lib/src/wave_spinner.dart | 101 +++++++++++++------- test/chasing_dots_test.dart | 43 +++++++-- test/circle_test.dart | 35 +++++-- test/cube_grid_test.dart | 38 ++++++-- test/dancing_square_test.dart | 43 +++++++-- test/double_bounce_test.dart | 43 +++++++-- test/dual_ring_test.dart | 8 +- test/fading_circle_test.dart | 43 +++++++-- test/fading_cube_test.dart | 43 +++++++-- test/fading_four_test.dart | 43 +++++++-- test/fading_grid_test.dart | 43 +++++++-- test/folding_cube_test.dart | 43 +++++++-- test/helpers.dart | 5 +- test/hour_glass_test.dart | 8 +- test/piano_wave_test.dart | 66 ++++++++++--- test/pouring_hour_glass_refined_test.dart | 12 ++- test/pouring_hour_glass_test.dart | 10 +- test/pulse_test.dart | 35 +++++-- test/pulsing_grid_test.dart | 43 +++++++-- test/pumping_heart_test.dart | 53 ++++++++--- test/ring_test.dart | 8 +- test/ripple_test.dart | 35 +++++-- test/rotating_circle_test.dart | 43 +++++++-- test/rotating_plain_test.dart | 43 +++++++-- test/smoke_test.dart | 76 +++++++-------- test/spinning_circle_test.dart | 43 +++++++-- test/spinning_line_test.dart | 8 +- test/square_circle_test.dart | 43 +++++++-- test/three_bounce_test.dart | 43 +++++++-- test/three_in_out_test.dart | 43 +++++++-- test/wandering_cubes_test.dart | 43 +++++++-- test/wave_spinner_test.dart | 111 ++++++++++++++-------- test/wave_test.dart | 59 +++++++++--- 66 files changed, 1779 insertions(+), 624 deletions(-) create mode 100644 example/analysis_options.yaml diff --git a/analysis_options.yaml b/analysis_options.yaml index 7f849cb..6006315 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -39,3 +39,4 @@ linter: - use_named_constants - use_raw_strings - use_super_parameters + - require_trailing_commas diff --git a/example/analysis_options.yaml b/example/analysis_options.yaml new file mode 100644 index 0000000..8a10dae --- /dev/null +++ b/example/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at + # https://dart-lang.github.io/linter/lints/index.html. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + - require_trailing_commas + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/example/lib/main.dart b/example/lib/main.dart index 19ffd1f..63f6c5b 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -23,8 +23,12 @@ class App extends StatelessWidget { builder: (context) => IconButton( icon: const Icon(Icons.play_circle_filled), iconSize: 50.0, - onPressed: () => Navigator.of(context) - .push(MaterialPageRoute(builder: (_) => const ShowCase(), fullscreenDialog: true)), + onPressed: () => Navigator.of(context).push( + MaterialPageRoute( + builder: (_) => const ShowCase(), + fullscreenDialog: true, + ), + ), ), ), alignment: Alignment.bottomCenter, diff --git a/lib/src/chasing_dots.dart b/lib/src/chasing_dots.dart index 6f9ae52..3e45646 100644 --- a/lib/src/chasing_dots.dart +++ b/lib/src/chasing_dots.dart @@ -7,8 +7,11 @@ class SpinKitChasingDots extends StatefulWidget { this.size = 50.0, this.itemBuilder, this.duration = const Duration(milliseconds: 2000), - }) : assert(!(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), - 'You should specify either a itemBuilder or a color'), + }) : assert( + !(itemBuilder is IndexedWidgetBuilder && color is Color) && + !(itemBuilder == null && color == null), + 'You should specify either a itemBuilder or a color', + ), super(key: key); final Color? color; @@ -20,7 +23,8 @@ class SpinKitChasingDots extends StatefulWidget { State createState() => _SpinKitChasingDotsState(); } -class _SpinKitChasingDotsState extends State with TickerProviderStateMixin { +class _SpinKitChasingDotsState extends State + with TickerProviderStateMixin { late AnimationController _scaleCtrl; late AnimationController _rotateCtrl; late Animation _scale; @@ -37,12 +41,16 @@ class _SpinKitChasingDotsState extends State with TickerProv } }) ..repeat(reverse: true); - _scale = Tween(begin: -1.0, end: 1.0).animate(CurvedAnimation(parent: _scaleCtrl, curve: Curves.easeInOut)); + _scale = Tween(begin: -1.0, end: 1.0).animate( + CurvedAnimation(parent: _scaleCtrl, curve: Curves.easeInOut), + ); _rotateCtrl = AnimationController(vsync: this, duration: widget.duration) ..addListener(() => setState(() {})) ..repeat(); - _rotate = Tween(begin: 0.0, end: 360.0).animate(CurvedAnimation(parent: _rotateCtrl, curve: Curves.linear)); + _rotate = Tween(begin: 0.0, end: 360.0).animate( + CurvedAnimation(parent: _rotateCtrl, curve: Curves.linear), + ); } @override @@ -77,7 +85,12 @@ class _SpinKitChasingDotsState extends State with TickerProv size: Size.square(widget.size * 0.6), child: widget.itemBuilder != null ? widget.itemBuilder!(context, index) - : DecoratedBox(decoration: BoxDecoration(shape: BoxShape.circle, color: widget.color)), + : DecoratedBox( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: widget.color, + ), + ), ), ); } diff --git a/lib/src/circle.dart b/lib/src/circle.dart index 4ae961a..1678105 100644 --- a/lib/src/circle.dart +++ b/lib/src/circle.dart @@ -9,8 +9,11 @@ class SpinKitCircle extends StatefulWidget { this.itemBuilder, this.duration = const Duration(milliseconds: 1200), this.controller, - }) : assert(!(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), - 'You should specify either a itemBuilder or a color'), + }) : assert( + !(itemBuilder is IndexedWidgetBuilder && color is Color) && + !(itemBuilder == null && color == null), + 'You should specify either a itemBuilder or a color', + ), super(key: key); final Color? color; @@ -23,7 +26,8 @@ class SpinKitCircle extends StatefulWidget { State createState() => _SpinKitCircleState(); } -class _SpinKitCircleState extends State with SingleTickerProviderStateMixin { +class _SpinKitCircleState extends State + with SingleTickerProviderStateMixin { static const _itemCount = 12; late AnimationController _controller; @@ -32,7 +36,9 @@ class _SpinKitCircleState extends State with SingleTickerProvider void initState() { super.initState(); - _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration))..repeat(); + _controller = (widget.controller ?? + AnimationController(vsync: this, duration: widget.duration)) + ..repeat(); } @override @@ -59,8 +65,15 @@ class _SpinKitCircleState extends State with SingleTickerProvider child: Align( alignment: Alignment.center, child: ScaleTransition( - scale: DelayTween(begin: 0.0, end: 1.0, delay: index / _itemCount).animate(_controller), - child: SizedBox.fromSize(size: Size.square(widget.size * 0.15), child: _itemBuilder(index)), + scale: DelayTween( + begin: 0.0, + end: 1.0, + delay: index / _itemCount, + ).animate(_controller), + child: SizedBox.fromSize( + size: Size.square(widget.size * 0.15), + child: _itemBuilder(index), + ), ), ), ), @@ -73,5 +86,10 @@ class _SpinKitCircleState extends State with SingleTickerProvider Widget _itemBuilder(int index) => widget.itemBuilder != null ? widget.itemBuilder!(context, index) - : DecoratedBox(decoration: BoxDecoration(color: widget.color, shape: BoxShape.circle)); + : DecoratedBox( + decoration: BoxDecoration( + color: widget.color, + shape: BoxShape.circle, + ), + ); } diff --git a/lib/src/cube_grid.dart b/lib/src/cube_grid.dart index f53ba60..ef97e42 100644 --- a/lib/src/cube_grid.dart +++ b/lib/src/cube_grid.dart @@ -8,8 +8,11 @@ class SpinKitCubeGrid extends StatefulWidget { this.itemBuilder, this.duration = const Duration(milliseconds: 1200), this.controller, - }) : assert(!(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), - 'You should specify either a itemBuilder or a color'), + }) : assert( + !(itemBuilder is IndexedWidgetBuilder && color is Color) && + !(itemBuilder == null && color == null), + 'You should specify either a itemBuilder or a color', + ), super(key: key); final Color? color; @@ -22,7 +25,8 @@ class SpinKitCubeGrid extends StatefulWidget { State createState() => _SpinKitCubeGridState(); } -class _SpinKitCubeGridState extends State with SingleTickerProviderStateMixin { +class _SpinKitCubeGridState extends State + with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _anim1; late Animation _anim2; @@ -34,18 +38,39 @@ class _SpinKitCubeGridState extends State with SingleTickerProv void initState() { super.initState(); - _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) + _controller = (widget.controller ?? + AnimationController(vsync: this, duration: widget.duration)) ..repeat(reverse: true); - _anim1 = Tween(begin: 1.0, end: 0.0) - .animate(CurvedAnimation(parent: _controller, curve: const Interval(0.1, 0.6, curve: Curves.easeIn))); - _anim2 = Tween(begin: 1.0, end: 0.0) - .animate(CurvedAnimation(parent: _controller, curve: const Interval(0.2, 0.7, curve: Curves.easeIn))); - _anim3 = Tween(begin: 1.0, end: 0.0) - .animate(CurvedAnimation(parent: _controller, curve: const Interval(0.3, 0.8, curve: Curves.easeIn))); - _anim4 = Tween(begin: 1.0, end: 0.0) - .animate(CurvedAnimation(parent: _controller, curve: const Interval(0.4, 0.9, curve: Curves.easeIn))); - _anim5 = Tween(begin: 1.0, end: 0.0) - .animate(CurvedAnimation(parent: _controller, curve: const Interval(0.5, 1.0, curve: Curves.easeIn))); + _anim1 = Tween(begin: 1.0, end: 0.0).animate( + CurvedAnimation( + parent: _controller, + curve: const Interval(0.1, 0.6, curve: Curves.easeIn), + ), + ); + _anim2 = Tween(begin: 1.0, end: 0.0).animate( + CurvedAnimation( + parent: _controller, + curve: const Interval(0.2, 0.7, curve: Curves.easeIn), + ), + ); + _anim3 = Tween(begin: 1.0, end: 0.0).animate( + CurvedAnimation( + parent: _controller, + curve: const Interval(0.3, 0.8, curve: Curves.easeIn), + ), + ); + _anim4 = Tween(begin: 1.0, end: 0.0).animate( + CurvedAnimation( + parent: _controller, + curve: const Interval(0.4, 0.9, curve: Curves.easeIn), + ), + ); + _anim5 = Tween(begin: 1.0, end: 0.0).animate( + CurvedAnimation( + parent: _controller, + curve: const Interval(0.5, 1.0, curve: Curves.easeIn), + ), + ); } @override @@ -99,7 +124,10 @@ class _SpinKitCubeGridState extends State with SingleTickerProv Widget _square(Animation animation, int index) { return ScaleTransition( scale: animation, - child: SizedBox.fromSize(size: Size.square(widget.size / 3), child: _itemBuilder(index)), + child: SizedBox.fromSize( + size: Size.square(widget.size / 3), + child: _itemBuilder(index), + ), ); } diff --git a/lib/src/dancing_square.dart b/lib/src/dancing_square.dart index 41c33d1..b8c84e4 100644 --- a/lib/src/dancing_square.dart +++ b/lib/src/dancing_square.dart @@ -10,8 +10,11 @@ class SpinKitDancingSquare extends StatefulWidget { this.itemBuilder, this.duration = const Duration(milliseconds: 1200), this.controller, - }) : assert(!(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), - 'You should specify either a itemBuilder or a color'), + }) : assert( + !(itemBuilder is IndexedWidgetBuilder && color is Color) && + !(itemBuilder == null && color == null), + 'You should specify either a itemBuilder or a color', + ), super(key: key); final Color? color; @@ -24,7 +27,8 @@ class SpinKitDancingSquare extends StatefulWidget { State createState() => _SpinKitDancingSquareState(); } -class _SpinKitDancingSquareState extends State with SingleTickerProviderStateMixin { +class _SpinKitDancingSquareState extends State + with SingleTickerProviderStateMixin { static const _itemCount = 12; late AnimationController _controller; @@ -33,7 +37,9 @@ class _SpinKitDancingSquareState extends State with Single void initState() { super.initState(); - _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration))..repeat(); + _controller = (widget.controller ?? + AnimationController(vsync: this, duration: widget.duration)) + ..repeat(); } @override @@ -63,7 +69,11 @@ class _SpinKitDancingSquareState extends State with Single child: Align( alignment: Alignment.center, child: ScaleTransition( - scale: DelayTween(begin: 0.0, end: 1.0, delay: delay).animate(_controller), + scale: DelayTween( + begin: 0.0, + end: 1.0, + delay: delay, + ).animate(_controller), child: SizedBox.fromSize( size: Size.square(widget.size * 0.15), child: _itemBuilder(index), @@ -80,7 +90,11 @@ class _SpinKitDancingSquareState extends State with Single child: Align( alignment: Alignment.center, child: ScaleTransition( - scale: DelayTween(begin: 0.0, end: 1.0, delay: delay).animate(_controller), + scale: DelayTween( + begin: 0.0, + end: 1.0, + delay: delay, + ).animate(_controller), child: SizedBox.fromSize( size: Size.square(widget.size * 0.15), child: _itemBuilder(index), @@ -97,7 +111,11 @@ class _SpinKitDancingSquareState extends State with Single child: Align( alignment: Alignment.center, child: ScaleTransition( - scale: DelayTween(begin: 0.0, end: 1.0, delay: delay).animate(_controller), + scale: DelayTween( + begin: 0.0, + end: 1.0, + delay: delay, + ).animate(_controller), child: SizedBox.fromSize( size: Size.square(widget.size * 0.15), child: _itemBuilder(index), @@ -114,7 +132,11 @@ class _SpinKitDancingSquareState extends State with Single child: Align( alignment: Alignment.center, child: ScaleTransition( - scale: DelayTween(begin: 0.0, end: 1.0, delay: delay).animate(_controller), + scale: DelayTween( + begin: 0.0, + end: 1.0, + delay: delay, + ).animate(_controller), child: SizedBox.fromSize( size: Size.square(widget.size * 0.15), child: _itemBuilder(index), @@ -134,6 +156,9 @@ class _SpinKitDancingSquareState extends State with Single Widget _itemBuilder(int index) => widget.itemBuilder != null ? widget.itemBuilder!(context, index) : DecoratedBox( - decoration: BoxDecoration(color: widget.color, shape: BoxShape.rectangle), + decoration: BoxDecoration( + color: widget.color, + shape: BoxShape.rectangle, + ), ); } diff --git a/lib/src/double_bounce.dart b/lib/src/double_bounce.dart index a422f67..28d4ab2 100644 --- a/lib/src/double_bounce.dart +++ b/lib/src/double_bounce.dart @@ -8,8 +8,11 @@ class SpinKitDoubleBounce extends StatefulWidget { this.itemBuilder, this.duration = const Duration(milliseconds: 2000), this.controller, - }) : assert(!(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), - 'You should specify either a itemBuilder or a color'), + }) : assert( + !(itemBuilder is IndexedWidgetBuilder && color is Color) && + !(itemBuilder == null && color == null), + 'You should specify either a itemBuilder or a color', + ), super(key: key); final Color? color; @@ -22,7 +25,8 @@ class SpinKitDoubleBounce extends StatefulWidget { State createState() => _SpinKitDoubleBounceState(); } -class _SpinKitDoubleBounceState extends State with SingleTickerProviderStateMixin { +class _SpinKitDoubleBounceState extends State + with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _animation; @@ -30,14 +34,17 @@ class _SpinKitDoubleBounceState extends State with SingleTi void initState() { super.initState(); - _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) + _controller = (widget.controller ?? + AnimationController(vsync: this, duration: widget.duration)) ..addListener(() { if (mounted) { setState(() {}); } }) ..repeat(reverse: true); - _animation = Tween(begin: -1.0, end: 1.0).animate(CurvedAnimation(parent: _controller, curve: Curves.easeInOut)); + _animation = Tween(begin: -1.0, end: 1.0).animate( + CurvedAnimation(parent: _controller, curve: Curves.easeInOut), + ); } @override @@ -55,7 +62,10 @@ class _SpinKitDoubleBounceState extends State with SingleTi children: List.generate(2, (i) { return Transform.scale( scale: (1.0 - i - _animation.value.abs()).abs(), - child: SizedBox.fromSize(size: Size.square(widget.size), child: _itemBuilder(i)), + child: SizedBox.fromSize( + size: Size.square(widget.size), + child: _itemBuilder(i), + ), ); }), ), @@ -64,5 +74,10 @@ class _SpinKitDoubleBounceState extends State with SingleTi Widget _itemBuilder(int index) => widget.itemBuilder != null ? widget.itemBuilder!(context, index) - : DecoratedBox(decoration: BoxDecoration(shape: BoxShape.circle, color: widget.color!.withOpacity(0.6))); + : DecoratedBox( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: widget.color!.withOpacity(0.6), + ), + ); } diff --git a/lib/src/dual_ring.dart b/lib/src/dual_ring.dart index 3a2ae99..6255c5b 100644 --- a/lib/src/dual_ring.dart +++ b/lib/src/dual_ring.dart @@ -22,7 +22,8 @@ class SpinKitDualRing extends StatefulWidget { State createState() => _SpinKitDualRingState(); } -class _SpinKitDualRingState extends State with SingleTickerProviderStateMixin { +class _SpinKitDualRingState extends State + with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _animation; @@ -30,15 +31,20 @@ class _SpinKitDualRingState extends State with SingleTickerProv void initState() { super.initState(); - _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) + _controller = (widget.controller ?? + AnimationController(vsync: this, duration: widget.duration)) ..addListener(() { if (mounted) { setState(() {}); } }) ..repeat(); - _animation = Tween(begin: 0.0, end: 1.0) - .animate(CurvedAnimation(parent: _controller, curve: const Interval(0.0, 1.0, curve: Curves.linear))); + _animation = Tween(begin: 0.0, end: 1.0).animate( + CurvedAnimation( + parent: _controller, + curve: const Interval(0.0, 1.0, curve: Curves.linear), + ), + ); } @override @@ -53,10 +59,15 @@ class _SpinKitDualRingState extends State with SingleTickerProv Widget build(BuildContext context) { return Center( child: Transform( - transform: Matrix4.identity()..rotateZ((_animation.value) * math.pi * 2), + transform: Matrix4.identity() + ..rotateZ((_animation.value) * math.pi * 2), alignment: FractionalOffset.center, child: CustomPaint( - painter: _DualRingPainter(angle: 90, paintWidth: widget.lineWidth, color: widget.color), + painter: _DualRingPainter( + angle: 90, + paintWidth: widget.lineWidth, + color: widget.color, + ), child: SizedBox.fromSize(size: Size.square(widget.size)), ), ), @@ -65,8 +76,11 @@ class _SpinKitDualRingState extends State with SingleTickerProv } class _DualRingPainter extends CustomPainter { - _DualRingPainter({required this.angle, required double paintWidth, required Color color}) - : ringPaint = Paint() + _DualRingPainter({ + required this.angle, + required double paintWidth, + required Color color, + }) : ringPaint = Paint() ..color = color ..strokeWidth = paintWidth ..style = PaintingStyle.stroke; diff --git a/lib/src/fading_circle.dart b/lib/src/fading_circle.dart index db7485b..2c7492f 100644 --- a/lib/src/fading_circle.dart +++ b/lib/src/fading_circle.dart @@ -9,8 +9,11 @@ class SpinKitFadingCircle extends StatefulWidget { this.itemBuilder, this.duration = const Duration(milliseconds: 1200), this.controller, - }) : assert(!(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), - 'You should specify either a itemBuilder or a color'), + }) : assert( + !(itemBuilder is IndexedWidgetBuilder && color is Color) && + !(itemBuilder == null && color == null), + 'You should specify either a itemBuilder or a color', + ), super(key: key); final Color? color; @@ -23,7 +26,8 @@ class SpinKitFadingCircle extends StatefulWidget { State createState() => _SpinKitFadingCircleState(); } -class _SpinKitFadingCircleState extends State with SingleTickerProviderStateMixin { +class _SpinKitFadingCircleState extends State + with SingleTickerProviderStateMixin { static const _itemCount = 12; late AnimationController _controller; @@ -32,7 +36,9 @@ class _SpinKitFadingCircleState extends State with SingleTi void initState() { super.initState(); - _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration))..repeat(); + _controller = (widget.controller ?? + AnimationController(vsync: this, duration: widget.duration)) + ..repeat(); } @override @@ -59,8 +65,15 @@ class _SpinKitFadingCircleState extends State with SingleTi child: Align( alignment: Alignment.center, child: FadeTransition( - opacity: DelayTween(begin: 0.0, end: 1.0, delay: i / _itemCount).animate(_controller), - child: SizedBox.fromSize(size: Size.square(widget.size * 0.15), child: _itemBuilder(i)), + opacity: DelayTween( + begin: 0.0, + end: 1.0, + delay: i / _itemCount, + ).animate(_controller), + child: SizedBox.fromSize( + size: Size.square(widget.size * 0.15), + child: _itemBuilder(i), + ), ), ), ), @@ -73,5 +86,10 @@ class _SpinKitFadingCircleState extends State with SingleTi Widget _itemBuilder(int index) => widget.itemBuilder != null ? widget.itemBuilder!(context, index) - : DecoratedBox(decoration: BoxDecoration(color: widget.color, shape: BoxShape.circle)); + : DecoratedBox( + decoration: BoxDecoration( + color: widget.color, + shape: BoxShape.circle, + ), + ); } diff --git a/lib/src/fading_cube.dart b/lib/src/fading_cube.dart index e497e14..3d1d369 100644 --- a/lib/src/fading_cube.dart +++ b/lib/src/fading_cube.dart @@ -9,8 +9,11 @@ class SpinKitFadingCube extends StatefulWidget { this.itemBuilder, this.duration = const Duration(milliseconds: 2400), this.controller, - }) : assert(!(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), - 'You should specify either a itemBuilder or a color'), + }) : assert( + !(itemBuilder is IndexedWidgetBuilder && color is Color) && + !(itemBuilder == null && color == null), + 'You should specify either a itemBuilder or a color', + ), super(key: key); final Color? color; @@ -23,14 +26,17 @@ class SpinKitFadingCube extends StatefulWidget { State createState() => _SpinKitFadingCubeState(); } -class _SpinKitFadingCubeState extends State with SingleTickerProviderStateMixin { +class _SpinKitFadingCubeState extends State + with SingleTickerProviderStateMixin { late AnimationController _controller; @override void initState() { super.initState(); - _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration))..repeat(); + _controller = (widget.controller ?? + AnimationController(vsync: this, duration: widget.duration)) + ..repeat(); } @override @@ -63,8 +69,15 @@ class _SpinKitFadingCubeState extends State with SingleTicker child: Align( alignment: Alignment.center, child: FadeTransition( - opacity: DelayTween(begin: 0.0, end: 1.0, delay: 0.3 * i).animate(_controller), - child: SizedBox.fromSize(size: Size.square(size), child: _itemBuilder(i)), + opacity: DelayTween( + begin: 0.0, + end: 1.0, + delay: 0.3 * i, + ).animate(_controller), + child: SizedBox.fromSize( + size: Size.square(size), + child: _itemBuilder(i), + ), ), ), ), diff --git a/lib/src/fading_four.dart b/lib/src/fading_four.dart index b256605..76024b3 100644 --- a/lib/src/fading_four.dart +++ b/lib/src/fading_four.dart @@ -10,8 +10,11 @@ class SpinKitFadingFour extends StatefulWidget { this.itemBuilder, this.duration = const Duration(milliseconds: 1200), this.controller, - }) : assert(!(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), - 'You should specify either a itemBuilder or a color'), + }) : assert( + !(itemBuilder is IndexedWidgetBuilder && color is Color) && + !(itemBuilder == null && color == null), + 'You should specify either a itemBuilder or a color', + ), super(key: key); final Color? color; @@ -25,7 +28,8 @@ class SpinKitFadingFour extends StatefulWidget { State createState() => _SpinKitFadingFourState(); } -class _SpinKitFadingFourState extends State with SingleTickerProviderStateMixin { +class _SpinKitFadingFourState extends State + with SingleTickerProviderStateMixin { static const List _delays = [.0, -0.9, -0.6, -0.3]; late AnimationController _controller; @@ -33,7 +37,9 @@ class _SpinKitFadingFourState extends State with SingleTicker void initState() { super.initState(); - _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration))..repeat(); + _controller = (widget.controller ?? + AnimationController(vsync: this, duration: widget.duration)) + ..repeat(); } @override @@ -60,8 +66,15 @@ class _SpinKitFadingFourState extends State with SingleTicker child: Align( alignment: Alignment.center, child: FadeTransition( - opacity: DelayTween(begin: 0.0, end: 1.0, delay: _delays[i]).animate(_controller), - child: SizedBox.fromSize(size: Size.square(widget.size * 0.25), child: _itemBuilder(i)), + opacity: DelayTween( + begin: 0.0, + end: 1.0, + delay: _delays[i], + ).animate(_controller), + child: SizedBox.fromSize( + size: Size.square(widget.size * 0.25), + child: _itemBuilder(i), + ), ), ), ), @@ -74,5 +87,7 @@ class _SpinKitFadingFourState extends State with SingleTicker Widget _itemBuilder(int index) => widget.itemBuilder != null ? widget.itemBuilder!(context, index) - : DecoratedBox(decoration: BoxDecoration(color: widget.color, shape: widget.shape)); + : DecoratedBox( + decoration: BoxDecoration(color: widget.color, shape: widget.shape), + ); } diff --git a/lib/src/fading_grid.dart b/lib/src/fading_grid.dart index a6bb014..159919b 100644 --- a/lib/src/fading_grid.dart +++ b/lib/src/fading_grid.dart @@ -10,8 +10,11 @@ class SpinKitFadingGrid extends StatefulWidget { this.itemBuilder, this.duration = const Duration(milliseconds: 1200), this.controller, - }) : assert(!(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), - 'You should specify either a itemBuilder or a color'), + }) : assert( + !(itemBuilder is IndexedWidgetBuilder && color is Color) && + !(itemBuilder == null && color == null), + 'You should specify either a itemBuilder or a color', + ), super(key: key); final Color? color; @@ -25,14 +28,17 @@ class SpinKitFadingGrid extends StatefulWidget { State createState() => _SpinKitFadingGridState(); } -class _SpinKitFadingGridState extends State with SingleTickerProviderStateMixin { +class _SpinKitFadingGridState extends State + with SingleTickerProviderStateMixin { late AnimationController _controller; @override void initState() { super.initState(); - _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration))..repeat(); + _controller = (widget.controller ?? + AnimationController(vsync: this, duration: widget.duration)) + ..repeat(); } @override @@ -105,7 +111,11 @@ class _SpinKitFadingGridState extends State with SingleTicker Widget _circle(int index, int i) { return FadeTransition( - opacity: DelayTween(begin: 0.4, end: 0.9, delay: 0.3 * (i - 1)).animate(_controller), + opacity: DelayTween( + begin: 0.4, + end: 0.9, + delay: 0.3 * (i - 1), + ).animate(_controller), child: SizedBox.fromSize( size: Size.square(widget.size / 4), child: _itemBuilder(index), @@ -115,5 +125,7 @@ class _SpinKitFadingGridState extends State with SingleTicker Widget _itemBuilder(int index) => widget.itemBuilder != null ? widget.itemBuilder!(context, index) - : DecoratedBox(decoration: BoxDecoration(color: widget.color, shape: widget.shape)); + : DecoratedBox( + decoration: BoxDecoration(color: widget.color, shape: widget.shape), + ); } diff --git a/lib/src/folding_cube.dart b/lib/src/folding_cube.dart index 35d6599..394499f 100644 --- a/lib/src/folding_cube.dart +++ b/lib/src/folding_cube.dart @@ -10,8 +10,11 @@ class SpinKitFoldingCube extends StatefulWidget { this.itemBuilder, this.duration = const Duration(milliseconds: 2400), this.controller, - }) : assert(!(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), - 'You should specify either a itemBuilder or a color'), + }) : assert( + !(itemBuilder is IndexedWidgetBuilder && color is Color) && + !(itemBuilder == null && color == null), + 'You should specify either a itemBuilder or a color', + ), super(key: key); final Color? color; @@ -24,7 +27,8 @@ class SpinKitFoldingCube extends StatefulWidget { State createState() => _SpinKitFoldingCubeState(); } -class _SpinKitFoldingCubeState extends State with TickerProviderStateMixin { +class _SpinKitFoldingCubeState extends State + with TickerProviderStateMixin { late final int _delay; late AnimationController _controller1; @@ -46,22 +50,38 @@ class _SpinKitFoldingCubeState extends State with TickerProv _delay = widget.duration.inMilliseconds ~/ 8; - _controller1 = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) + _controller1 = (widget.controller ?? + AnimationController(vsync: this, duration: widget.duration)) ..addListener(() { if (mounted) { setState(() {}); } }); - _controller2 = widget.controller ?? AnimationController(vsync: this, duration: widget.duration); - _controller3 = widget.controller ?? AnimationController(vsync: this, duration: widget.duration); - _controller4 = widget.controller ?? AnimationController(vsync: this, duration: widget.duration); + _controller2 = widget.controller ?? + AnimationController(vsync: this, duration: widget.duration); + _controller3 = widget.controller ?? + AnimationController(vsync: this, duration: widget.duration); + _controller4 = widget.controller ?? + AnimationController(vsync: this, duration: widget.duration); final tweenSequence = TweenSequence([ - TweenSequenceItem(tween: ConstantTween(-180.0).chain(CurveTween(curve: Curves.easeIn)), weight: 10.0), - TweenSequenceItem(tween: Tween(begin: -180.0, end: 0.0), weight: 15.0), + TweenSequenceItem( + tween: ConstantTween(-180.0).chain( + CurveTween(curve: Curves.easeIn), + ), + weight: 10.0, + ), + TweenSequenceItem( + tween: Tween(begin: -180.0, end: 0.0), + weight: 15.0, + ), TweenSequenceItem(tween: ConstantTween(0.0), weight: 50.0), TweenSequenceItem( - tween: Tween(begin: 0.0, end: 180.0).chain(CurveTween(curve: Curves.easeIn)), weight: 15.0), + tween: Tween(begin: 0.0, end: 180.0).chain( + CurveTween(curve: Curves.easeIn), + ), + weight: 15.0, + ), TweenSequenceItem(tween: ConstantTween(180.0), weight: 10), ]); @@ -155,7 +175,9 @@ class _SpinKitFoldingCubeState extends State with TickerProv alignment: Alignment.center, child: Transform( transform: tRotate, - alignment: animation.value <= 0 ? Alignment.topCenter : Alignment.centerLeft, + alignment: animation.value <= 0 + ? Alignment.topCenter + : Alignment.centerLeft, child: Opacity( opacity: 1.0 - (animation.value.abs() / 180.0), child: SizedBox.fromSize( diff --git a/lib/src/hour_glass.dart b/lib/src/hour_glass.dart index 14cee0e..d61516a 100644 --- a/lib/src/hour_glass.dart +++ b/lib/src/hour_glass.dart @@ -20,7 +20,8 @@ class SpinKitHourGlass extends StatefulWidget { State createState() => _SpinKitHourGlassState(); } -class _SpinKitHourGlassState extends State with SingleTickerProviderStateMixin { +class _SpinKitHourGlassState extends State + with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _animation; @@ -28,15 +29,20 @@ class _SpinKitHourGlassState extends State with SingleTickerPr void initState() { super.initState(); - _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) + _controller = (widget.controller ?? + AnimationController(vsync: this, duration: widget.duration)) ..addListener(() { if (mounted) { setState(() {}); } }) ..repeat(); - _animation = Tween(begin: 0.0, end: 8.0) - .animate(CurvedAnimation(parent: _controller, curve: const Interval(0.0, 1.0, curve: Curves.easeOut))); + _animation = Tween(begin: 0.0, end: 8.0).animate( + CurvedAnimation( + parent: _controller, + curve: const Interval(0.0, 1.0, curve: Curves.easeOut), + ), + ); } @override diff --git a/lib/src/piano_wave.dart b/lib/src/piano_wave.dart index fe27aca..766f20a 100644 --- a/lib/src/piano_wave.dart +++ b/lib/src/piano_wave.dart @@ -14,8 +14,11 @@ class SpinKitPianoWave extends StatefulWidget { this.itemCount = 5, this.duration = const Duration(milliseconds: 1200), this.controller, - }) : assert(!(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), - 'You should specify either a itemBuilder or a color'), + }) : assert( + !(itemBuilder is IndexedWidgetBuilder && color is Color) && + !(itemBuilder == null && color == null), + 'You should specify either a itemBuilder or a color', + ), assert(itemCount >= 2, 'itemCount Cant be less then 2 '), super(key: key); @@ -31,14 +34,17 @@ class SpinKitPianoWave extends StatefulWidget { State createState() => _SpinKitPianoWaveState(); } -class _SpinKitPianoWaveState extends State with SingleTickerProviderStateMixin { +class _SpinKitPianoWaveState extends State + with SingleTickerProviderStateMixin { late AnimationController _controller; @override void initState() { super.initState(); - _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration))..repeat(); + _controller = (widget.controller ?? + AnimationController(vsync: this, duration: widget.duration)) + ..repeat(); } @override @@ -59,7 +65,11 @@ class _SpinKitPianoWaveState extends State with SingleTickerPr mainAxisAlignment: MainAxisAlignment.spaceBetween, children: List.generate(bars.length, (i) { return DottedScaleXWidget( - scaleX: DelayTween(begin: .4, end: 1.0, delay: bars[i]).animate(_controller), + scaleX: DelayTween( + begin: .4, + end: 1.0, + delay: bars[i], + ).animate(_controller), child: SizedBox.fromSize( size: Size(widget.size / widget.itemCount, widget.size), child: _itemBuilder(i), @@ -85,7 +95,10 @@ class _SpinKitPianoWaveState extends State with SingleTickerPr List _startAnimationDelay(int count) { return [ - ...List.generate(count ~/ 2, (index) => -1.0 - (index * 0.1) - 0.1).reversed, + ...List.generate( + count ~/ 2, + (index) => -1.0 - (index * 0.1) - 0.1, + ).reversed, if (count.isOdd) -1.0, ...List.generate( count ~/ 2, @@ -96,7 +109,10 @@ class _SpinKitPianoWaveState extends State with SingleTickerPr List _endAnimationDelay(int count) { return [ - ...List.generate(count ~/ 2, (index) => -1.0 + (index * 0.1) + 0.1).reversed, + ...List.generate( + count ~/ 2, + (index) => -1.0 + (index * 0.1) + 0.1, + ).reversed, if (count.isOdd) -1.0, ...List.generate( count ~/ 2, @@ -107,9 +123,15 @@ class _SpinKitPianoWaveState extends State with SingleTickerPr List _centerAnimationDelay(int count) { return [ - ...List.generate(count ~/ 2, (index) => -1.0 + (index * 0.2) + 0.2).reversed, + ...List.generate( + count ~/ 2, + (index) => -1.0 + (index * 0.2) + 0.2, + ).reversed, if (count.isOdd) -1.0, - ...List.generate(count ~/ 2, (index) => -1.0 + (index * 0.2) + 0.2), + ...List.generate( + count ~/ 2, + (index) => -1.0 + (index * 0.2) + 0.2, + ), ]; } diff --git a/lib/src/pouring_hour_glass.dart b/lib/src/pouring_hour_glass.dart index 45a0a77..774830e 100644 --- a/lib/src/pouring_hour_glass.dart +++ b/lib/src/pouring_hour_glass.dart @@ -19,10 +19,12 @@ class SpinKitPouringHourGlass extends StatefulWidget { final AnimationController? controller; @override - State createState() => _SpinKitPouringHourGlassState(); + State createState() => + _SpinKitPouringHourGlassState(); } -class _SpinKitPouringHourGlassState extends State with SingleTickerProviderStateMixin { +class _SpinKitPouringHourGlassState extends State + with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _pouringAnimation; late Animation _rotationAnimation; @@ -31,17 +33,24 @@ class _SpinKitPouringHourGlassState extends State with void initState() { super.initState(); - _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) + _controller = (widget.controller ?? + AnimationController(vsync: this, duration: widget.duration)) ..addListener(() { if (mounted) { setState(() {}); } }) ..repeat(); - _pouringAnimation = CurvedAnimation(parent: _controller, curve: const Interval(0.0, 0.9)) - ..addListener(() => setState(() {})); - _rotationAnimation = Tween(begin: 0.0, end: 0.5) - .animate(CurvedAnimation(parent: _controller, curve: const Interval(0.9, 1.0, curve: Curves.fastOutSlowIn))); + _pouringAnimation = CurvedAnimation( + parent: _controller, + curve: const Interval(0.0, 0.9), + )..addListener(() => setState(() {})); + _rotationAnimation = Tween(begin: 0.0, end: 0.5).animate( + CurvedAnimation( + parent: _controller, + curve: const Interval(0.9, 1.0, curve: Curves.fastOutSlowIn), + ), + ); } @override @@ -109,8 +118,13 @@ class _HourGlassPaint extends CustomPainter { final upperPart = Path() ..moveTo(0.0, top) - ..addRect(Rect.fromLTRB(0.0, halfHeight * poured!, size.width, halfHeight)); - canvas.drawPath(Path.combine(PathOperation.intersect, hourglassPath, upperPart), _powderPaint); + ..addRect( + Rect.fromLTRB(0.0, halfHeight * poured!, size.width, halfHeight), + ); + canvas.drawPath( + Path.combine(PathOperation.intersect, hourglassPath, upperPart), + _powderPaint, + ); final lowerPartPath = Path() ..moveTo(centerX, bottom) @@ -125,7 +139,11 @@ class _HourGlassPaint extends CustomPainter { ); canvas.drawPath(lowerPart, _powderPaint); - canvas.drawLine(Offset(centerX, halfHeight), Offset(centerX, bottom), _paint); + canvas.drawLine( + Offset(centerX, halfHeight), + Offset(centerX, bottom), + _paint, + ); } @override diff --git a/lib/src/pouring_hour_glass_refined.dart b/lib/src/pouring_hour_glass_refined.dart index bba2471..4cddcc2 100644 --- a/lib/src/pouring_hour_glass_refined.dart +++ b/lib/src/pouring_hour_glass_refined.dart @@ -19,10 +19,12 @@ class SpinKitPouringHourGlassRefined extends StatefulWidget { final AnimationController? controller; @override - State createState() => _SpinKitPouringHourGlassRefinedState(); + State createState() => + _SpinKitPouringHourGlassRefinedState(); } -class _SpinKitPouringHourGlassRefinedState extends State +class _SpinKitPouringHourGlassRefinedState + extends State with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _pouringAnimation; @@ -32,17 +34,24 @@ class _SpinKitPouringHourGlassRefinedState extends State setState(() {})); - _rotationAnimation = Tween(begin: 0.0, end: 0.5) - .animate(CurvedAnimation(parent: _controller, curve: const Interval(0.9, 1.0, curve: Curves.fastOutSlowIn))); + _pouringAnimation = CurvedAnimation( + parent: _controller, + curve: const Interval(0.0, 0.9), + )..addListener(() => setState(() {})); + _rotationAnimation = Tween(begin: 0.0, end: 0.5).animate( + CurvedAnimation( + parent: _controller, + curve: const Interval(0.9, 1.0, curve: Curves.fastOutSlowIn), + ), + ); } @override @@ -107,9 +116,18 @@ class _HourGlassPaint extends CustomPainter { clockwise: true, ) ..lineTo(centerX + hourglassWidth - 2, top + 8) - ..quadraticBezierTo(centerX + hourglassWidth - 2, (top + halfHeight) / 2 + 2, centerX + gapWidth, halfHeight) ..quadraticBezierTo( - centerX + hourglassWidth - 2, (bottom + halfHeight) / 2, centerX + hourglassWidth - 2, bottom - 7) + centerX + hourglassWidth - 2, + (top + halfHeight) / 2 + 2, + centerX + gapWidth, + halfHeight, + ) + ..quadraticBezierTo( + centerX + hourglassWidth - 2, + (bottom + halfHeight) / 2, + centerX + hourglassWidth - 2, + bottom - 7, + ) ..arcToPoint( Offset(centerX + hourglassWidth, bottom), radius: const Radius.circular(4), @@ -122,9 +140,18 @@ class _HourGlassPaint extends CustomPainter { clockwise: true, ) ..lineTo(centerX - hourglassWidth + 2, bottom - 7) - ..quadraticBezierTo(centerX - hourglassWidth + 2, (bottom + halfHeight) / 2, centerX - gapWidth, halfHeight) ..quadraticBezierTo( - centerX - hourglassWidth + 2, (top + halfHeight) / 2 + 2, centerX - hourglassWidth + 2, top + 7) + centerX - hourglassWidth + 2, + (bottom + halfHeight) / 2, + centerX - gapWidth, + halfHeight, + ) + ..quadraticBezierTo( + centerX - hourglassWidth + 2, + (top + halfHeight) / 2 + 2, + centerX - hourglassWidth + 2, + top + 7, + ) ..arcToPoint( Offset(centerX - hourglassWidth, top), radius: const Radius.circular(4), @@ -135,8 +162,13 @@ class _HourGlassPaint extends CustomPainter { final upperPart = Path() ..moveTo(0.0, top) - ..addRect(Rect.fromLTRB(0.0, halfHeight * poured!, size.width, halfHeight)); - canvas.drawPath(Path.combine(PathOperation.intersect, hourglassPath, upperPart), _powderPaint); + ..addRect( + Rect.fromLTRB(0.0, halfHeight * poured!, size.width, halfHeight), + ); + canvas.drawPath( + Path.combine(PathOperation.intersect, hourglassPath, upperPart), + _powderPaint, + ); final lowerPartPath = Path() ..moveTo(centerX, bottom) @@ -151,7 +183,11 @@ class _HourGlassPaint extends CustomPainter { ); canvas.drawPath(lowerPart, _powderPaint); - canvas.drawLine(Offset(centerX, halfHeight), Offset(centerX, bottom), _paint); + canvas.drawLine( + Offset(centerX, halfHeight), + Offset(centerX, bottom), + _paint, + ); } @override diff --git a/lib/src/pulse.dart b/lib/src/pulse.dart index 6e42339..f6ccd73 100644 --- a/lib/src/pulse.dart +++ b/lib/src/pulse.dart @@ -8,8 +8,11 @@ class SpinKitPulse extends StatefulWidget { this.itemBuilder, this.duration = const Duration(seconds: 1), this.controller, - }) : assert(!(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), - 'You should specify either a itemBuilder or a color'), + }) : assert( + !(itemBuilder is IndexedWidgetBuilder && color is Color) && + !(itemBuilder == null && color == null), + 'You should specify either a itemBuilder or a color', + ), super(key: key); final Color? color; @@ -22,7 +25,8 @@ class SpinKitPulse extends StatefulWidget { State createState() => _SpinKitPulseState(); } -class _SpinKitPulseState extends State with SingleTickerProviderStateMixin { +class _SpinKitPulseState extends State + with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _animation; @@ -30,7 +34,8 @@ class _SpinKitPulseState extends State with SingleTickerProviderSt void initState() { super.initState(); - _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) + _controller = (widget.controller ?? + AnimationController(vsync: this, duration: widget.duration)) ..addListener(() { if (mounted) { setState(() {}); @@ -66,5 +71,10 @@ class _SpinKitPulseState extends State with SingleTickerProviderSt Widget _itemBuilder(int index) => widget.itemBuilder != null ? widget.itemBuilder!(context, index) - : DecoratedBox(decoration: BoxDecoration(shape: BoxShape.circle, color: widget.color)); + : DecoratedBox( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: widget.color, + ), + ); } diff --git a/lib/src/pulsing_grid.dart b/lib/src/pulsing_grid.dart index 50a382a..5eeb111 100644 --- a/lib/src/pulsing_grid.dart +++ b/lib/src/pulsing_grid.dart @@ -11,8 +11,11 @@ class SpinKitPulsingGrid extends StatefulWidget { this.duration = const Duration(milliseconds: 1500), this.boxShape, this.controller, - }) : assert(!(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), - 'You should specify either a itemBuilder or a color'), + }) : assert( + !(itemBuilder is IndexedWidgetBuilder && color is Color) && + !(itemBuilder == null && color == null), + 'You should specify either a itemBuilder or a color', + ), super(key: key); final Color? color; @@ -26,7 +29,8 @@ class SpinKitPulsingGrid extends StatefulWidget { State createState() => _SpinKitPulsingGridState(); } -class _SpinKitPulsingGridState extends State with SingleTickerProviderStateMixin { +class _SpinKitPulsingGridState extends State + with SingleTickerProviderStateMixin { static const _gridCount = 3; late AnimationController _controller; @@ -35,7 +39,9 @@ class _SpinKitPulsingGridState extends State with SingleTick void initState() { super.initState(); - _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration))..repeat(); + _controller = (widget.controller ?? + AnimationController(vsync: this, duration: widget.duration)) + ..repeat(); } @override @@ -70,10 +76,17 @@ class _SpinKitPulsingGridState extends State with SingleTick alignment: Alignment.center, child: ScaleTransition( scale: CurvedAnimation( - parent: DelayTween(begin: 0.0, end: 1.0, delay: delay).animate(_controller), + parent: DelayTween( + begin: 0.0, + end: 1.0, + delay: delay, + ).animate(_controller), curve: Curves.easeOut, ), - child: SizedBox.fromSize(size: Size.square(widget.size / 4), child: _itemBuilder(i)), + child: SizedBox.fromSize( + size: Size.square(widget.size / 4), + child: _itemBuilder(i), + ), ), ), ); @@ -85,5 +98,10 @@ class _SpinKitPulsingGridState extends State with SingleTick Widget _itemBuilder(int index) => widget.itemBuilder != null ? widget.itemBuilder!(context, index) - : DecoratedBox(decoration: BoxDecoration(color: widget.color, shape: widget.boxShape ?? BoxShape.circle)); + : DecoratedBox( + decoration: BoxDecoration( + color: widget.color, + shape: widget.boxShape ?? BoxShape.circle, + ), + ); } diff --git a/lib/src/pumping_heart.dart b/lib/src/pumping_heart.dart index 6522f73..e3fad8f 100644 --- a/lib/src/pumping_heart.dart +++ b/lib/src/pumping_heart.dart @@ -11,8 +11,11 @@ class SpinKitPumpingHeart extends StatefulWidget { this.itemBuilder, this.duration = const Duration(milliseconds: 2400), this.controller, - }) : assert(!(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), - 'You should specify either a itemBuilder or a color'), + }) : assert( + !(itemBuilder is IndexedWidgetBuilder && color is Color) && + !(itemBuilder == null && color == null), + 'You should specify either a itemBuilder or a color', + ), super(key: key); final Color? color; @@ -25,7 +28,8 @@ class SpinKitPumpingHeart extends StatefulWidget { State createState() => _SpinKitPumpingHeartState(); } -class _SpinKitPumpingHeartState extends State with SingleTickerProviderStateMixin { +class _SpinKitPumpingHeartState extends State + with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _animation; @@ -33,9 +37,15 @@ class _SpinKitPumpingHeartState extends State with SingleTi void initState() { super.initState(); - _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration))..repeat(); - _animation = Tween(begin: 1.0, end: 1.25) - .animate(CurvedAnimation(parent: _controller, curve: const Interval(0.0, 1.0, curve: SpinKitPumpCurve()))); + _controller = (widget.controller ?? + AnimationController(vsync: this, duration: widget.duration)) + ..repeat(); + _animation = Tween(begin: 1.0, end: 1.25).animate( + CurvedAnimation( + parent: _controller, + curve: const Interval(0.0, 1.0, curve: SpinKitPumpCurve()), + ), + ); } @override diff --git a/lib/src/ring.dart b/lib/src/ring.dart index 0468289..a682df7 100644 --- a/lib/src/ring.dart +++ b/lib/src/ring.dart @@ -22,7 +22,8 @@ class SpinKitRing extends StatefulWidget { State createState() => _SpinKitRingState(); } -class _SpinKitRingState extends State with SingleTickerProviderStateMixin { +class _SpinKitRingState extends State + with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _animation1; late Animation _animation2; @@ -32,19 +33,32 @@ class _SpinKitRingState extends State with SingleTickerProviderStat void initState() { super.initState(); - _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) + _controller = (widget.controller ?? + AnimationController(vsync: this, duration: widget.duration)) ..addListener(() { if (mounted) { setState(() {}); } }) ..repeat(); - _animation1 = Tween(begin: 0.0, end: 1.0) - .animate(CurvedAnimation(parent: _controller, curve: const Interval(0.0, 1.0, curve: Curves.linear))); - _animation2 = Tween(begin: -2 / 3, end: 1 / 2) - .animate(CurvedAnimation(parent: _controller, curve: const Interval(0.5, 1.0, curve: Curves.linear))); - _animation3 = Tween(begin: 0.25, end: 5 / 6) - .animate(CurvedAnimation(parent: _controller, curve: const Interval(0.0, 1.0, curve: SpinKitRingCurve()))); + _animation1 = Tween(begin: 0.0, end: 1.0).animate( + CurvedAnimation( + parent: _controller, + curve: const Interval(0.0, 1.0, curve: Curves.linear), + ), + ); + _animation2 = Tween(begin: -2 / 3, end: 1 / 2).animate( + CurvedAnimation( + parent: _controller, + curve: const Interval(0.5, 1.0, curve: Curves.linear), + ), + ); + _animation3 = Tween(begin: 0.25, end: 5 / 6).animate( + CurvedAnimation( + parent: _controller, + curve: const Interval(0.0, 1.0, curve: SpinKitRingCurve()), + ), + ); } @override @@ -59,7 +73,8 @@ class _SpinKitRingState extends State with SingleTickerProviderStat Widget build(BuildContext context) { return Center( child: Transform( - transform: Matrix4.identity()..rotateZ((_animation1.value) * 5 * pi / 6), + transform: Matrix4.identity() + ..rotateZ((_animation1.value) * 5 * pi / 6), alignment: FractionalOffset.center, child: SizedBox.fromSize( size: Size.square(widget.size), diff --git a/lib/src/ripple.dart b/lib/src/ripple.dart index c7ec0bd..d78b076 100644 --- a/lib/src/ripple.dart +++ b/lib/src/ripple.dart @@ -9,8 +9,11 @@ class SpinKitRipple extends StatefulWidget { this.itemBuilder, this.duration = const Duration(milliseconds: 1800), this.controller, - }) : assert(!(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), - 'You should specify either a itemBuilder or a color'), + }) : assert( + !(itemBuilder is IndexedWidgetBuilder && color is Color) && + !(itemBuilder == null && color == null), + 'You should specify either a itemBuilder or a color', + ), super(key: key); final Color? color; @@ -24,7 +27,8 @@ class SpinKitRipple extends StatefulWidget { State createState() => _SpinKitRippleState(); } -class _SpinKitRippleState extends State with SingleTickerProviderStateMixin { +class _SpinKitRippleState extends State + with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _animation1; late Animation _animation2; @@ -33,17 +37,26 @@ class _SpinKitRippleState extends State with SingleTickerProvider void initState() { super.initState(); - _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) + _controller = (widget.controller ?? + AnimationController(vsync: this, duration: widget.duration)) ..addListener(() { if (mounted) { setState(() {}); } }) ..repeat(); - _animation1 = Tween(begin: 0.0, end: 1.0) - .animate(CurvedAnimation(parent: _controller, curve: const Interval(0.0, 0.75, curve: Curves.linear))); - _animation2 = Tween(begin: 0.0, end: 1.0) - .animate(CurvedAnimation(parent: _controller, curve: const Interval(0.25, 1.0, curve: Curves.linear))); + _animation1 = Tween(begin: 0.0, end: 1.0).animate( + CurvedAnimation( + parent: _controller, + curve: const Interval(0.0, 0.75, curve: Curves.linear), + ), + ); + _animation2 = Tween(begin: 0.0, end: 1.0).animate( + CurvedAnimation( + parent: _controller, + curve: const Interval(0.25, 1.0, curve: Curves.linear), + ), + ); } @override @@ -61,11 +74,17 @@ class _SpinKitRippleState extends State with SingleTickerProvider children: [ Opacity( opacity: 1.0 - _animation1.value, - child: Transform.scale(scale: _animation1.value, child: _itemBuilder(0)), + child: Transform.scale( + scale: _animation1.value, + child: _itemBuilder(0), + ), ), Opacity( opacity: 1.0 - _animation2.value, - child: Transform.scale(scale: _animation2.value, child: _itemBuilder(1)), + child: Transform.scale( + scale: _animation2.value, + child: _itemBuilder(1), + ), ), ], ), @@ -80,7 +99,10 @@ class _SpinKitRippleState extends State with SingleTickerProvider : DecoratedBox( decoration: BoxDecoration( shape: BoxShape.circle, - border: Border.all(color: widget.color!, width: widget.borderWidth), + border: Border.all( + color: widget.color!, + width: widget.borderWidth, + ), ), ), ); diff --git a/lib/src/rotating_circle.dart b/lib/src/rotating_circle.dart index 3bfb36d..4b808eb 100644 --- a/lib/src/rotating_circle.dart +++ b/lib/src/rotating_circle.dart @@ -8,8 +8,11 @@ class SpinKitRotatingCircle extends StatefulWidget { this.itemBuilder, this.duration = const Duration(milliseconds: 1200), this.controller, - }) : assert(!(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), - 'You should specify either a itemBuilder or a color'), + }) : assert( + !(itemBuilder is IndexedWidgetBuilder && color is Color) && + !(itemBuilder == null && color == null), + 'You should specify either a itemBuilder or a color', + ), super(key: key); final Color? color; @@ -22,7 +25,8 @@ class SpinKitRotatingCircle extends StatefulWidget { State createState() => _SpinKitRotatingCircleState(); } -class _SpinKitRotatingCircleState extends State with SingleTickerProviderStateMixin { +class _SpinKitRotatingCircleState extends State + with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _animation1; late Animation _animation2; @@ -31,17 +35,26 @@ class _SpinKitRotatingCircleState extends State with Sing void initState() { super.initState(); - _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) + _controller = (widget.controller ?? + AnimationController(vsync: this, duration: widget.duration)) ..addListener(() { if (mounted) { setState(() {}); } }) ..repeat(); - _animation1 = Tween(begin: 0.0, end: 180.0) - .animate(CurvedAnimation(parent: _controller, curve: const Interval(0.0, 0.5, curve: Curves.easeIn))); - _animation2 = Tween(begin: 0.0, end: 180.0) - .animate(CurvedAnimation(parent: _controller, curve: const Interval(0.5, 1.0, curve: Curves.easeOut))); + _animation1 = Tween(begin: 0.0, end: 180.0).animate( + CurvedAnimation( + parent: _controller, + curve: const Interval(0.0, 0.5, curve: Curves.easeIn), + ), + ); + _animation2 = Tween(begin: 0.0, end: 180.0).animate( + CurvedAnimation( + parent: _controller, + curve: const Interval(0.5, 1.0, curve: Curves.easeOut), + ), + ); } @override @@ -60,12 +73,20 @@ class _SpinKitRotatingCircleState extends State with Sing ..rotateX((0 - _animation1.value) * 0.0174533) ..rotateY((0 - _animation2.value) * 0.0174533), alignment: FractionalOffset.center, - child: SizedBox.fromSize(size: Size.square(widget.size), child: _itemBuilder(0)), + child: SizedBox.fromSize( + size: Size.square(widget.size), + child: _itemBuilder(0), + ), ), ); } Widget _itemBuilder(int index) => widget.itemBuilder != null ? widget.itemBuilder!(context, index) - : DecoratedBox(decoration: BoxDecoration(color: widget.color, shape: BoxShape.circle)); + : DecoratedBox( + decoration: BoxDecoration( + color: widget.color, + shape: BoxShape.circle, + ), + ); } diff --git a/lib/src/rotating_plain.dart b/lib/src/rotating_plain.dart index 61efe8a..626cd96 100644 --- a/lib/src/rotating_plain.dart +++ b/lib/src/rotating_plain.dart @@ -8,8 +8,11 @@ class SpinKitRotatingPlain extends StatefulWidget { this.itemBuilder, this.duration = const Duration(milliseconds: 1200), this.controller, - }) : assert(!(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), - 'You should specify either a itemBuilder or a color'), + }) : assert( + !(itemBuilder is IndexedWidgetBuilder && color is Color) && + !(itemBuilder == null && color == null), + 'You should specify either a itemBuilder or a color', + ), super(key: key); final Color? color; @@ -22,7 +25,8 @@ class SpinKitRotatingPlain extends StatefulWidget { State createState() => _SpinKitRotatingPlainState(); } -class _SpinKitRotatingPlainState extends State with SingleTickerProviderStateMixin { +class _SpinKitRotatingPlainState extends State + with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _animation1; late Animation _animation2; @@ -31,17 +35,26 @@ class _SpinKitRotatingPlainState extends State with Single void initState() { super.initState(); - _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) + _controller = (widget.controller ?? + AnimationController(vsync: this, duration: widget.duration)) ..addListener(() { if (mounted) { setState(() {}); } }) ..repeat(); - _animation1 = Tween(begin: 0.0, end: 180.0) - .animate(CurvedAnimation(parent: _controller, curve: const Interval(0.0, 0.5, curve: Curves.easeIn))); - _animation2 = Tween(begin: 0.0, end: 180.0) - .animate(CurvedAnimation(parent: _controller, curve: const Interval(0.5, 1.0, curve: Curves.easeOut))); + _animation1 = Tween(begin: 0.0, end: 180.0).animate( + CurvedAnimation( + parent: _controller, + curve: const Interval(0.0, 0.5, curve: Curves.easeIn), + ), + ); + _animation2 = Tween(begin: 0.0, end: 180.0).animate( + CurvedAnimation( + parent: _controller, + curve: const Interval(0.5, 1.0, curve: Curves.easeOut), + ), + ); } @override diff --git a/lib/src/spinning_circle.dart b/lib/src/spinning_circle.dart index fac16c4..c61c878 100644 --- a/lib/src/spinning_circle.dart +++ b/lib/src/spinning_circle.dart @@ -11,8 +11,11 @@ class SpinKitSpinningCircle extends StatefulWidget { this.itemBuilder, this.duration = const Duration(milliseconds: 1200), this.controller, - }) : assert(!(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), - 'You should specify either a itemBuilder or a color'), + }) : assert( + !(itemBuilder is IndexedWidgetBuilder && color is Color) && + !(itemBuilder == null && color == null), + 'You should specify either a itemBuilder or a color', + ), super(key: key); final Color? color; @@ -26,7 +29,8 @@ class SpinKitSpinningCircle extends StatefulWidget { State createState() => _SpinKitSpinningCircleState(); } -class _SpinKitSpinningCircleState extends State with SingleTickerProviderStateMixin { +class _SpinKitSpinningCircleState extends State + with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _animation; @@ -34,15 +38,20 @@ class _SpinKitSpinningCircleState extends State with Sing void initState() { super.initState(); - _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) + _controller = (widget.controller ?? + AnimationController(vsync: this, duration: widget.duration)) ..addListener(() { if (mounted) { setState(() {}); } }) ..repeat(); - _animation = Tween(begin: 0.0, end: 7.0) - .animate(CurvedAnimation(parent: _controller, curve: const Interval(0.0, 1.0, curve: Curves.easeOut))); + _animation = Tween(begin: 0.0, end: 7.0).animate( + CurvedAnimation( + parent: _controller, + curve: const Interval(0.0, 1.0, curve: Curves.easeOut), + ), + ); } @override @@ -69,5 +78,7 @@ class _SpinKitSpinningCircleState extends State with Sing Widget _itemBuilder(int index) => widget.itemBuilder != null ? widget.itemBuilder!(context, index) - : DecoratedBox(decoration: BoxDecoration(color: widget.color, shape: widget.shape)); + : DecoratedBox( + decoration: BoxDecoration(color: widget.color, shape: widget.shape), + ); } diff --git a/lib/src/spinning_lines.dart b/lib/src/spinning_lines.dart index 770d74a..2adc7e3 100644 --- a/lib/src/spinning_lines.dart +++ b/lib/src/spinning_lines.dart @@ -27,7 +27,8 @@ class SpinKitSpinningLines extends StatefulWidget { State createState() => _SpinKitSpinningLinesState(); } -class _SpinKitSpinningLinesState extends State with SingleTickerProviderStateMixin { +class _SpinKitSpinningLinesState extends State + with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _animation; @@ -35,7 +36,8 @@ class _SpinKitSpinningLinesState extends State with Single void initState() { super.initState(); - _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) + _controller = (widget.controller ?? + AnimationController(vsync: this, duration: widget.duration)) ..addListener(() { if (mounted) { setState(() {}); @@ -147,7 +149,8 @@ class SpinningLinesPainter extends CustomPainter { /// I use the following resource to calculate rotation of the canvas /// https://stackoverflow.com/a/54336099/9689717 void _rotateCanvas(Canvas canvas, Size size, double angle) { - final double r = sqrt(size.width * size.width + size.height * size.height) / 2; + final double r = + sqrt(size.width * size.width + size.height * size.height) / 2; final alpha = atan(size.height / size.width); final beta = alpha + angle; final shiftY = r * sin(beta); @@ -161,9 +164,10 @@ class SpinningLinesPainter extends CustomPainter { double _getRadian(double angle) => math.pi / 180 * angle; @override - bool shouldRepaint(SpinningLinesPainter oldDelegate) => - oldDelegate.rotateValue != rotateValue || - oldDelegate.lineWidth != lineWidth || - oldDelegate.itemCount != itemCount || - oldDelegate._linePaint != _linePaint; + bool shouldRepaint(SpinningLinesPainter oldDelegate) { + return oldDelegate.rotateValue != rotateValue || + oldDelegate.lineWidth != lineWidth || + oldDelegate.itemCount != itemCount || + oldDelegate._linePaint != _linePaint; + } } diff --git a/lib/src/square_circle.dart b/lib/src/square_circle.dart index 9a01bd4..eeae87c 100644 --- a/lib/src/square_circle.dart +++ b/lib/src/square_circle.dart @@ -10,8 +10,11 @@ class SpinKitSquareCircle extends StatefulWidget { this.itemBuilder, this.duration = const Duration(milliseconds: 500), this.controller, - }) : assert(!(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), - 'You should specify either a itemBuilder or a color'), + }) : assert( + !(itemBuilder is IndexedWidgetBuilder && color is Color) && + !(itemBuilder == null && color == null), + 'You should specify either a itemBuilder or a color', + ), super(key: key); final Color? color; @@ -24,7 +27,8 @@ class SpinKitSquareCircle extends StatefulWidget { State createState() => _SpinKitSquareCircleState(); } -class _SpinKitSquareCircleState extends State with SingleTickerProviderStateMixin { +class _SpinKitSquareCircleState extends State + with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _animationCurve; late Animation _animationSize; @@ -33,14 +37,18 @@ class _SpinKitSquareCircleState extends State with SingleTi void initState() { super.initState(); - _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) + _controller = (widget.controller ?? + AnimationController(vsync: this, duration: widget.duration)) ..addListener(() { if (mounted) { setState(() {}); } }) ..repeat(reverse: true); - final animation = CurvedAnimation(parent: _controller, curve: Curves.easeInOutCubic); + final animation = CurvedAnimation( + parent: _controller, + curve: Curves.easeInOutCubic, + ); _animationCurve = Tween(begin: 1.0, end: 0.0).animate(animation); _animationSize = Tween(begin: 0.5, end: 1.0).animate(animation); } @@ -68,12 +76,14 @@ class _SpinKitSquareCircleState extends State with SingleTi ); } - Widget _itemBuilder(int index, double curveValue) => widget.itemBuilder != null - ? widget.itemBuilder!(context, index) - : DecoratedBox( - decoration: BoxDecoration( - color: widget.color, - borderRadius: BorderRadius.all(Radius.circular(curveValue)), - ), - ); + Widget _itemBuilder(int index, double curveValue) { + return widget.itemBuilder != null + ? widget.itemBuilder!(context, index) + : DecoratedBox( + decoration: BoxDecoration( + color: widget.color, + borderRadius: BorderRadius.all(Radius.circular(curveValue)), + ), + ); + } } diff --git a/lib/src/three_bounce.dart b/lib/src/three_bounce.dart index fb3976d..c110808 100644 --- a/lib/src/three_bounce.dart +++ b/lib/src/three_bounce.dart @@ -9,8 +9,11 @@ class SpinKitThreeBounce extends StatefulWidget { this.itemBuilder, this.duration = const Duration(milliseconds: 1400), this.controller, - }) : assert(!(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), - 'You should specify either a itemBuilder or a color'), + }) : assert( + !(itemBuilder is IndexedWidgetBuilder && color is Color) && + !(itemBuilder == null && color == null), + 'You should specify either a itemBuilder or a color', + ), super(key: key); final Color? color; @@ -23,14 +26,17 @@ class SpinKitThreeBounce extends StatefulWidget { State createState() => _SpinKitThreeBounceState(); } -class _SpinKitThreeBounceState extends State with SingleTickerProviderStateMixin { +class _SpinKitThreeBounceState extends State + with SingleTickerProviderStateMixin { late AnimationController _controller; @override void initState() { super.initState(); - _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration))..repeat(); + _controller = (widget.controller ?? + AnimationController(vsync: this, duration: widget.duration)) + ..repeat(); } @override @@ -50,8 +56,15 @@ class _SpinKitThreeBounceState extends State with SingleTick mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: List.generate(3, (i) { return ScaleTransition( - scale: DelayTween(begin: 0.0, end: 1.0, delay: i * .2).animate(_controller), - child: SizedBox.fromSize(size: Size.square(widget.size * 0.5), child: _itemBuilder(i)), + scale: DelayTween( + begin: 0.0, + end: 1.0, + delay: i * .2, + ).animate(_controller), + child: SizedBox.fromSize( + size: Size.square(widget.size * 0.5), + child: _itemBuilder(i), + ), ); }), ), @@ -61,5 +74,10 @@ class _SpinKitThreeBounceState extends State with SingleTick Widget _itemBuilder(int index) => widget.itemBuilder != null ? widget.itemBuilder!(context, index) - : DecoratedBox(decoration: BoxDecoration(color: widget.color, shape: BoxShape.circle)); + : DecoratedBox( + decoration: BoxDecoration( + color: widget.color, + shape: BoxShape.circle, + ), + ); } diff --git a/lib/src/three_in_out.dart b/lib/src/three_in_out.dart index d4fef10..e4ea5e2 100644 --- a/lib/src/three_in_out.dart +++ b/lib/src/three_in_out.dart @@ -12,8 +12,11 @@ class SpinKitThreeInOut extends StatefulWidget { this.duration = const Duration(milliseconds: 500), this.delay = const Duration(milliseconds: 50), this.controller, - }) : assert(!(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), - 'You should specify either a itemBuilder or a color'), + }) : assert( + !(itemBuilder is IndexedWidgetBuilder && color is Color) && + !(itemBuilder == null && color == null), + 'You should specify either a itemBuilder or a color', + ), super(key: key); final Color? color; @@ -27,7 +30,8 @@ class SpinKitThreeInOut extends StatefulWidget { State createState() => _SpinKitThreeInOutState(); } -class _SpinKitThreeInOutState extends State with SingleTickerProviderStateMixin { +class _SpinKitThreeInOutState extends State + with SingleTickerProviderStateMixin { late AnimationController? _controller; late List _widgets; @@ -49,7 +53,8 @@ class _SpinKitThreeInOutState extends State with SingleTicker ), ); - _controller = widget.controller ?? AnimationController(vsync: this, duration: widget.duration); + _controller = widget.controller ?? + AnimationController(vsync: this, duration: widget.duration); _controller!.forward(); @@ -63,7 +68,10 @@ class _SpinKitThreeInOutState extends State with SingleTicker _lastAnim = _controller!.value; if (_controller!.isCompleted) { - _forwardTimer = Timer(widget.delay, () => _controller?.forward(from: 0)); + _forwardTimer = Timer( + widget.delay, + () => _controller?.forward(from: 0), + ); } }); } @@ -114,20 +122,26 @@ class _SpinKitThreeInOutState extends State with SingleTicker AnimatedBuilder _wrapInAnimatedBuilder( Widget innerWidget, { bool inverse = false, - }) => - AnimatedBuilder( - animation: _controller!, - child: innerWidget, - builder: (context, inn) { - final value = inverse ? 1 - _controller!.value : _controller!.value; - return SizedBox.fromSize( - size: Size.square(widget.size * 0.5 * value), - child: Opacity(opacity: value, child: inn), - ); - }, - ); + }) { + return AnimatedBuilder( + animation: _controller!, + child: innerWidget, + builder: (context, inn) { + final value = inverse ? 1 - _controller!.value : _controller!.value; + return SizedBox.fromSize( + size: Size.square(widget.size * 0.5 * value), + child: Opacity(opacity: value, child: inn), + ); + }, + ); + } Widget _itemBuilder(int index) => widget.itemBuilder != null ? widget.itemBuilder!(context, index) - : DecoratedBox(decoration: BoxDecoration(color: widget.color, shape: BoxShape.circle)); + : DecoratedBox( + decoration: BoxDecoration( + color: widget.color, + shape: BoxShape.circle, + ), + ); } diff --git a/lib/src/tweens/delay_tween.dart b/lib/src/tweens/delay_tween.dart index 9b32c11..4ef6ea9 100644 --- a/lib/src/tweens/delay_tween.dart +++ b/lib/src/tweens/delay_tween.dart @@ -3,12 +3,18 @@ import 'dart:math' as math show sin, pi; import 'package:flutter/animation.dart'; class DelayTween extends Tween { - DelayTween({double? begin, double? end, required this.delay}) : super(begin: begin, end: end); + DelayTween({ + double? begin, + double? end, + required this.delay, + }) : super(begin: begin, end: end); final double delay; @override - double lerp(double t) => super.lerp((math.sin((t - delay) * 2 * math.pi) + 1) / 2); + double lerp(double t) { + return super.lerp((math.sin((t - delay) * 2 * math.pi) + 1) / 2); + } @override double evaluate(Animation animation) => lerp(animation.value); diff --git a/lib/src/wandering_cubes.dart b/lib/src/wandering_cubes.dart index bc33992..9e833c7 100644 --- a/lib/src/wandering_cubes.dart +++ b/lib/src/wandering_cubes.dart @@ -8,8 +8,11 @@ class SpinKitWanderingCubes extends StatefulWidget { this.size = 50.0, this.itemBuilder, this.duration = const Duration(milliseconds: 1800), - }) : assert(!(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), - 'You should specify either a itemBuilder or a color'), + }) : assert( + !(itemBuilder is IndexedWidgetBuilder && color is Color) && + !(itemBuilder == null && color == null), + 'You should specify either a itemBuilder or a color', + ), offset = size * 0.75, super(key: key); @@ -24,7 +27,8 @@ class SpinKitWanderingCubes extends StatefulWidget { State createState() => _SpinKitWanderingCubesState(); } -class _SpinKitWanderingCubesState extends State with SingleTickerProviderStateMixin { +class _SpinKitWanderingCubesState extends State + with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _scale1; late Animation _scale2; @@ -48,23 +52,37 @@ class _SpinKitWanderingCubesState extends State with Sing }) ..repeat(); - final animation1 = CurvedAnimation(parent: _controller, curve: const Interval(0.0, 0.25, curve: Curves.easeInOut)); + final animation1 = CurvedAnimation( + parent: _controller, + curve: const Interval(0.0, 0.25, curve: Curves.easeInOut), + ); _translate1 = Tween(begin: 0.0, end: widget.offset).animate(animation1); _scale1 = Tween(begin: 1.0, end: 0.5).animate(animation1); - final animation2 = CurvedAnimation(parent: _controller, curve: const Interval(0.25, 0.5, curve: Curves.easeInOut)); + final animation2 = CurvedAnimation( + parent: _controller, + curve: const Interval(0.25, 0.5, curve: Curves.easeInOut), + ); _translate2 = Tween(begin: 0.0, end: widget.offset).animate(animation2); _scale2 = Tween(begin: 1.0, end: 2.0).animate(animation2); - final animation3 = CurvedAnimation(parent: _controller, curve: const Interval(0.5, 0.75, curve: Curves.easeInOut)); + final animation3 = CurvedAnimation( + parent: _controller, + curve: const Interval(0.5, 0.75, curve: Curves.easeInOut), + ); _translate3 = Tween(begin: 0.0, end: -widget.offset).animate(animation3); _scale3 = Tween(begin: 1.0, end: 0.5).animate(animation3); - final animation4 = CurvedAnimation(parent: _controller, curve: const Interval(0.75, 1.0, curve: Curves.easeInOut)); + final animation4 = CurvedAnimation( + parent: _controller, + curve: const Interval(0.75, 1.0, curve: Curves.easeInOut), + ); _translate4 = Tween(begin: 0.0, end: -widget.offset).animate(animation4); _scale4 = Tween(begin: 1.0, end: 2.0).animate(animation4); - _rotate = Tween(begin: 0.0, end: 360.0).animate(CurvedAnimation(parent: _controller, curve: Curves.linear)); + _rotate = Tween(begin: 0.0, end: 360.0).animate( + CurvedAnimation(parent: _controller, curve: Curves.linear), + ); } @override @@ -129,5 +147,7 @@ class _SpinKitWanderingCubesState extends State with Sing Widget _itemBuilder(int index) => widget.itemBuilder != null ? widget.itemBuilder!(context, index) - : DecoratedBox(decoration: BoxDecoration(color: widget.color, shape: widget.shape)); + : DecoratedBox( + decoration: BoxDecoration(color: widget.color, shape: widget.shape), + ); } diff --git a/lib/src/wave.dart b/lib/src/wave.dart index 80e109f..07923f9 100644 --- a/lib/src/wave.dart +++ b/lib/src/wave.dart @@ -13,8 +13,11 @@ class SpinKitWave extends StatefulWidget { this.itemCount = 5, this.duration = const Duration(milliseconds: 1200), this.controller, - }) : assert(!(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), - 'You should specify either a itemBuilder or a color'), + }) : assert( + !(itemBuilder is IndexedWidgetBuilder && color is Color) && + !(itemBuilder == null && color == null), + 'You should specify either a itemBuilder or a color', + ), assert(itemCount >= 2, 'itemCount Cant be less then 2 '), super(key: key); @@ -30,14 +33,17 @@ class SpinKitWave extends StatefulWidget { State createState() => _SpinKitWaveState(); } -class _SpinKitWaveState extends State with SingleTickerProviderStateMixin { +class _SpinKitWaveState extends State + with SingleTickerProviderStateMixin { late AnimationController _controller; @override void initState() { super.initState(); - _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration))..repeat(); + _controller = (widget.controller ?? + AnimationController(vsync: this, duration: widget.duration)) + ..repeat(); } @override @@ -58,8 +64,15 @@ class _SpinKitWaveState extends State with SingleTickerProviderStat mainAxisAlignment: MainAxisAlignment.spaceBetween, children: List.generate(bars.length, (i) { return ScaleYWidget( - scaleY: DelayTween(begin: .4, end: 1.0, delay: bars[i]).animate(_controller), - child: SizedBox.fromSize(size: Size(widget.size / widget.itemCount, widget.size), child: _itemBuilder(i)), + scaleY: DelayTween( + begin: .4, + end: 1.0, + delay: bars[i], + ).animate(_controller), + child: SizedBox.fromSize( + size: Size(widget.size / widget.itemCount, widget.size), + child: _itemBuilder(i), + ), ); }), ), @@ -81,7 +94,10 @@ class _SpinKitWaveState extends State with SingleTickerProviderStat List _startAnimationDelay(int count) { return [ - ...List.generate(count ~/ 2, (index) => -1.0 - (index * 0.1) - 0.1).reversed, + ...List.generate( + count ~/ 2, + (index) => -1.0 - (index * 0.1) - 0.1, + ).reversed, if (count.isOdd) -1.0, ...List.generate( count ~/ 2, @@ -92,7 +108,10 @@ class _SpinKitWaveState extends State with SingleTickerProviderStat List _endAnimationDelay(int count) { return [ - ...List.generate(count ~/ 2, (index) => -1.0 + (index * 0.1) + 0.1).reversed, + ...List.generate( + count ~/ 2, + (index) => -1.0 + (index * 0.1) + 0.1, + ).reversed, if (count.isOdd) -1.0, ...List.generate( count ~/ 2, @@ -103,9 +122,15 @@ class _SpinKitWaveState extends State with SingleTickerProviderStat List _centerAnimationDelay(int count) { return [ - ...List.generate(count ~/ 2, (index) => -1.0 + (index * 0.2) + 0.2).reversed, + ...List.generate( + count ~/ 2, + (index) => -1.0 + (index * 0.2) + 0.2, + ).reversed, if (count.isOdd) -1.0, - ...List.generate(count ~/ 2, (index) => -1.0 + (index * 0.2) + 0.2), + ...List.generate( + count ~/ 2, + (index) => -1.0 + (index * 0.2) + 0.2, + ), ]; } @@ -129,6 +154,10 @@ class ScaleYWidget extends AnimatedWidget { @override Widget build(BuildContext context) { - return Transform(transform: Matrix4.identity()..scale(1.0, scale.value, 1.0), alignment: alignment, child: child); + return Transform( + transform: Matrix4.identity()..scale(1.0, scale.value, 1.0), + alignment: alignment, + child: child, + ); } } diff --git a/lib/src/wave_spinner.dart b/lib/src/wave_spinner.dart index 0de2968..1bd5f4e 100644 --- a/lib/src/wave_spinner.dart +++ b/lib/src/wave_spinner.dart @@ -28,14 +28,17 @@ class SpinKitWaveSpinner extends StatefulWidget { State createState() => _SpinKitWaveSpinnerState(); } -class _SpinKitWaveSpinnerState extends State with SingleTickerProviderStateMixin { +class _SpinKitWaveSpinnerState extends State + with SingleTickerProviderStateMixin { late final AnimationController _controller; @override void initState() { super.initState(); - _controller = (widget.controller ?? AnimationController(duration: widget.duration, vsync: this))..repeat(); + _controller = (widget.controller ?? + AnimationController(duration: widget.duration, vsync: this)) + ..repeat(); } @override @@ -48,32 +51,44 @@ class _SpinKitWaveSpinnerState extends State with SingleTick @override Widget build(BuildContext context) { - return LayoutBuilder(builder: (context, constraints) { - final size = Size.square(math.min(math.min(constraints.maxWidth, constraints.maxHeight), widget.size)); - final childMaxSize = Size.square(widget.size * 0.7); - return SizedBox.fromSize( - size: size, - child: Stack( - alignment: Alignment.center, - children: [ - CustomPaint( - size: size, - painter: SpinkitWaveCustomPaint( + return LayoutBuilder( + builder: (context, constraints) { + final size = Size.square( + math.min( + math.min(constraints.maxWidth, constraints.maxHeight), + widget.size, + ), + ); + final childMaxSize = Size.square(widget.size * 0.7); + return SizedBox.fromSize( + size: size, + child: Stack( + alignment: Alignment.center, + children: [ + CustomPaint( size: size, - color: widget.color, - trackColor: widget.trackColor, - waveColor: widget.waveColor, - curve: widget.curve, - hasChild: widget.child != null, - controller: _controller, + painter: SpinkitWaveCustomPaint( + size: size, + color: widget.color, + trackColor: widget.trackColor, + waveColor: widget.waveColor, + curve: widget.curve, + hasChild: widget.child != null, + controller: _controller, + ), ), - ), - if (widget.child != null) - Center(child: ConstrainedBox(constraints: BoxConstraints.tight(childMaxSize), child: widget.child)) - ], - ), - ); - }); + if (widget.child != null) + Center( + child: ConstrainedBox( + constraints: BoxConstraints.tight(childMaxSize), + child: widget.child, + ), + ) + ], + ), + ); + }, + ); } } @@ -88,12 +103,20 @@ class SpinkitWaveCustomPaint extends CustomPainter { required Size size, }) : super(repaint: controller) { _waveMaxRadius = _lineRadius(size.width, 10); - _spinnerAnimation = - Tween(begin: 0, end: math.pi * 2).animate(CurvedAnimation(curve: curve, parent: controller)); - _waveVerticalShiftAnimation = Tween(begin: _waveMaxRadius, end: -_waveMaxRadius) - .animate(CurvedAnimation(curve: curve, parent: controller)); - _waveAmplitudeAnimation = - !hasChild ? Tween(begin: 0, end: -4).animate(CurvedAnimation(curve: curve, parent: controller)) : null; + _spinnerAnimation = Tween(begin: 0, end: math.pi * 2).animate( + CurvedAnimation(curve: curve, parent: controller), + ); + _waveVerticalShiftAnimation = Tween( + begin: _waveMaxRadius, + end: -_waveMaxRadius, + ).animate( + CurvedAnimation(curve: curve, parent: controller), + ); + _waveAmplitudeAnimation = !hasChild + ? Tween(begin: 0, end: -4).animate( + CurvedAnimation(curve: curve, parent: controller), + ) + : null; } final Color color; @@ -145,7 +168,11 @@ class SpinkitWaveCustomPaint extends CustomPainter { final lineRadius = _lineRadius(size.width, lineRadiusMultiplier) * 2; final centerOffset = Offset(size.width / 2, size.width / 2); canvas.drawArc( - Rect.fromCenter(center: centerOffset, width: lineRadius, height: lineRadius), + Rect.fromCenter( + center: centerOffset, + width: lineRadius, + height: lineRadius, + ), startAngle, sweepAngle, false, @@ -163,7 +190,9 @@ class SpinkitWaveCustomPaint extends CustomPainter { height: Size.fromRadius(_waveMaxRadius).width, ); canvas.save(); - canvas.clipRRect(RRect.fromRectAndRadius(bounds, Radius.circular(_waveMaxRadius))); + canvas.clipRRect( + RRect.fromRectAndRadius(bounds, Radius.circular(_waveMaxRadius)), + ); canvas.translate(size.width / 2, size.height / 2); final path = Path()..moveTo(-_waveMaxRadius, _waveMaxRadius); @@ -185,7 +214,9 @@ class SpinkitWaveCustomPaint extends CustomPainter { canvas.restore(); } - double _lineRadius(double width, double multiplier) => (width - (multiplier * math.max(2.5, width * 0.015))) / 2; + double _lineRadius(double width, double multiplier) { + return (width - (multiplier * math.max(2.5, width * 0.015))) / 2; + } @override bool shouldRepaint(covariant CustomPainter oldDelegate) => true; diff --git a/test/chasing_dots_test.dart b/test/chasing_dots_test.dart index bf0b818..046067c 100644 --- a/test/chasing_dots_test.dart +++ b/test/chasing_dots_test.dart @@ -6,35 +6,58 @@ import 'helpers.dart'; void main() { group('ChasingDots', () { - testWidgets('needs either color or itemBuilder', (WidgetTester tester) async { - expect(() => SpinKitChasingDots(), throwsAssertionError); - expect(() => SpinKitChasingDots(color: Colors.white, itemBuilder: fakeBoxBuilder), throwsAssertionError); - }); + testWidgets( + 'needs either color or itemBuilder', + (WidgetTester tester) async { + expect(() => SpinKitChasingDots(), throwsAssertionError); + expect( + () => SpinKitChasingDots( + color: Colors.white, + itemBuilder: fakeBoxBuilder, + ), + throwsAssertionError, + ); + }, + ); testWidgets('needs color to be non-null', (WidgetTester tester) async { expect(() => SpinKitChasingDots(color: null), throwsAssertionError); }); - testWidgets('needs itemBuilder to be non-null', (WidgetTester tester) async { - expect(() => SpinKitChasingDots(itemBuilder: null), throwsAssertionError); - }); + testWidgets( + 'needs itemBuilder to be non-null', + (WidgetTester tester) async { + expect( + () => SpinKitChasingDots(itemBuilder: null), + throwsAssertionError, + ); + }, + ); testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitChasingDots(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp(const SpinKitChasingDots(color: Colors.white)), + ); expect(find.byType(SpinKitChasingDots), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works with itemBuilder', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitChasingDots(itemBuilder: fakeBoxBuilder))); + await tester.pumpWidget( + createMaterialApp( + const SpinKitChasingDots(itemBuilder: fakeBoxBuilder), + ), + ); expect(find.byType(SpinKitChasingDots), findsOneWidget); expect(find.byType(FakeBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitChasingDots(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp(const SpinKitChasingDots(color: Colors.white)), + ); expect(find.byType(SpinKitChasingDots), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); diff --git a/test/circle_test.dart b/test/circle_test.dart index 40b87d3..4386f8c 100644 --- a/test/circle_test.dart +++ b/test/circle_test.dart @@ -6,35 +6,50 @@ import 'helpers.dart'; void main() { group('Circle', () { - testWidgets('needs either color or itemBuilder', (WidgetTester tester) async { - expect(() => SpinKitCircle(), throwsAssertionError); - expect(() => SpinKitCircle(color: Colors.white, itemBuilder: fakeBoxBuilder), throwsAssertionError); - }); + testWidgets( + 'needs either color or itemBuilder', + (WidgetTester tester) async { + expect(() => SpinKitCircle(), throwsAssertionError); + expect( + () => SpinKitCircle(color: Colors.white, itemBuilder: fakeBoxBuilder), + throwsAssertionError, + ); + }, + ); testWidgets('needs color to be non-null', (WidgetTester tester) async { expect(() => SpinKitCircle(color: null), throwsAssertionError); }); - testWidgets('needs itemBuilder to be non-null', (WidgetTester tester) async { - expect(() => SpinKitCircle(itemBuilder: null), throwsAssertionError); - }); + testWidgets( + 'needs itemBuilder to be non-null', + (WidgetTester tester) async { + expect(() => SpinKitCircle(itemBuilder: null), throwsAssertionError); + }, + ); testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitCircle(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp(const SpinKitCircle(color: Colors.white)), + ); expect(find.byType(SpinKitCircle), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works with itemBuilder', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitCircle(itemBuilder: fakeBoxBuilder))); + await tester.pumpWidget( + createMaterialApp(const SpinKitCircle(itemBuilder: fakeBoxBuilder)), + ); expect(find.byType(SpinKitCircle), findsOneWidget); expect(find.byType(FakeBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitCircle(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp(const SpinKitCircle(color: Colors.white)), + ); expect(find.byType(SpinKitCircle), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); diff --git a/test/cube_grid_test.dart b/test/cube_grid_test.dart index 6ec0ec5..3d623cf 100644 --- a/test/cube_grid_test.dart +++ b/test/cube_grid_test.dart @@ -6,35 +6,53 @@ import 'helpers.dart'; void main() { group('CubeGrid', () { - testWidgets('needs either color or itemBuilder', (WidgetTester tester) async { - expect(() => SpinKitCubeGrid(), throwsAssertionError); - expect(() => SpinKitCubeGrid(color: Colors.white, itemBuilder: fakeBoxBuilder), throwsAssertionError); - }); + testWidgets( + 'needs either color or itemBuilder', + (WidgetTester tester) async { + expect(() => SpinKitCubeGrid(), throwsAssertionError); + expect( + () => + SpinKitCubeGrid(color: Colors.white, itemBuilder: fakeBoxBuilder), + throwsAssertionError, + ); + }, + ); testWidgets('needs color to be non-null', (WidgetTester tester) async { expect(() => SpinKitCubeGrid(color: null), throwsAssertionError); }); - testWidgets('needs itemBuilder to be non-null', (WidgetTester tester) async { - expect(() => SpinKitCubeGrid(itemBuilder: null), throwsAssertionError); - }); + testWidgets( + 'needs itemBuilder to be non-null', + (WidgetTester tester) async { + expect(() => SpinKitCubeGrid(itemBuilder: null), throwsAssertionError); + }, + ); testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitCubeGrid(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp(const SpinKitCubeGrid(color: Colors.white)), + ); expect(find.byType(SpinKitCubeGrid), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works with itemBuilder', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitCubeGrid(itemBuilder: fakeBoxBuilder))); + await tester.pumpWidget( + createMaterialApp( + const SpinKitCubeGrid(itemBuilder: fakeBoxBuilder), + ), + ); expect(find.byType(SpinKitCubeGrid), findsOneWidget); expect(find.byType(FakeBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitCubeGrid(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp(const SpinKitCubeGrid(color: Colors.white)), + ); expect(find.byType(SpinKitCubeGrid), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); diff --git a/test/dancing_square_test.dart b/test/dancing_square_test.dart index 63e6159..c6d0096 100644 --- a/test/dancing_square_test.dart +++ b/test/dancing_square_test.dart @@ -6,35 +6,58 @@ import 'helpers.dart'; void main() { group('DancingSquare', () { - testWidgets('needs either color or itemBuilder', (WidgetTester tester) async { - expect(() => SpinKitDancingSquare(), throwsAssertionError); - expect(() => SpinKitDancingSquare(color: Colors.white, itemBuilder: fakeBoxBuilder), throwsAssertionError); - }); + testWidgets( + 'needs either color or itemBuilder', + (WidgetTester tester) async { + expect(() => SpinKitDancingSquare(), throwsAssertionError); + expect( + () => SpinKitDancingSquare( + color: Colors.white, + itemBuilder: fakeBoxBuilder, + ), + throwsAssertionError, + ); + }, + ); testWidgets('needs color to be non-null', (WidgetTester tester) async { expect(() => SpinKitDancingSquare(color: null), throwsAssertionError); }); - testWidgets('needs itemBuilder to be non-null', (WidgetTester tester) async { - expect(() => SpinKitDancingSquare(itemBuilder: null), throwsAssertionError); - }); + testWidgets( + 'needs itemBuilder to be non-null', + (WidgetTester tester) async { + expect( + () => SpinKitDancingSquare(itemBuilder: null), + throwsAssertionError, + ); + }, + ); testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitDancingSquare(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp(const SpinKitDancingSquare(color: Colors.white)), + ); expect(find.byType(SpinKitDancingSquare), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works with itemBuilder', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitDancingSquare(itemBuilder: fakeBoxBuilder))); + await tester.pumpWidget( + createMaterialApp( + const SpinKitDancingSquare(itemBuilder: fakeBoxBuilder), + ), + ); expect(find.byType(SpinKitDancingSquare), findsOneWidget); expect(find.byType(FakeBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitDancingSquare(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp(const SpinKitDancingSquare(color: Colors.white)), + ); expect(find.byType(SpinKitDancingSquare), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); diff --git a/test/double_bounce_test.dart b/test/double_bounce_test.dart index c5d3fe3..951b206 100644 --- a/test/double_bounce_test.dart +++ b/test/double_bounce_test.dart @@ -6,35 +6,58 @@ import 'helpers.dart'; void main() { group('DoubleBounce', () { - testWidgets('needs either color or itemBuilder', (WidgetTester tester) async { - expect(() => SpinKitDoubleBounce(), throwsAssertionError); - expect(() => SpinKitDoubleBounce(color: Colors.white, itemBuilder: fakeBoxBuilder), throwsAssertionError); - }); + testWidgets( + 'needs either color or itemBuilder', + (WidgetTester tester) async { + expect(() => SpinKitDoubleBounce(), throwsAssertionError); + expect( + () => SpinKitDoubleBounce( + color: Colors.white, + itemBuilder: fakeBoxBuilder, + ), + throwsAssertionError, + ); + }, + ); testWidgets('needs color to be non-null', (WidgetTester tester) async { expect(() => SpinKitDoubleBounce(color: null), throwsAssertionError); }); - testWidgets('needs itemBuilder to be non-null', (WidgetTester tester) async { - expect(() => SpinKitDoubleBounce(itemBuilder: null), throwsAssertionError); - }); + testWidgets( + 'needs itemBuilder to be non-null', + (WidgetTester tester) async { + expect( + () => SpinKitDoubleBounce(itemBuilder: null), + throwsAssertionError, + ); + }, + ); testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitDoubleBounce(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp(const SpinKitDoubleBounce(color: Colors.white)), + ); expect(find.byType(SpinKitDoubleBounce), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works with itemBuilder', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitDoubleBounce(itemBuilder: fakeBoxBuilder))); + await tester.pumpWidget( + createMaterialApp( + const SpinKitDoubleBounce(itemBuilder: fakeBoxBuilder), + ), + ); expect(find.byType(SpinKitDoubleBounce), findsOneWidget); expect(find.byType(FakeBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitDoubleBounce(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp(const SpinKitDoubleBounce(color: Colors.white)), + ); expect(find.byType(SpinKitDoubleBounce), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); diff --git a/test/dual_ring_test.dart b/test/dual_ring_test.dart index a4bca5b..927c3a5 100644 --- a/test/dual_ring_test.dart +++ b/test/dual_ring_test.dart @@ -7,14 +7,18 @@ import 'helpers.dart'; void main() { group('DualRing', () { testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitDualRing(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp(const SpinKitDualRing(color: Colors.white)), + ); expect(find.byType(SpinKitDualRing), findsOneWidget); expect(find.byType(CustomPaint), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitDualRing(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp(const SpinKitDualRing(color: Colors.white)), + ); expect(find.byType(SpinKitDualRing), findsOneWidget); expect(find.byType(CustomPaint), findsWidgets); tester.verifyTickersWereDisposed(); diff --git a/test/fading_circle_test.dart b/test/fading_circle_test.dart index b3ba3c4..3ddeb7f 100644 --- a/test/fading_circle_test.dart +++ b/test/fading_circle_test.dart @@ -6,35 +6,58 @@ import 'helpers.dart'; void main() { group('FadingCircle', () { - testWidgets('needs either color or itemBuilder', (WidgetTester tester) async { - expect(() => SpinKitFadingCircle(), throwsAssertionError); - expect(() => SpinKitFadingCircle(color: Colors.white, itemBuilder: fakeBoxBuilder), throwsAssertionError); - }); + testWidgets( + 'needs either color or itemBuilder', + (WidgetTester tester) async { + expect(() => SpinKitFadingCircle(), throwsAssertionError); + expect( + () => SpinKitFadingCircle( + color: Colors.white, + itemBuilder: fakeBoxBuilder, + ), + throwsAssertionError, + ); + }, + ); testWidgets('needs color to be non-null', (WidgetTester tester) async { expect(() => SpinKitFadingCircle(color: null), throwsAssertionError); }); - testWidgets('needs itemBuilder to be non-null', (WidgetTester tester) async { - expect(() => SpinKitFadingCircle(itemBuilder: null), throwsAssertionError); - }); + testWidgets( + 'needs itemBuilder to be non-null', + (WidgetTester tester) async { + expect( + () => SpinKitFadingCircle(itemBuilder: null), + throwsAssertionError, + ); + }, + ); testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitFadingCircle(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp(const SpinKitFadingCircle(color: Colors.white)), + ); expect(find.byType(SpinKitFadingCircle), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works with itemBuilder', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitFadingCircle(itemBuilder: fakeBoxBuilder))); + await tester.pumpWidget( + createMaterialApp( + const SpinKitFadingCircle(itemBuilder: fakeBoxBuilder), + ), + ); expect(find.byType(SpinKitFadingCircle), findsOneWidget); expect(find.byType(FakeBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitFadingCircle(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp(const SpinKitFadingCircle(color: Colors.white)), + ); expect(find.byType(SpinKitFadingCircle), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); diff --git a/test/fading_cube_test.dart b/test/fading_cube_test.dart index e98ca78..81082f6 100644 --- a/test/fading_cube_test.dart +++ b/test/fading_cube_test.dart @@ -6,35 +6,58 @@ import 'helpers.dart'; void main() { group('FadingCube', () { - testWidgets('needs either color or itemBuilder', (WidgetTester tester) async { - expect(() => SpinKitFadingCube(), throwsAssertionError); - expect(() => SpinKitFadingCube(color: Colors.white, itemBuilder: fakeBoxBuilder), throwsAssertionError); - }); + testWidgets( + 'needs either color or itemBuilder', + (WidgetTester tester) async { + expect(() => SpinKitFadingCube(), throwsAssertionError); + expect( + () => SpinKitFadingCube( + color: Colors.white, + itemBuilder: fakeBoxBuilder, + ), + throwsAssertionError, + ); + }, + ); testWidgets('needs color to be non-null', (WidgetTester tester) async { expect(() => SpinKitFadingCube(color: null), throwsAssertionError); }); - testWidgets('needs itemBuilder to be non-null', (WidgetTester tester) async { - expect(() => SpinKitFadingCube(itemBuilder: null), throwsAssertionError); - }); + testWidgets( + 'needs itemBuilder to be non-null', + (WidgetTester tester) async { + expect( + () => SpinKitFadingCube(itemBuilder: null), + throwsAssertionError, + ); + }, + ); testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitFadingCube(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp(const SpinKitFadingCube(color: Colors.white)), + ); expect(find.byType(SpinKitFadingCube), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works with itemBuilder', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitFadingCube(itemBuilder: fakeBoxBuilder))); + await tester.pumpWidget( + createMaterialApp( + const SpinKitFadingCube(itemBuilder: fakeBoxBuilder), + ), + ); expect(find.byType(SpinKitFadingCube), findsOneWidget); expect(find.byType(FakeBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitFadingCube(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp(const SpinKitFadingCube(color: Colors.white)), + ); expect(find.byType(SpinKitFadingCube), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); diff --git a/test/fading_four_test.dart b/test/fading_four_test.dart index aa13125..7a0b04c 100644 --- a/test/fading_four_test.dart +++ b/test/fading_four_test.dart @@ -6,35 +6,58 @@ import 'helpers.dart'; void main() { group('FadingFour', () { - testWidgets('needs either color or itemBuilder', (WidgetTester tester) async { - expect(() => SpinKitFadingFour(), throwsAssertionError); - expect(() => SpinKitFadingFour(color: Colors.white, itemBuilder: fakeBoxBuilder), throwsAssertionError); - }); + testWidgets( + 'needs either color or itemBuilder', + (WidgetTester tester) async { + expect(() => SpinKitFadingFour(), throwsAssertionError); + expect( + () => SpinKitFadingFour( + color: Colors.white, + itemBuilder: fakeBoxBuilder, + ), + throwsAssertionError, + ); + }, + ); testWidgets('needs color to be non-null', (WidgetTester tester) async { expect(() => SpinKitFadingFour(color: null), throwsAssertionError); }); - testWidgets('needs itemBuilder to be non-null', (WidgetTester tester) async { - expect(() => SpinKitFadingFour(itemBuilder: null), throwsAssertionError); - }); + testWidgets( + 'needs itemBuilder to be non-null', + (WidgetTester tester) async { + expect( + () => SpinKitFadingFour(itemBuilder: null), + throwsAssertionError, + ); + }, + ); testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitFadingFour(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp(const SpinKitFadingFour(color: Colors.white)), + ); expect(find.byType(SpinKitFadingFour), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works with itemBuilder', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitFadingFour(itemBuilder: fakeBoxBuilder))); + await tester.pumpWidget( + createMaterialApp( + const SpinKitFadingFour(itemBuilder: fakeBoxBuilder), + ), + ); expect(find.byType(SpinKitFadingFour), findsOneWidget); expect(find.byType(FakeBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitFadingFour(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp(const SpinKitFadingFour(color: Colors.white)), + ); expect(find.byType(SpinKitFadingFour), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); diff --git a/test/fading_grid_test.dart b/test/fading_grid_test.dart index 96a99bd..177d0b2 100644 --- a/test/fading_grid_test.dart +++ b/test/fading_grid_test.dart @@ -6,35 +6,58 @@ import 'helpers.dart'; void main() { group('FadingGrid', () { - testWidgets('needs either color or itemBuilder', (WidgetTester tester) async { - expect(() => SpinKitFadingGrid(), throwsAssertionError); - expect(() => SpinKitFadingGrid(color: Colors.white, itemBuilder: fakeBoxBuilder), throwsAssertionError); - }); + testWidgets( + 'needs either color or itemBuilder', + (WidgetTester tester) async { + expect(() => SpinKitFadingGrid(), throwsAssertionError); + expect( + () => SpinKitFadingGrid( + color: Colors.white, + itemBuilder: fakeBoxBuilder, + ), + throwsAssertionError, + ); + }, + ); testWidgets('needs color to be non-null', (WidgetTester tester) async { expect(() => SpinKitFadingGrid(color: null), throwsAssertionError); }); - testWidgets('needs itemBuilder to be non-null', (WidgetTester tester) async { - expect(() => SpinKitFadingGrid(itemBuilder: null), throwsAssertionError); - }); + testWidgets( + 'needs itemBuilder to be non-null', + (WidgetTester tester) async { + expect( + () => SpinKitFadingGrid(itemBuilder: null), + throwsAssertionError, + ); + }, + ); testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitFadingGrid(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp(const SpinKitFadingGrid(color: Colors.white)), + ); expect(find.byType(SpinKitFadingGrid), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works with itemBuilder', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitFadingGrid(itemBuilder: fakeBoxBuilder))); + await tester.pumpWidget( + createMaterialApp( + const SpinKitFadingGrid(itemBuilder: fakeBoxBuilder), + ), + ); expect(find.byType(SpinKitFadingGrid), findsOneWidget); expect(find.byType(FakeBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitFadingGrid(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp(const SpinKitFadingGrid(color: Colors.white)), + ); expect(find.byType(SpinKitFadingGrid), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); diff --git a/test/folding_cube_test.dart b/test/folding_cube_test.dart index f1b5e1c..1048a4e 100644 --- a/test/folding_cube_test.dart +++ b/test/folding_cube_test.dart @@ -6,35 +6,58 @@ import 'helpers.dart'; void main() { group('FoldingCube', () { - testWidgets('needs either color or itemBuilder', (WidgetTester tester) async { - expect(() => SpinKitFoldingCube(), throwsAssertionError); - expect(() => SpinKitFoldingCube(color: Colors.white, itemBuilder: fakeBoxBuilder), throwsAssertionError); - }); + testWidgets( + 'needs either color or itemBuilder', + (WidgetTester tester) async { + expect(() => SpinKitFoldingCube(), throwsAssertionError); + expect( + () => SpinKitFoldingCube( + color: Colors.white, + itemBuilder: fakeBoxBuilder, + ), + throwsAssertionError, + ); + }, + ); testWidgets('needs color to be non-null', (WidgetTester tester) async { expect(() => SpinKitFoldingCube(color: null), throwsAssertionError); }); - testWidgets('needs itemBuilder to be non-null', (WidgetTester tester) async { - expect(() => SpinKitFoldingCube(itemBuilder: null), throwsAssertionError); - }); + testWidgets( + 'needs itemBuilder to be non-null', + (WidgetTester tester) async { + expect( + () => SpinKitFoldingCube(itemBuilder: null), + throwsAssertionError, + ); + }, + ); testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitFoldingCube(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp(const SpinKitFoldingCube(color: Colors.white)), + ); expect(find.byType(SpinKitFoldingCube), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works with itemBuilder', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitFoldingCube(itemBuilder: fakeBoxBuilder))); + await tester.pumpWidget( + createMaterialApp( + const SpinKitFoldingCube(itemBuilder: fakeBoxBuilder), + ), + ); expect(find.byType(SpinKitFoldingCube), findsOneWidget); expect(find.byType(FakeBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitFoldingCube(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp(const SpinKitFoldingCube(color: Colors.white)), + ); expect(find.byType(SpinKitFoldingCube), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); diff --git a/test/helpers.dart b/test/helpers.dart index 61a4cb1..6c9852b 100644 --- a/test/helpers.dart +++ b/test/helpers.dart @@ -10,7 +10,10 @@ Widget createWidgetsApp(Widget widget) { return WidgetsApp( color: Colors.grey[900]!, home: Center(child: widget), - pageRouteBuilder: (settings, builder) => MaterialPageRoute(settings: settings, builder: builder), + pageRouteBuilder: (settings, builder) => MaterialPageRoute( + settings: settings, + builder: builder, + ), ); } diff --git a/test/hour_glass_test.dart b/test/hour_glass_test.dart index 991f148..624dec3 100644 --- a/test/hour_glass_test.dart +++ b/test/hour_glass_test.dart @@ -7,14 +7,18 @@ import 'helpers.dart'; void main() { group('HourGlass', () { testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitHourGlass(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp(const SpinKitHourGlass(color: Colors.white)), + ); expect(find.byType(SpinKitHourGlass), findsOneWidget); expect(find.byType(CustomPaint), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitHourGlass(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp(const SpinKitHourGlass(color: Colors.white)), + ); expect(find.byType(SpinKitHourGlass), findsOneWidget); expect(find.byType(CustomPaint), findsWidgets); tester.verifyTickersWereDisposed(); diff --git a/test/piano_wave_test.dart b/test/piano_wave_test.dart index 51f261d..b3e624d 100644 --- a/test/piano_wave_test.dart +++ b/test/piano_wave_test.dart @@ -6,23 +6,41 @@ import 'helpers.dart'; void main() { group('PianoWave', () { - testWidgets('needs either color or itemBuilder', (WidgetTester tester) async { - expect(() => SpinKitPianoWave(), throwsAssertionError); - expect(() => SpinKitPianoWave(color: Colors.white, itemBuilder: fakeBoxBuilder), throwsAssertionError); - }); + testWidgets( + 'needs either color or itemBuilder', + (WidgetTester tester) async { + expect(() => SpinKitPianoWave(), throwsAssertionError); + expect( + () => SpinKitPianoWave( + color: Colors.white, + itemBuilder: fakeBoxBuilder, + ), + throwsAssertionError, + ); + }, + ); testWidgets('needs color to be non-null', (WidgetTester tester) async { expect(() => SpinKitPianoWave(color: null), throwsAssertionError); }); - testWidgets('needs itemBuilder to be non-null', (WidgetTester tester) async { - expect(() => SpinKitPianoWave(itemBuilder: null), throwsAssertionError); - }); + testWidgets( + 'needs itemBuilder to be non-null', + (WidgetTester tester) async { + expect(() => SpinKitPianoWave(itemBuilder: null), throwsAssertionError); + }, + ); group('works with types', () { testWidgets('works with types', (WidgetTester tester) async { await tester.pumpWidget( - createMaterialApp(const SpinKitPianoWave(color: Colors.white, type: SpinKitPianoWaveType.start))); + createMaterialApp( + const SpinKitPianoWave( + color: Colors.white, + type: SpinKitPianoWaveType.start, + ), + ), + ); expect(find.byType(SpinKitPianoWave), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); @@ -30,15 +48,27 @@ void main() { testWidgets('works with types', (WidgetTester tester) async { await tester.pumpWidget( - createMaterialApp(const SpinKitPianoWave(color: Colors.white, type: SpinKitPianoWaveType.center))); + createMaterialApp( + const SpinKitPianoWave( + color: Colors.white, + type: SpinKitPianoWaveType.center, + ), + ), + ); expect(find.byType(SpinKitPianoWave), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works with types', (WidgetTester tester) async { - await tester - .pumpWidget(createMaterialApp(const SpinKitPianoWave(color: Colors.white, type: SpinKitPianoWaveType.end))); + await tester.pumpWidget( + createMaterialApp( + const SpinKitPianoWave( + color: Colors.white, + type: SpinKitPianoWaveType.end, + ), + ), + ); expect(find.byType(SpinKitPianoWave), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); @@ -46,21 +76,29 @@ void main() { }); testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitPianoWave(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp(const SpinKitPianoWave(color: Colors.white)), + ); expect(find.byType(SpinKitPianoWave), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works with itemBuilder', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitPianoWave(itemBuilder: fakeBoxBuilder))); + await tester.pumpWidget( + createMaterialApp( + const SpinKitPianoWave(itemBuilder: fakeBoxBuilder), + ), + ); expect(find.byType(SpinKitPianoWave), findsOneWidget); expect(find.byType(FakeBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitPianoWave(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp(const SpinKitPianoWave(color: Colors.white)), + ); expect(find.byType(SpinKitPianoWave), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); diff --git a/test/pouring_hour_glass_refined_test.dart b/test/pouring_hour_glass_refined_test.dart index 9bbde77..b8ca21d 100644 --- a/test/pouring_hour_glass_refined_test.dart +++ b/test/pouring_hour_glass_refined_test.dart @@ -7,14 +7,22 @@ import 'helpers.dart'; void main() { group('PouringHourGlassRefined', () { testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitPouringHourGlassRefined(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp( + const SpinKitPouringHourGlassRefined(color: Colors.white), + ), + ); expect(find.byType(SpinKitPouringHourGlassRefined), findsOneWidget); expect(find.byType(CustomPaint), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitPouringHourGlassRefined(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp( + const SpinKitPouringHourGlassRefined(color: Colors.white), + ), + ); expect(find.byType(SpinKitPouringHourGlassRefined), findsOneWidget); expect(find.byType(CustomPaint), findsWidgets); tester.verifyTickersWereDisposed(); diff --git a/test/pouring_hour_glass_test.dart b/test/pouring_hour_glass_test.dart index 903f7bf..1e8ba4a 100644 --- a/test/pouring_hour_glass_test.dart +++ b/test/pouring_hour_glass_test.dart @@ -7,14 +7,20 @@ import 'helpers.dart'; void main() { group('PouringHourglass', () { testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitPouringHourGlass(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp( + const SpinKitPouringHourGlass(color: Colors.white), + ), + ); expect(find.byType(SpinKitPouringHourGlass), findsOneWidget); expect(find.byType(CustomPaint), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitPouringHourGlass(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp(const SpinKitPouringHourGlass(color: Colors.white)), + ); expect(find.byType(SpinKitPouringHourGlass), findsOneWidget); expect(find.byType(CustomPaint), findsWidgets); tester.verifyTickersWereDisposed(); diff --git a/test/pulse_test.dart b/test/pulse_test.dart index b75eb1e..d186697 100644 --- a/test/pulse_test.dart +++ b/test/pulse_test.dart @@ -6,35 +6,50 @@ import 'helpers.dart'; void main() { group('Pulse', () { - testWidgets('needs either color or itemBuilder', (WidgetTester tester) async { - expect(() => SpinKitPulse(), throwsAssertionError); - expect(() => SpinKitPulse(color: Colors.white, itemBuilder: fakeBoxBuilder), throwsAssertionError); - }); + testWidgets( + 'needs either color or itemBuilder', + (WidgetTester tester) async { + expect(() => SpinKitPulse(), throwsAssertionError); + expect( + () => SpinKitPulse(color: Colors.white, itemBuilder: fakeBoxBuilder), + throwsAssertionError, + ); + }, + ); testWidgets('needs color to be non-null', (WidgetTester tester) async { expect(() => SpinKitPulse(color: null), throwsAssertionError); }); - testWidgets('needs itemBuilder to be non-null', (WidgetTester tester) async { - expect(() => SpinKitPulse(itemBuilder: null), throwsAssertionError); - }); + testWidgets( + 'needs itemBuilder to be non-null', + (WidgetTester tester) async { + expect(() => SpinKitPulse(itemBuilder: null), throwsAssertionError); + }, + ); testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitPulse(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp(const SpinKitPulse(color: Colors.white)), + ); expect(find.byType(SpinKitPulse), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works with itemBuilder', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitPulse(itemBuilder: fakeBoxBuilder))); + await tester.pumpWidget( + createMaterialApp(const SpinKitPulse(itemBuilder: fakeBoxBuilder)), + ); expect(find.byType(SpinKitPulse), findsOneWidget); expect(find.byType(FakeBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitPulse(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp(const SpinKitPulse(color: Colors.white)), + ); expect(find.byType(SpinKitPulse), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); diff --git a/test/pulsing_grid_test.dart b/test/pulsing_grid_test.dart index 4bdc687..9a7fcf9 100644 --- a/test/pulsing_grid_test.dart +++ b/test/pulsing_grid_test.dart @@ -6,35 +6,58 @@ import 'helpers.dart'; void main() { group('PulsingGrid', () { - testWidgets('needs either color or itemBuilder', (WidgetTester tester) async { - expect(() => SpinKitPulsingGrid(), throwsAssertionError); - expect(() => SpinKitPulsingGrid(color: Colors.white, itemBuilder: fakeBoxBuilder), throwsAssertionError); - }); + testWidgets( + 'needs either color or itemBuilder', + (WidgetTester tester) async { + expect(() => SpinKitPulsingGrid(), throwsAssertionError); + expect( + () => SpinKitPulsingGrid( + color: Colors.white, + itemBuilder: fakeBoxBuilder, + ), + throwsAssertionError, + ); + }, + ); testWidgets('needs color to be non-null', (WidgetTester tester) async { expect(() => SpinKitPulsingGrid(color: null), throwsAssertionError); }); - testWidgets('needs itemBuilder to be non-null', (WidgetTester tester) async { - expect(() => SpinKitPulsingGrid(itemBuilder: null), throwsAssertionError); - }); + testWidgets( + 'needs itemBuilder to be non-null', + (WidgetTester tester) async { + expect( + () => SpinKitPulsingGrid(itemBuilder: null), + throwsAssertionError, + ); + }, + ); testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitPulsingGrid(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp(const SpinKitPulsingGrid(color: Colors.white)), + ); expect(find.byType(SpinKitPulsingGrid), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works with itemBuilder', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitPulsingGrid(itemBuilder: fakeBoxBuilder))); + await tester.pumpWidget( + createMaterialApp( + const SpinKitPulsingGrid(itemBuilder: fakeBoxBuilder), + ), + ); expect(find.byType(SpinKitPulsingGrid), findsOneWidget); expect(find.byType(FakeBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitPulsingGrid(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp(const SpinKitPulsingGrid(color: Colors.white)), + ); expect(find.byType(SpinKitPulsingGrid), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); diff --git a/test/pumping_heart_test.dart b/test/pumping_heart_test.dart index 3034d41..f328fc8 100644 --- a/test/pumping_heart_test.dart +++ b/test/pumping_heart_test.dart @@ -7,35 +7,58 @@ import 'helpers.dart'; void main() { group('PumpingHeart', () { - testWidgets('needs either color or itemBuilder', (WidgetTester tester) async { - expect(() => SpinKitPumpingHeart(), throwsAssertionError); - expect(() => SpinKitPumpingHeart(color: Colors.white, itemBuilder: fakeBoxBuilder), throwsAssertionError); - }); + testWidgets( + 'needs either color or itemBuilder', + (WidgetTester tester) async { + expect(() => SpinKitPumpingHeart(), throwsAssertionError); + expect( + () => SpinKitPumpingHeart( + color: Colors.white, + itemBuilder: fakeBoxBuilder, + ), + throwsAssertionError, + ); + }, + ); testWidgets('needs color to be non-null', (WidgetTester tester) async { expect(() => SpinKitPumpingHeart(color: null), throwsAssertionError); }); - testWidgets('needs itemBuilder to be non-null', (WidgetTester tester) async { - expect(() => SpinKitPumpingHeart(itemBuilder: null), throwsAssertionError); - }); + testWidgets( + 'needs itemBuilder to be non-null', + (WidgetTester tester) async { + expect( + () => SpinKitPumpingHeart(itemBuilder: null), + throwsAssertionError, + ); + }, + ); testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitPumpingHeart(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp(const SpinKitPumpingHeart(color: Colors.white)), + ); expect(find.byType(SpinKitPumpingHeart), findsOneWidget); expect(find.byType(Icon), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works with itemBuilder', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitPumpingHeart(itemBuilder: fakeBoxBuilder))); + await tester.pumpWidget( + createMaterialApp( + const SpinKitPumpingHeart(itemBuilder: fakeBoxBuilder), + ), + ); expect(find.byType(SpinKitPumpingHeart), findsOneWidget); expect(find.byType(FakeBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitPumpingHeart(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp(const SpinKitPumpingHeart(color: Colors.white)), + ); expect(find.byType(SpinKitPumpingHeart), findsOneWidget); expect(find.byType(Icon), findsWidgets); tester.verifyTickersWereDisposed(); @@ -46,9 +69,15 @@ void main() { const anotherMagicNumber = .8636363638; const curve = SpinKitPumpCurve(); expect(curve.transform(0), 0); - expect(curve.transform(.25), closeTo(anotherMagicNumber, precisionErrorTolerance)); + expect( + curve.transform(.25), + closeTo(anotherMagicNumber, precisionErrorTolerance), + ); expect(curve.transform(.5), 0); - expect(curve.transform(.75), closeTo(anotherMagicNumber / 2, precisionErrorTolerance)); + expect( + curve.transform(.75), + closeTo(anotherMagicNumber / 2, precisionErrorTolerance), + ); expect(curve.transform(1), 0); }); }); diff --git a/test/ring_test.dart b/test/ring_test.dart index 5709d5d..5a458b3 100644 --- a/test/ring_test.dart +++ b/test/ring_test.dart @@ -8,14 +8,18 @@ import 'helpers.dart'; void main() { group('Ring', () { testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitRing(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp(const SpinKitRing(color: Colors.white)), + ); expect(find.byType(SpinKitRing), findsOneWidget); expect(find.byType(CustomPaint), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitRing(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp(const SpinKitRing(color: Colors.white)), + ); expect(find.byType(SpinKitRing), findsOneWidget); expect(find.byType(CustomPaint), findsWidgets); tester.verifyTickersWereDisposed(); diff --git a/test/ripple_test.dart b/test/ripple_test.dart index 7a375dd..9026b8b 100644 --- a/test/ripple_test.dart +++ b/test/ripple_test.dart @@ -6,35 +6,50 @@ import 'helpers.dart'; void main() { group('Ripple', () { - testWidgets('needs either color or itemBuilder', (WidgetTester tester) async { - expect(() => SpinKitRipple(), throwsAssertionError); - expect(() => SpinKitRipple(color: Colors.white, itemBuilder: fakeBoxBuilder), throwsAssertionError); - }); + testWidgets( + 'needs either color or itemBuilder', + (WidgetTester tester) async { + expect(() => SpinKitRipple(), throwsAssertionError); + expect( + () => SpinKitRipple(color: Colors.white, itemBuilder: fakeBoxBuilder), + throwsAssertionError, + ); + }, + ); testWidgets('needs color to be non-null', (WidgetTester tester) async { expect(() => SpinKitRipple(color: null), throwsAssertionError); }); - testWidgets('needs itemBuilder to be non-null', (WidgetTester tester) async { - expect(() => SpinKitRipple(itemBuilder: null), throwsAssertionError); - }); + testWidgets( + 'needs itemBuilder to be non-null', + (WidgetTester tester) async { + expect(() => SpinKitRipple(itemBuilder: null), throwsAssertionError); + }, + ); testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitRipple(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp(const SpinKitRipple(color: Colors.white)), + ); expect(find.byType(SpinKitRipple), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works with itemBuilder', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitRipple(itemBuilder: fakeBoxBuilder))); + await tester.pumpWidget( + createMaterialApp(const SpinKitRipple(itemBuilder: fakeBoxBuilder)), + ); expect(find.byType(SpinKitRipple), findsOneWidget); expect(find.byType(FakeBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitRipple(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp(const SpinKitRipple(color: Colors.white)), + ); expect(find.byType(SpinKitRipple), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); diff --git a/test/rotating_circle_test.dart b/test/rotating_circle_test.dart index 76c1ef5..3931cb0 100644 --- a/test/rotating_circle_test.dart +++ b/test/rotating_circle_test.dart @@ -6,35 +6,58 @@ import 'helpers.dart'; void main() { group('RotatingCircle', () { - testWidgets('needs either color or itemBuilder', (WidgetTester tester) async { - expect(() => SpinKitRotatingCircle(), throwsAssertionError); - expect(() => SpinKitRotatingCircle(color: Colors.white, itemBuilder: fakeBoxBuilder), throwsAssertionError); - }); + testWidgets( + 'needs either color or itemBuilder', + (WidgetTester tester) async { + expect(() => SpinKitRotatingCircle(), throwsAssertionError); + expect( + () => SpinKitRotatingCircle( + color: Colors.white, + itemBuilder: fakeBoxBuilder, + ), + throwsAssertionError, + ); + }, + ); testWidgets('needs color to be non-null', (WidgetTester tester) async { expect(() => SpinKitRotatingCircle(color: null), throwsAssertionError); }); - testWidgets('needs itemBuilder to be non-null', (WidgetTester tester) async { - expect(() => SpinKitRotatingCircle(itemBuilder: null), throwsAssertionError); - }); + testWidgets( + 'needs itemBuilder to be non-null', + (WidgetTester tester) async { + expect( + () => SpinKitRotatingCircle(itemBuilder: null), + throwsAssertionError, + ); + }, + ); testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitRotatingCircle(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp(const SpinKitRotatingCircle(color: Colors.white)), + ); expect(find.byType(SpinKitRotatingCircle), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works with itemBuilder', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitRotatingCircle(itemBuilder: fakeBoxBuilder))); + await tester.pumpWidget( + createMaterialApp( + const SpinKitRotatingCircle(itemBuilder: fakeBoxBuilder), + ), + ); expect(find.byType(SpinKitRotatingCircle), findsOneWidget); expect(find.byType(FakeBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitRotatingCircle(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp(const SpinKitRotatingCircle(color: Colors.white)), + ); expect(find.byType(SpinKitRotatingCircle), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); diff --git a/test/rotating_plain_test.dart b/test/rotating_plain_test.dart index f56f242..0104926 100644 --- a/test/rotating_plain_test.dart +++ b/test/rotating_plain_test.dart @@ -6,35 +6,58 @@ import 'helpers.dart'; void main() { group('RotatingPlain', () { - testWidgets('needs either color or itemBuilder', (WidgetTester tester) async { - expect(() => SpinKitRotatingPlain(), throwsAssertionError); - expect(() => SpinKitRotatingPlain(color: Colors.white, itemBuilder: fakeBoxBuilder), throwsAssertionError); - }); + testWidgets( + 'needs either color or itemBuilder', + (WidgetTester tester) async { + expect(() => SpinKitRotatingPlain(), throwsAssertionError); + expect( + () => SpinKitRotatingPlain( + color: Colors.white, + itemBuilder: fakeBoxBuilder, + ), + throwsAssertionError, + ); + }, + ); testWidgets('needs color to be non-null', (WidgetTester tester) async { expect(() => SpinKitRotatingPlain(color: null), throwsAssertionError); }); - testWidgets('needs itemBuilder to be non-null', (WidgetTester tester) async { - expect(() => SpinKitRotatingPlain(itemBuilder: null), throwsAssertionError); - }); + testWidgets( + 'needs itemBuilder to be non-null', + (WidgetTester tester) async { + expect( + () => SpinKitRotatingPlain(itemBuilder: null), + throwsAssertionError, + ); + }, + ); testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitRotatingPlain(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp(const SpinKitRotatingPlain(color: Colors.white)), + ); expect(find.byType(SpinKitRotatingPlain), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works with itemBuilder', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitRotatingPlain(itemBuilder: fakeBoxBuilder))); + await tester.pumpWidget( + createMaterialApp( + const SpinKitRotatingPlain(itemBuilder: fakeBoxBuilder), + ), + ); expect(find.byType(SpinKitRotatingPlain), findsOneWidget); expect(find.byType(FakeBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitRotatingPlain(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp(const SpinKitRotatingPlain(color: Colors.white)), + ); expect(find.byType(SpinKitRotatingPlain), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); diff --git a/test/smoke_test.dart b/test/smoke_test.dart index 635724a..5cd5977 100644 --- a/test/smoke_test.dart +++ b/test/smoke_test.dart @@ -4,45 +4,47 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('Smoke test', (WidgetTester tester) async { - await tester.pumpWidget(MaterialApp( - theme: ThemeData.dark(), - home: SingleChildScrollView( - child: Column( - children: const [ - SpinKitChasingDots(color: Colors.white), - SpinKitCircle(color: Colors.white), - SpinKitSquareCircle(color: Colors.white), - SpinKitDoubleBounce(color: Colors.white), - SpinKitCubeGrid(color: Colors.white), - SpinKitDoubleBounce(color: Colors.white), - SpinKitDualRing(color: Colors.white), - SpinKitFadingCircle(color: Colors.white), - SpinKitFadingCube(color: Colors.white), - SpinKitFadingFour(color: Colors.white), - SpinKitFadingGrid(color: Colors.white), - SpinKitFoldingCube(color: Colors.white), - SpinKitHourGlass(color: Colors.white), - SpinKitPouringHourGlass(color: Colors.white), - SpinKitPouringHourGlassRefined(color: Colors.white), - SpinKitPulse(color: Colors.white), - SpinKitPulsingGrid(color: Colors.white), - SpinKitPumpingHeart(color: Colors.white), - SpinKitRing(color: Colors.white), - SpinKitRipple(color: Colors.white), - SpinKitRotatingCircle(color: Colors.white), - SpinKitRotatingPlain(color: Colors.white), - SpinKitSpinningCircle(color: Colors.white), - SpinKitSpinningLines(color: Colors.white), - SpinKitThreeBounce(color: Colors.white), - SpinKitThreeInOut(color: Colors.white), - SpinKitWanderingCubes(color: Colors.white), - SpinKitWave(color: Colors.white), - SpinKitPianoWave(color: Colors.white), - SpinKitDancingSquare(color: Colors.white), - ], + await tester.pumpWidget( + MaterialApp( + theme: ThemeData.dark(), + home: SingleChildScrollView( + child: Column( + children: const [ + SpinKitChasingDots(color: Colors.white), + SpinKitCircle(color: Colors.white), + SpinKitSquareCircle(color: Colors.white), + SpinKitDoubleBounce(color: Colors.white), + SpinKitCubeGrid(color: Colors.white), + SpinKitDoubleBounce(color: Colors.white), + SpinKitDualRing(color: Colors.white), + SpinKitFadingCircle(color: Colors.white), + SpinKitFadingCube(color: Colors.white), + SpinKitFadingFour(color: Colors.white), + SpinKitFadingGrid(color: Colors.white), + SpinKitFoldingCube(color: Colors.white), + SpinKitHourGlass(color: Colors.white), + SpinKitPouringHourGlass(color: Colors.white), + SpinKitPouringHourGlassRefined(color: Colors.white), + SpinKitPulse(color: Colors.white), + SpinKitPulsingGrid(color: Colors.white), + SpinKitPumpingHeart(color: Colors.white), + SpinKitRing(color: Colors.white), + SpinKitRipple(color: Colors.white), + SpinKitRotatingCircle(color: Colors.white), + SpinKitRotatingPlain(color: Colors.white), + SpinKitSpinningCircle(color: Colors.white), + SpinKitSpinningLines(color: Colors.white), + SpinKitThreeBounce(color: Colors.white), + SpinKitThreeInOut(color: Colors.white), + SpinKitWanderingCubes(color: Colors.white), + SpinKitWave(color: Colors.white), + SpinKitPianoWave(color: Colors.white), + SpinKitDancingSquare(color: Colors.white), + ], + ), ), ), - )); + ); await tester.pump(); }); diff --git a/test/spinning_circle_test.dart b/test/spinning_circle_test.dart index f7d6647..7b2a149 100644 --- a/test/spinning_circle_test.dart +++ b/test/spinning_circle_test.dart @@ -6,35 +6,58 @@ import 'helpers.dart'; void main() { group('SpinningCircle', () { - testWidgets('needs either color or itemBuilder', (WidgetTester tester) async { - expect(() => SpinKitSpinningCircle(), throwsAssertionError); - expect(() => SpinKitSpinningCircle(color: Colors.white, itemBuilder: fakeBoxBuilder), throwsAssertionError); - }); + testWidgets( + 'needs either color or itemBuilder', + (WidgetTester tester) async { + expect(() => SpinKitSpinningCircle(), throwsAssertionError); + expect( + () => SpinKitSpinningCircle( + color: Colors.white, + itemBuilder: fakeBoxBuilder, + ), + throwsAssertionError, + ); + }, + ); testWidgets('needs color to be non-null', (WidgetTester tester) async { expect(() => SpinKitSpinningCircle(color: null), throwsAssertionError); }); - testWidgets('needs itemBuilder to be non-null', (WidgetTester tester) async { - expect(() => SpinKitSpinningCircle(itemBuilder: null), throwsAssertionError); - }); + testWidgets( + 'needs itemBuilder to be non-null', + (WidgetTester tester) async { + expect( + () => SpinKitSpinningCircle(itemBuilder: null), + throwsAssertionError, + ); + }, + ); testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitSpinningCircle(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp(const SpinKitSpinningCircle(color: Colors.white)), + ); expect(find.byType(SpinKitSpinningCircle), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works with itemBuilder', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitSpinningCircle(itemBuilder: fakeBoxBuilder))); + await tester.pumpWidget( + createMaterialApp( + const SpinKitSpinningCircle(itemBuilder: fakeBoxBuilder), + ), + ); expect(find.byType(SpinKitSpinningCircle), findsOneWidget); expect(find.byType(FakeBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitSpinningCircle(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp(const SpinKitSpinningCircle(color: Colors.white)), + ); expect(find.byType(SpinKitSpinningCircle), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); diff --git a/test/spinning_line_test.dart b/test/spinning_line_test.dart index 2ada011..fb1b8b8 100644 --- a/test/spinning_line_test.dart +++ b/test/spinning_line_test.dart @@ -7,14 +7,18 @@ import 'helpers.dart'; void main() { group('SpinningLines', () { testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitSpinningLines(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp(const SpinKitSpinningLines(color: Colors.white)), + ); expect(find.byType(SpinKitSpinningLines), findsOneWidget); expect(find.byType(CustomPaint), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitSpinningLines(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp(const SpinKitSpinningLines(color: Colors.white)), + ); expect(find.byType(SpinKitSpinningLines), findsOneWidget); expect(find.byType(CustomPaint), findsWidgets); tester.verifyTickersWereDisposed(); diff --git a/test/square_circle_test.dart b/test/square_circle_test.dart index ced8e37..3bdfb24 100644 --- a/test/square_circle_test.dart +++ b/test/square_circle_test.dart @@ -6,35 +6,58 @@ import 'helpers.dart'; void main() { group('SquareCircle', () { - testWidgets('needs either color or itemBuilder', (WidgetTester tester) async { - expect(() => SpinKitSquareCircle(), throwsAssertionError); - expect(() => SpinKitSquareCircle(color: Colors.white, itemBuilder: fakeBoxBuilder), throwsAssertionError); - }); + testWidgets( + 'needs either color or itemBuilder', + (WidgetTester tester) async { + expect(() => SpinKitSquareCircle(), throwsAssertionError); + expect( + () => SpinKitSquareCircle( + color: Colors.white, + itemBuilder: fakeBoxBuilder, + ), + throwsAssertionError, + ); + }, + ); testWidgets('needs color to be non-null', (WidgetTester tester) async { expect(() => SpinKitSquareCircle(color: null), throwsAssertionError); }); - testWidgets('needs itemBuilder to be non-null', (WidgetTester tester) async { - expect(() => SpinKitSquareCircle(itemBuilder: null), throwsAssertionError); - }); + testWidgets( + 'needs itemBuilder to be non-null', + (WidgetTester tester) async { + expect( + () => SpinKitSquareCircle(itemBuilder: null), + throwsAssertionError, + ); + }, + ); testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitSquareCircle(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp(const SpinKitSquareCircle(color: Colors.white)), + ); expect(find.byType(SpinKitSquareCircle), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works with itemBuilder', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitSquareCircle(itemBuilder: fakeBoxBuilder))); + await tester.pumpWidget( + createMaterialApp( + const SpinKitSquareCircle(itemBuilder: fakeBoxBuilder), + ), + ); expect(find.byType(SpinKitSquareCircle), findsOneWidget); expect(find.byType(FakeBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitSquareCircle(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp(const SpinKitSquareCircle(color: Colors.white)), + ); expect(find.byType(SpinKitSquareCircle), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); diff --git a/test/three_bounce_test.dart b/test/three_bounce_test.dart index 5be95ef..fbd91b9 100644 --- a/test/three_bounce_test.dart +++ b/test/three_bounce_test.dart @@ -6,35 +6,58 @@ import 'helpers.dart'; void main() { group('ThreeBounce', () { - testWidgets('needs either color or itemBuilder', (WidgetTester tester) async { - expect(() => SpinKitThreeBounce(), throwsAssertionError); - expect(() => SpinKitThreeBounce(color: Colors.white, itemBuilder: fakeBoxBuilder), throwsAssertionError); - }); + testWidgets( + 'needs either color or itemBuilder', + (WidgetTester tester) async { + expect(() => SpinKitThreeBounce(), throwsAssertionError); + expect( + () => SpinKitThreeBounce( + color: Colors.white, + itemBuilder: fakeBoxBuilder, + ), + throwsAssertionError, + ); + }, + ); testWidgets('needs color to be non-null', (WidgetTester tester) async { expect(() => SpinKitThreeBounce(color: null), throwsAssertionError); }); - testWidgets('needs itemBuilder to be non-null', (WidgetTester tester) async { - expect(() => SpinKitThreeBounce(itemBuilder: null), throwsAssertionError); - }); + testWidgets( + 'needs itemBuilder to be non-null', + (WidgetTester tester) async { + expect( + () => SpinKitThreeBounce(itemBuilder: null), + throwsAssertionError, + ); + }, + ); testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitThreeBounce(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp(const SpinKitThreeBounce(color: Colors.white)), + ); expect(find.byType(SpinKitThreeBounce), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works with itemBuilder', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitThreeBounce(itemBuilder: fakeBoxBuilder))); + await tester.pumpWidget( + createMaterialApp( + const SpinKitThreeBounce(itemBuilder: fakeBoxBuilder), + ), + ); expect(find.byType(SpinKitThreeBounce), findsOneWidget); expect(find.byType(FakeBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitThreeBounce(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp(const SpinKitThreeBounce(color: Colors.white)), + ); expect(find.byType(SpinKitThreeBounce), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); diff --git a/test/three_in_out_test.dart b/test/three_in_out_test.dart index 698cdac..34e4f65 100644 --- a/test/three_in_out_test.dart +++ b/test/three_in_out_test.dart @@ -6,35 +6,58 @@ import 'helpers.dart'; void main() { group('ThreeInOut', () { - testWidgets('needs either color or itemBuilder', (WidgetTester tester) async { - expect(() => SpinKitThreeInOut(), throwsAssertionError); - expect(() => SpinKitThreeInOut(color: Colors.white, itemBuilder: fakeBoxBuilder), throwsAssertionError); - }); + testWidgets( + 'needs either color or itemBuilder', + (WidgetTester tester) async { + expect(() => SpinKitThreeInOut(), throwsAssertionError); + expect( + () => SpinKitThreeInOut( + color: Colors.white, + itemBuilder: fakeBoxBuilder, + ), + throwsAssertionError, + ); + }, + ); testWidgets('needs color to be non-null', (WidgetTester tester) async { expect(() => SpinKitThreeInOut(color: null), throwsAssertionError); }); - testWidgets('needs itemBuilder to be non-null', (WidgetTester tester) async { - expect(() => SpinKitThreeInOut(itemBuilder: null), throwsAssertionError); - }); + testWidgets( + 'needs itemBuilder to be non-null', + (WidgetTester tester) async { + expect( + () => SpinKitThreeInOut(itemBuilder: null), + throwsAssertionError, + ); + }, + ); testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitThreeInOut(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp(const SpinKitThreeInOut(color: Colors.white)), + ); expect(find.byType(SpinKitThreeInOut), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works with itemBuilder', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitThreeInOut(itemBuilder: fakeBoxBuilder))); + await tester.pumpWidget( + createMaterialApp( + const SpinKitThreeInOut(itemBuilder: fakeBoxBuilder), + ), + ); expect(find.byType(SpinKitThreeInOut), findsOneWidget); expect(find.byType(FakeBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitThreeInOut(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp(const SpinKitThreeInOut(color: Colors.white)), + ); expect(find.byType(SpinKitThreeInOut), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); diff --git a/test/wandering_cubes_test.dart b/test/wandering_cubes_test.dart index 052f203..a02880c 100644 --- a/test/wandering_cubes_test.dart +++ b/test/wandering_cubes_test.dart @@ -6,35 +6,58 @@ import 'helpers.dart'; void main() { group('WanderingCubes', () { - testWidgets('needs either color or itemBuilder', (WidgetTester tester) async { - expect(() => SpinKitWanderingCubes(), throwsAssertionError); - expect(() => SpinKitWanderingCubes(color: Colors.white, itemBuilder: fakeBoxBuilder), throwsAssertionError); - }); + testWidgets( + 'needs either color or itemBuilder', + (WidgetTester tester) async { + expect(() => SpinKitWanderingCubes(), throwsAssertionError); + expect( + () => SpinKitWanderingCubes( + color: Colors.white, + itemBuilder: fakeBoxBuilder, + ), + throwsAssertionError, + ); + }, + ); testWidgets('needs color to be non-null', (WidgetTester tester) async { expect(() => SpinKitWanderingCubes(color: null), throwsAssertionError); }); - testWidgets('needs itemBuilder to be non-null', (WidgetTester tester) async { - expect(() => SpinKitWanderingCubes(itemBuilder: null), throwsAssertionError); - }); + testWidgets( + 'needs itemBuilder to be non-null', + (WidgetTester tester) async { + expect( + () => SpinKitWanderingCubes(itemBuilder: null), + throwsAssertionError, + ); + }, + ); testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitWanderingCubes(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp(const SpinKitWanderingCubes(color: Colors.white)), + ); expect(find.byType(SpinKitWanderingCubes), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works with itemBuilder', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitWanderingCubes(itemBuilder: fakeBoxBuilder))); + await tester.pumpWidget( + createMaterialApp( + const SpinKitWanderingCubes(itemBuilder: fakeBoxBuilder), + ), + ); expect(find.byType(SpinKitWanderingCubes), findsOneWidget); expect(find.byType(FakeBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitWanderingCubes(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp(const SpinKitWanderingCubes(color: Colors.white)), + ); expect(find.byType(SpinKitWanderingCubes), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); diff --git a/test/wave_spinner_test.dart b/test/wave_spinner_test.dart index 06e6e22..22f8d36 100644 --- a/test/wave_spinner_test.dart +++ b/test/wave_spinner_test.dart @@ -6,64 +6,93 @@ import 'helpers.dart'; void main() { group('Test SpinKitWaveSpinner', () { - testWidgets('Ensure widget works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitWaveSpinner(color: Colors.white))); - expect(find.byType(SpinKitWaveSpinner), findsOneWidget); - expect(find.byType(CustomPaint), findsWidgets); - - tester.verifyTickersWereDisposed(); - }); - - testWidgets('Ensure Icon is found when SpinKinWaveSpinner has a child of Icon', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp( - const SpinKitWaveSpinner(color: Colors.white, child: Icon(Icons.flutter_dash, size: 18)), - )); - expect(find.byType(Icon), findsOneWidget); - - tester.verifyTickersWereDisposed(); - }); - - testWidgets('Ensure that CustomPaint with SpinkitWaveCustomPaint painter exist', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitWaveSpinner(color: Colors.white))); - expect(_findPainter(tester), isA()); - - tester.verifyTickersWereDisposed(); - }); + testWidgets( + 'Ensure widget works without Material', + (WidgetTester tester) async { + await tester.pumpWidget( + createWidgetsApp(const SpinKitWaveSpinner(color: Colors.white)), + ); + expect(find.byType(SpinKitWaveSpinner), findsOneWidget); + expect(find.byType(CustomPaint), findsWidgets); - group('Test painter entities', () { - testWidgets('Ensure that default paint entities are set correctly', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitWaveSpinner(color: Colors.white))); tester.verifyTickersWereDisposed(); - }); + }, + ); - testWidgets('Ensure that entities are set correctly', (WidgetTester tester) async { + testWidgets( + 'Ensure Icon is found when SpinKinWaveSpinner has a child of Icon', + (WidgetTester tester) async { await tester.pumpWidget( createWidgetsApp( const SpinKitWaveSpinner( - waveColor: Colors.red, - trackColor: Colors.lightBlue, - color: Colors.pink, - size: 50, - duration: Duration(seconds: 1), - curve: Curves.bounceIn, + color: Colors.white, + child: Icon(Icons.flutter_dash, size: 18), ), ), ); + expect(find.byType(Icon), findsOneWidget); - final painter = _findPainter(tester); - expect(painter.waveColor, Colors.red); - expect(painter.trackColor, Colors.lightBlue); - expect(painter.color, Colors.pink); + tester.verifyTickersWereDisposed(); + }, + ); + + testWidgets( + 'Ensure that CustomPaint with SpinkitWaveCustomPaint painter exist', + (WidgetTester tester) async { + await tester.pumpWidget( + createWidgetsApp(const SpinKitWaveSpinner(color: Colors.white)), + ); + expect(_findPainter(tester), isA()); tester.verifyTickersWereDisposed(); - }); + }, + ); + + group('Test painter entities', () { + testWidgets( + 'Ensure that default paint entities are set correctly', + (WidgetTester tester) async { + await tester.pumpWidget( + createWidgetsApp(const SpinKitWaveSpinner(color: Colors.white)), + ); + tester.verifyTickersWereDisposed(); + }, + ); + + testWidgets( + 'Ensure that entities are set correctly', + (WidgetTester tester) async { + await tester.pumpWidget( + createWidgetsApp( + const SpinKitWaveSpinner( + waveColor: Colors.red, + trackColor: Colors.lightBlue, + color: Colors.pink, + size: 50, + duration: Duration(seconds: 1), + curve: Curves.bounceIn, + ), + ), + ); + + final painter = _findPainter(tester); + expect(painter.waveColor, Colors.red); + expect(painter.trackColor, Colors.lightBlue); + expect(painter.color, Colors.pink); + + tester.verifyTickersWereDisposed(); + }, + ); }); }); } SpinkitWaveCustomPaint _findPainter(WidgetTester tester) { return (tester.firstWidget( - find.byWidgetPredicate((widget) => (widget is CustomPaint) && widget.painter is SpinkitWaveCustomPaint)) - as CustomPaint) + find.byWidgetPredicate( + (widget) => + (widget is CustomPaint) && widget.painter is SpinkitWaveCustomPaint, + ), + ) as CustomPaint) .painter! as SpinkitWaveCustomPaint; } diff --git a/test/wave_test.dart b/test/wave_test.dart index 8c08ac9..a05caeb 100644 --- a/test/wave_test.dart +++ b/test/wave_test.dart @@ -6,28 +6,41 @@ import 'helpers.dart'; void main() { group('Wave', () { - testWidgets('needs either color or itemBuilder', (WidgetTester tester) async { - expect(() => SpinKitWave(), throwsAssertionError); - expect(() => SpinKitWave(color: Colors.white, itemBuilder: fakeBoxBuilder), throwsAssertionError); - }); + testWidgets( + 'needs either color or itemBuilder', + (WidgetTester tester) async { + expect(() => SpinKitWave(), throwsAssertionError); + expect( + () => SpinKitWave(color: Colors.white, itemBuilder: fakeBoxBuilder), + throwsAssertionError, + ); + }, + ); testWidgets('needs color to be non-null', (WidgetTester tester) async { expect(() => SpinKitWave(color: null), throwsAssertionError); }); - testWidgets('needs itemBuilder to be non-null', (WidgetTester tester) async { - expect(() => SpinKitWave(itemBuilder: null), throwsAssertionError); - }); + testWidgets( + 'needs itemBuilder to be non-null', + (WidgetTester tester) async { + expect(() => SpinKitWave(itemBuilder: null), throwsAssertionError); + }, + ); testWidgets('works with color', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitWave(color: Colors.white))); + await tester.pumpWidget( + createMaterialApp(const SpinKitWave(color: Colors.white)), + ); expect(find.byType(SpinKitWave), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('works with itemBuilder', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitWave(itemBuilder: fakeBoxBuilder))); + await tester.pumpWidget( + createMaterialApp(const SpinKitWave(itemBuilder: fakeBoxBuilder)), + ); expect(find.byType(SpinKitWave), findsOneWidget); expect(find.byType(FakeBox), findsWidgets); tester.verifyTickersWereDisposed(); @@ -35,21 +48,39 @@ void main() { group('works with types', () { testWidgets('on center', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitWave(color: Colors.white, type: SpinKitWaveType.center))); + await tester.pumpWidget( + createMaterialApp( + const SpinKitWave( + color: Colors.white, + type: SpinKitWaveType.center, + ), + ), + ); expect(find.byType(SpinKitWave), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('on start', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitWave(color: Colors.white, type: SpinKitWaveType.start))); + await tester.pumpWidget( + createMaterialApp( + const SpinKitWave( + color: Colors.white, + type: SpinKitWaveType.start, + ), + ), + ); expect(find.byType(SpinKitWave), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); }); testWidgets('on end', (WidgetTester tester) async { - await tester.pumpWidget(createMaterialApp(const SpinKitWave(color: Colors.white, type: SpinKitWaveType.end))); + await tester.pumpWidget( + createMaterialApp( + const SpinKitWave(color: Colors.white, type: SpinKitWaveType.end), + ), + ); expect(find.byType(SpinKitWave), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); @@ -57,7 +88,9 @@ void main() { }); testWidgets('works without Material', (WidgetTester tester) async { - await tester.pumpWidget(createWidgetsApp(const SpinKitWave(color: Colors.white))); + await tester.pumpWidget( + createWidgetsApp(const SpinKitWave(color: Colors.white)), + ); expect(find.byType(SpinKitWave), findsOneWidget); expect(find.byType(DecoratedBox), findsWidgets); tester.verifyTickersWereDisposed(); From 55382d9e8f4b9b0dfc921d34d947d7ac087b9db9 Mon Sep 17 00:00:00 2001 From: OutdatedGuy Date: Tue, 9 May 2023 02:19:35 +0530 Subject: [PATCH 4/6] fix: added previous deleted .gitignore file names --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index d920ae6..208172b 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,7 @@ migrate_working_dir/ .dart_tool/ .packages build/ + +# Custom +.pub/ +coverage/ From 46d6c18796e7623b7eed8a1a37b92a123d93ee9f Mon Sep 17 00:00:00 2001 From: OutdatedGuy Date: Wed, 5 Jul 2023 17:38:51 +0530 Subject: [PATCH 5/6] chore: updated dependencies to latest --- example/pubspec.lock | 34 +++++++++++++++++----------------- test/smoke_test.dart | 4 ++-- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/example/pubspec.lock b/example/pubspec.lock index 795ad95..30bc9da 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -5,10 +5,10 @@ packages: dependency: transitive description: name: async - sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" url: "https://pub.dev" source: hosted - version: "2.10.0" + version: "2.11.0" boolean_selector: dependency: transitive description: @@ -21,10 +21,10 @@ packages: dependency: transitive description: name: characters - sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.3.0" clock: dependency: transitive description: @@ -37,10 +37,10 @@ packages: dependency: transitive description: name: collection - sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" url: "https://pub.dev" source: hosted - version: "1.17.0" + version: "1.17.1" fake_async: dependency: transitive description: @@ -78,10 +78,10 @@ packages: dependency: transitive description: name: js - sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 url: "https://pub.dev" source: hosted - version: "0.6.5" + version: "0.6.7" lints: dependency: transitive description: @@ -94,10 +94,10 @@ packages: dependency: transitive description: name: matcher - sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" + sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb" url: "https://pub.dev" source: hosted - version: "0.12.13" + version: "0.12.15" material_color_utilities: dependency: transitive description: @@ -110,18 +110,18 @@ packages: dependency: transitive description: name: meta - sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.9.1" path: dependency: transitive description: name: path - sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "1.8.3" sky_engine: dependency: transitive description: flutter @@ -171,10 +171,10 @@ packages: dependency: transitive description: name: test_api - sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 + sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb url: "https://pub.dev" source: hosted - version: "0.4.16" + version: "0.5.1" vector_math: dependency: transitive description: @@ -184,5 +184,5 @@ packages: source: hosted version: "2.1.4" sdks: - dart: ">=2.18.0 <3.0.0" + dart: ">=3.0.0-0 <4.0.0" flutter: ">=2.0.0" diff --git a/test/smoke_test.dart b/test/smoke_test.dart index 5cd5977..30b4742 100644 --- a/test/smoke_test.dart +++ b/test/smoke_test.dart @@ -7,9 +7,9 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeData.dark(), - home: SingleChildScrollView( + home: const SingleChildScrollView( child: Column( - children: const [ + children: [ SpinKitChasingDots(color: Colors.white), SpinKitCircle(color: Colors.white), SpinKitSquareCircle(color: Colors.white), From 4120f50dc2797b17da0af1b705ce6264f98d4c43 Mon Sep 17 00:00:00 2001 From: OutdatedGuy Date: Thu, 6 Jul 2023 19:59:35 +0530 Subject: [PATCH 6/6] style: formatted code with line wrap as 120 --- lib/src/chasing_dots.dart | 6 ++---- lib/src/circle.dart | 10 +++------- lib/src/cube_grid.dart | 9 +++------ lib/src/dancing_square.dart | 10 +++------- lib/src/double_bounce.dart | 9 +++------ lib/src/dual_ring.dart | 9 +++------ lib/src/fading_circle.dart | 10 +++------- lib/src/fading_cube.dart | 10 +++------- lib/src/fading_four.dart | 10 +++------- lib/src/fading_grid.dart | 10 +++------- lib/src/folding_cube.dart | 22 +++++++--------------- lib/src/hour_glass.dart | 6 ++---- lib/src/piano_wave.dart | 10 +++------- lib/src/pouring_hour_glass.dart | 9 +++------ lib/src/pouring_hour_glass_refined.dart | 9 +++------ lib/src/pulse.dart | 9 +++------ lib/src/pulsing_grid.dart | 10 +++------- lib/src/pumping_heart.dart | 10 +++------- lib/src/ring.dart | 9 +++------ lib/src/ripple.dart | 9 +++------ lib/src/rotating_circle.dart | 9 +++------ lib/src/rotating_plain.dart | 9 +++------ lib/src/spinning_circle.dart | 9 +++------ lib/src/spinning_lines.dart | 9 +++------ lib/src/square_circle.dart | 9 +++------ lib/src/three_bounce.dart | 10 +++------- lib/src/three_in_out.dart | 9 +++------ lib/src/wandering_cubes.dart | 6 ++---- lib/src/wave.dart | 10 +++------- lib/src/wave_spinner.dart | 7 ++----- 30 files changed, 90 insertions(+), 193 deletions(-) diff --git a/lib/src/chasing_dots.dart b/lib/src/chasing_dots.dart index 3e45646..8f8ba56 100644 --- a/lib/src/chasing_dots.dart +++ b/lib/src/chasing_dots.dart @@ -8,8 +8,7 @@ class SpinKitChasingDots extends StatefulWidget { this.itemBuilder, this.duration = const Duration(milliseconds: 2000), }) : assert( - !(itemBuilder is IndexedWidgetBuilder && color is Color) && - !(itemBuilder == null && color == null), + !(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), 'You should specify either a itemBuilder or a color', ), super(key: key); @@ -23,8 +22,7 @@ class SpinKitChasingDots extends StatefulWidget { State createState() => _SpinKitChasingDotsState(); } -class _SpinKitChasingDotsState extends State - with TickerProviderStateMixin { +class _SpinKitChasingDotsState extends State with TickerProviderStateMixin { late AnimationController _scaleCtrl; late AnimationController _rotateCtrl; late Animation _scale; diff --git a/lib/src/circle.dart b/lib/src/circle.dart index 1678105..9089fd9 100644 --- a/lib/src/circle.dart +++ b/lib/src/circle.dart @@ -10,8 +10,7 @@ class SpinKitCircle extends StatefulWidget { this.duration = const Duration(milliseconds: 1200), this.controller, }) : assert( - !(itemBuilder is IndexedWidgetBuilder && color is Color) && - !(itemBuilder == null && color == null), + !(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), 'You should specify either a itemBuilder or a color', ), super(key: key); @@ -26,8 +25,7 @@ class SpinKitCircle extends StatefulWidget { State createState() => _SpinKitCircleState(); } -class _SpinKitCircleState extends State - with SingleTickerProviderStateMixin { +class _SpinKitCircleState extends State with SingleTickerProviderStateMixin { static const _itemCount = 12; late AnimationController _controller; @@ -36,9 +34,7 @@ class _SpinKitCircleState extends State void initState() { super.initState(); - _controller = (widget.controller ?? - AnimationController(vsync: this, duration: widget.duration)) - ..repeat(); + _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration))..repeat(); } @override diff --git a/lib/src/cube_grid.dart b/lib/src/cube_grid.dart index ef97e42..51cc336 100644 --- a/lib/src/cube_grid.dart +++ b/lib/src/cube_grid.dart @@ -9,8 +9,7 @@ class SpinKitCubeGrid extends StatefulWidget { this.duration = const Duration(milliseconds: 1200), this.controller, }) : assert( - !(itemBuilder is IndexedWidgetBuilder && color is Color) && - !(itemBuilder == null && color == null), + !(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), 'You should specify either a itemBuilder or a color', ), super(key: key); @@ -25,8 +24,7 @@ class SpinKitCubeGrid extends StatefulWidget { State createState() => _SpinKitCubeGridState(); } -class _SpinKitCubeGridState extends State - with SingleTickerProviderStateMixin { +class _SpinKitCubeGridState extends State with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _anim1; late Animation _anim2; @@ -38,8 +36,7 @@ class _SpinKitCubeGridState extends State void initState() { super.initState(); - _controller = (widget.controller ?? - AnimationController(vsync: this, duration: widget.duration)) + _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) ..repeat(reverse: true); _anim1 = Tween(begin: 1.0, end: 0.0).animate( CurvedAnimation( diff --git a/lib/src/dancing_square.dart b/lib/src/dancing_square.dart index b8c84e4..8bc64b4 100644 --- a/lib/src/dancing_square.dart +++ b/lib/src/dancing_square.dart @@ -11,8 +11,7 @@ class SpinKitDancingSquare extends StatefulWidget { this.duration = const Duration(milliseconds: 1200), this.controller, }) : assert( - !(itemBuilder is IndexedWidgetBuilder && color is Color) && - !(itemBuilder == null && color == null), + !(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), 'You should specify either a itemBuilder or a color', ), super(key: key); @@ -27,8 +26,7 @@ class SpinKitDancingSquare extends StatefulWidget { State createState() => _SpinKitDancingSquareState(); } -class _SpinKitDancingSquareState extends State - with SingleTickerProviderStateMixin { +class _SpinKitDancingSquareState extends State with SingleTickerProviderStateMixin { static const _itemCount = 12; late AnimationController _controller; @@ -37,9 +35,7 @@ class _SpinKitDancingSquareState extends State void initState() { super.initState(); - _controller = (widget.controller ?? - AnimationController(vsync: this, duration: widget.duration)) - ..repeat(); + _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration))..repeat(); } @override diff --git a/lib/src/double_bounce.dart b/lib/src/double_bounce.dart index 28d4ab2..76aee36 100644 --- a/lib/src/double_bounce.dart +++ b/lib/src/double_bounce.dart @@ -9,8 +9,7 @@ class SpinKitDoubleBounce extends StatefulWidget { this.duration = const Duration(milliseconds: 2000), this.controller, }) : assert( - !(itemBuilder is IndexedWidgetBuilder && color is Color) && - !(itemBuilder == null && color == null), + !(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), 'You should specify either a itemBuilder or a color', ), super(key: key); @@ -25,8 +24,7 @@ class SpinKitDoubleBounce extends StatefulWidget { State createState() => _SpinKitDoubleBounceState(); } -class _SpinKitDoubleBounceState extends State - with SingleTickerProviderStateMixin { +class _SpinKitDoubleBounceState extends State with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _animation; @@ -34,8 +32,7 @@ class _SpinKitDoubleBounceState extends State void initState() { super.initState(); - _controller = (widget.controller ?? - AnimationController(vsync: this, duration: widget.duration)) + _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) ..addListener(() { if (mounted) { setState(() {}); diff --git a/lib/src/dual_ring.dart b/lib/src/dual_ring.dart index 6255c5b..365e41e 100644 --- a/lib/src/dual_ring.dart +++ b/lib/src/dual_ring.dart @@ -22,8 +22,7 @@ class SpinKitDualRing extends StatefulWidget { State createState() => _SpinKitDualRingState(); } -class _SpinKitDualRingState extends State - with SingleTickerProviderStateMixin { +class _SpinKitDualRingState extends State with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _animation; @@ -31,8 +30,7 @@ class _SpinKitDualRingState extends State void initState() { super.initState(); - _controller = (widget.controller ?? - AnimationController(vsync: this, duration: widget.duration)) + _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) ..addListener(() { if (mounted) { setState(() {}); @@ -59,8 +57,7 @@ class _SpinKitDualRingState extends State Widget build(BuildContext context) { return Center( child: Transform( - transform: Matrix4.identity() - ..rotateZ((_animation.value) * math.pi * 2), + transform: Matrix4.identity()..rotateZ((_animation.value) * math.pi * 2), alignment: FractionalOffset.center, child: CustomPaint( painter: _DualRingPainter( diff --git a/lib/src/fading_circle.dart b/lib/src/fading_circle.dart index 2c7492f..2441b85 100644 --- a/lib/src/fading_circle.dart +++ b/lib/src/fading_circle.dart @@ -10,8 +10,7 @@ class SpinKitFadingCircle extends StatefulWidget { this.duration = const Duration(milliseconds: 1200), this.controller, }) : assert( - !(itemBuilder is IndexedWidgetBuilder && color is Color) && - !(itemBuilder == null && color == null), + !(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), 'You should specify either a itemBuilder or a color', ), super(key: key); @@ -26,8 +25,7 @@ class SpinKitFadingCircle extends StatefulWidget { State createState() => _SpinKitFadingCircleState(); } -class _SpinKitFadingCircleState extends State - with SingleTickerProviderStateMixin { +class _SpinKitFadingCircleState extends State with SingleTickerProviderStateMixin { static const _itemCount = 12; late AnimationController _controller; @@ -36,9 +34,7 @@ class _SpinKitFadingCircleState extends State void initState() { super.initState(); - _controller = (widget.controller ?? - AnimationController(vsync: this, duration: widget.duration)) - ..repeat(); + _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration))..repeat(); } @override diff --git a/lib/src/fading_cube.dart b/lib/src/fading_cube.dart index 3d1d369..d7fcdf8 100644 --- a/lib/src/fading_cube.dart +++ b/lib/src/fading_cube.dart @@ -10,8 +10,7 @@ class SpinKitFadingCube extends StatefulWidget { this.duration = const Duration(milliseconds: 2400), this.controller, }) : assert( - !(itemBuilder is IndexedWidgetBuilder && color is Color) && - !(itemBuilder == null && color == null), + !(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), 'You should specify either a itemBuilder or a color', ), super(key: key); @@ -26,17 +25,14 @@ class SpinKitFadingCube extends StatefulWidget { State createState() => _SpinKitFadingCubeState(); } -class _SpinKitFadingCubeState extends State - with SingleTickerProviderStateMixin { +class _SpinKitFadingCubeState extends State with SingleTickerProviderStateMixin { late AnimationController _controller; @override void initState() { super.initState(); - _controller = (widget.controller ?? - AnimationController(vsync: this, duration: widget.duration)) - ..repeat(); + _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration))..repeat(); } @override diff --git a/lib/src/fading_four.dart b/lib/src/fading_four.dart index 76024b3..bbb858a 100644 --- a/lib/src/fading_four.dart +++ b/lib/src/fading_four.dart @@ -11,8 +11,7 @@ class SpinKitFadingFour extends StatefulWidget { this.duration = const Duration(milliseconds: 1200), this.controller, }) : assert( - !(itemBuilder is IndexedWidgetBuilder && color is Color) && - !(itemBuilder == null && color == null), + !(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), 'You should specify either a itemBuilder or a color', ), super(key: key); @@ -28,8 +27,7 @@ class SpinKitFadingFour extends StatefulWidget { State createState() => _SpinKitFadingFourState(); } -class _SpinKitFadingFourState extends State - with SingleTickerProviderStateMixin { +class _SpinKitFadingFourState extends State with SingleTickerProviderStateMixin { static const List _delays = [.0, -0.9, -0.6, -0.3]; late AnimationController _controller; @@ -37,9 +35,7 @@ class _SpinKitFadingFourState extends State void initState() { super.initState(); - _controller = (widget.controller ?? - AnimationController(vsync: this, duration: widget.duration)) - ..repeat(); + _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration))..repeat(); } @override diff --git a/lib/src/fading_grid.dart b/lib/src/fading_grid.dart index 159919b..1ad7453 100644 --- a/lib/src/fading_grid.dart +++ b/lib/src/fading_grid.dart @@ -11,8 +11,7 @@ class SpinKitFadingGrid extends StatefulWidget { this.duration = const Duration(milliseconds: 1200), this.controller, }) : assert( - !(itemBuilder is IndexedWidgetBuilder && color is Color) && - !(itemBuilder == null && color == null), + !(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), 'You should specify either a itemBuilder or a color', ), super(key: key); @@ -28,17 +27,14 @@ class SpinKitFadingGrid extends StatefulWidget { State createState() => _SpinKitFadingGridState(); } -class _SpinKitFadingGridState extends State - with SingleTickerProviderStateMixin { +class _SpinKitFadingGridState extends State with SingleTickerProviderStateMixin { late AnimationController _controller; @override void initState() { super.initState(); - _controller = (widget.controller ?? - AnimationController(vsync: this, duration: widget.duration)) - ..repeat(); + _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration))..repeat(); } @override diff --git a/lib/src/folding_cube.dart b/lib/src/folding_cube.dart index 394499f..7af9ae9 100644 --- a/lib/src/folding_cube.dart +++ b/lib/src/folding_cube.dart @@ -11,8 +11,7 @@ class SpinKitFoldingCube extends StatefulWidget { this.duration = const Duration(milliseconds: 2400), this.controller, }) : assert( - !(itemBuilder is IndexedWidgetBuilder && color is Color) && - !(itemBuilder == null && color == null), + !(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), 'You should specify either a itemBuilder or a color', ), super(key: key); @@ -27,8 +26,7 @@ class SpinKitFoldingCube extends StatefulWidget { State createState() => _SpinKitFoldingCubeState(); } -class _SpinKitFoldingCubeState extends State - with TickerProviderStateMixin { +class _SpinKitFoldingCubeState extends State with TickerProviderStateMixin { late final int _delay; late AnimationController _controller1; @@ -50,19 +48,15 @@ class _SpinKitFoldingCubeState extends State _delay = widget.duration.inMilliseconds ~/ 8; - _controller1 = (widget.controller ?? - AnimationController(vsync: this, duration: widget.duration)) + _controller1 = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) ..addListener(() { if (mounted) { setState(() {}); } }); - _controller2 = widget.controller ?? - AnimationController(vsync: this, duration: widget.duration); - _controller3 = widget.controller ?? - AnimationController(vsync: this, duration: widget.duration); - _controller4 = widget.controller ?? - AnimationController(vsync: this, duration: widget.duration); + _controller2 = widget.controller ?? AnimationController(vsync: this, duration: widget.duration); + _controller3 = widget.controller ?? AnimationController(vsync: this, duration: widget.duration); + _controller4 = widget.controller ?? AnimationController(vsync: this, duration: widget.duration); final tweenSequence = TweenSequence([ TweenSequenceItem( @@ -175,9 +169,7 @@ class _SpinKitFoldingCubeState extends State alignment: Alignment.center, child: Transform( transform: tRotate, - alignment: animation.value <= 0 - ? Alignment.topCenter - : Alignment.centerLeft, + alignment: animation.value <= 0 ? Alignment.topCenter : Alignment.centerLeft, child: Opacity( opacity: 1.0 - (animation.value.abs() / 180.0), child: SizedBox.fromSize( diff --git a/lib/src/hour_glass.dart b/lib/src/hour_glass.dart index d61516a..bc8af35 100644 --- a/lib/src/hour_glass.dart +++ b/lib/src/hour_glass.dart @@ -20,8 +20,7 @@ class SpinKitHourGlass extends StatefulWidget { State createState() => _SpinKitHourGlassState(); } -class _SpinKitHourGlassState extends State - with SingleTickerProviderStateMixin { +class _SpinKitHourGlassState extends State with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _animation; @@ -29,8 +28,7 @@ class _SpinKitHourGlassState extends State void initState() { super.initState(); - _controller = (widget.controller ?? - AnimationController(vsync: this, duration: widget.duration)) + _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) ..addListener(() { if (mounted) { setState(() {}); diff --git a/lib/src/piano_wave.dart b/lib/src/piano_wave.dart index 766f20a..7b9322a 100644 --- a/lib/src/piano_wave.dart +++ b/lib/src/piano_wave.dart @@ -15,8 +15,7 @@ class SpinKitPianoWave extends StatefulWidget { this.duration = const Duration(milliseconds: 1200), this.controller, }) : assert( - !(itemBuilder is IndexedWidgetBuilder && color is Color) && - !(itemBuilder == null && color == null), + !(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), 'You should specify either a itemBuilder or a color', ), assert(itemCount >= 2, 'itemCount Cant be less then 2 '), @@ -34,17 +33,14 @@ class SpinKitPianoWave extends StatefulWidget { State createState() => _SpinKitPianoWaveState(); } -class _SpinKitPianoWaveState extends State - with SingleTickerProviderStateMixin { +class _SpinKitPianoWaveState extends State with SingleTickerProviderStateMixin { late AnimationController _controller; @override void initState() { super.initState(); - _controller = (widget.controller ?? - AnimationController(vsync: this, duration: widget.duration)) - ..repeat(); + _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration))..repeat(); } @override diff --git a/lib/src/pouring_hour_glass.dart b/lib/src/pouring_hour_glass.dart index 774830e..0a123f9 100644 --- a/lib/src/pouring_hour_glass.dart +++ b/lib/src/pouring_hour_glass.dart @@ -19,12 +19,10 @@ class SpinKitPouringHourGlass extends StatefulWidget { final AnimationController? controller; @override - State createState() => - _SpinKitPouringHourGlassState(); + State createState() => _SpinKitPouringHourGlassState(); } -class _SpinKitPouringHourGlassState extends State - with SingleTickerProviderStateMixin { +class _SpinKitPouringHourGlassState extends State with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _pouringAnimation; late Animation _rotationAnimation; @@ -33,8 +31,7 @@ class _SpinKitPouringHourGlassState extends State void initState() { super.initState(); - _controller = (widget.controller ?? - AnimationController(vsync: this, duration: widget.duration)) + _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) ..addListener(() { if (mounted) { setState(() {}); diff --git a/lib/src/pouring_hour_glass_refined.dart b/lib/src/pouring_hour_glass_refined.dart index 4cddcc2..4fbcb02 100644 --- a/lib/src/pouring_hour_glass_refined.dart +++ b/lib/src/pouring_hour_glass_refined.dart @@ -19,12 +19,10 @@ class SpinKitPouringHourGlassRefined extends StatefulWidget { final AnimationController? controller; @override - State createState() => - _SpinKitPouringHourGlassRefinedState(); + State createState() => _SpinKitPouringHourGlassRefinedState(); } -class _SpinKitPouringHourGlassRefinedState - extends State +class _SpinKitPouringHourGlassRefinedState extends State with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _pouringAnimation; @@ -34,8 +32,7 @@ class _SpinKitPouringHourGlassRefinedState void initState() { super.initState(); - _controller = (widget.controller ?? - AnimationController(vsync: this, duration: widget.duration)) + _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) ..addListener(() { if (mounted) { setState(() {}); diff --git a/lib/src/pulse.dart b/lib/src/pulse.dart index f6ccd73..fb152b7 100644 --- a/lib/src/pulse.dart +++ b/lib/src/pulse.dart @@ -9,8 +9,7 @@ class SpinKitPulse extends StatefulWidget { this.duration = const Duration(seconds: 1), this.controller, }) : assert( - !(itemBuilder is IndexedWidgetBuilder && color is Color) && - !(itemBuilder == null && color == null), + !(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), 'You should specify either a itemBuilder or a color', ), super(key: key); @@ -25,8 +24,7 @@ class SpinKitPulse extends StatefulWidget { State createState() => _SpinKitPulseState(); } -class _SpinKitPulseState extends State - with SingleTickerProviderStateMixin { +class _SpinKitPulseState extends State with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _animation; @@ -34,8 +32,7 @@ class _SpinKitPulseState extends State void initState() { super.initState(); - _controller = (widget.controller ?? - AnimationController(vsync: this, duration: widget.duration)) + _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) ..addListener(() { if (mounted) { setState(() {}); diff --git a/lib/src/pulsing_grid.dart b/lib/src/pulsing_grid.dart index 5eeb111..f5f328f 100644 --- a/lib/src/pulsing_grid.dart +++ b/lib/src/pulsing_grid.dart @@ -12,8 +12,7 @@ class SpinKitPulsingGrid extends StatefulWidget { this.boxShape, this.controller, }) : assert( - !(itemBuilder is IndexedWidgetBuilder && color is Color) && - !(itemBuilder == null && color == null), + !(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), 'You should specify either a itemBuilder or a color', ), super(key: key); @@ -29,8 +28,7 @@ class SpinKitPulsingGrid extends StatefulWidget { State createState() => _SpinKitPulsingGridState(); } -class _SpinKitPulsingGridState extends State - with SingleTickerProviderStateMixin { +class _SpinKitPulsingGridState extends State with SingleTickerProviderStateMixin { static const _gridCount = 3; late AnimationController _controller; @@ -39,9 +37,7 @@ class _SpinKitPulsingGridState extends State void initState() { super.initState(); - _controller = (widget.controller ?? - AnimationController(vsync: this, duration: widget.duration)) - ..repeat(); + _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration))..repeat(); } @override diff --git a/lib/src/pumping_heart.dart b/lib/src/pumping_heart.dart index e3fad8f..29b68ef 100644 --- a/lib/src/pumping_heart.dart +++ b/lib/src/pumping_heart.dart @@ -12,8 +12,7 @@ class SpinKitPumpingHeart extends StatefulWidget { this.duration = const Duration(milliseconds: 2400), this.controller, }) : assert( - !(itemBuilder is IndexedWidgetBuilder && color is Color) && - !(itemBuilder == null && color == null), + !(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), 'You should specify either a itemBuilder or a color', ), super(key: key); @@ -28,8 +27,7 @@ class SpinKitPumpingHeart extends StatefulWidget { State createState() => _SpinKitPumpingHeartState(); } -class _SpinKitPumpingHeartState extends State - with SingleTickerProviderStateMixin { +class _SpinKitPumpingHeartState extends State with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _animation; @@ -37,9 +35,7 @@ class _SpinKitPumpingHeartState extends State void initState() { super.initState(); - _controller = (widget.controller ?? - AnimationController(vsync: this, duration: widget.duration)) - ..repeat(); + _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration))..repeat(); _animation = Tween(begin: 1.0, end: 1.25).animate( CurvedAnimation( parent: _controller, diff --git a/lib/src/ring.dart b/lib/src/ring.dart index a682df7..d032dcb 100644 --- a/lib/src/ring.dart +++ b/lib/src/ring.dart @@ -22,8 +22,7 @@ class SpinKitRing extends StatefulWidget { State createState() => _SpinKitRingState(); } -class _SpinKitRingState extends State - with SingleTickerProviderStateMixin { +class _SpinKitRingState extends State with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _animation1; late Animation _animation2; @@ -33,8 +32,7 @@ class _SpinKitRingState extends State void initState() { super.initState(); - _controller = (widget.controller ?? - AnimationController(vsync: this, duration: widget.duration)) + _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) ..addListener(() { if (mounted) { setState(() {}); @@ -73,8 +71,7 @@ class _SpinKitRingState extends State Widget build(BuildContext context) { return Center( child: Transform( - transform: Matrix4.identity() - ..rotateZ((_animation1.value) * 5 * pi / 6), + transform: Matrix4.identity()..rotateZ((_animation1.value) * 5 * pi / 6), alignment: FractionalOffset.center, child: SizedBox.fromSize( size: Size.square(widget.size), diff --git a/lib/src/ripple.dart b/lib/src/ripple.dart index d78b076..7e4f831 100644 --- a/lib/src/ripple.dart +++ b/lib/src/ripple.dart @@ -10,8 +10,7 @@ class SpinKitRipple extends StatefulWidget { this.duration = const Duration(milliseconds: 1800), this.controller, }) : assert( - !(itemBuilder is IndexedWidgetBuilder && color is Color) && - !(itemBuilder == null && color == null), + !(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), 'You should specify either a itemBuilder or a color', ), super(key: key); @@ -27,8 +26,7 @@ class SpinKitRipple extends StatefulWidget { State createState() => _SpinKitRippleState(); } -class _SpinKitRippleState extends State - with SingleTickerProviderStateMixin { +class _SpinKitRippleState extends State with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _animation1; late Animation _animation2; @@ -37,8 +35,7 @@ class _SpinKitRippleState extends State void initState() { super.initState(); - _controller = (widget.controller ?? - AnimationController(vsync: this, duration: widget.duration)) + _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) ..addListener(() { if (mounted) { setState(() {}); diff --git a/lib/src/rotating_circle.dart b/lib/src/rotating_circle.dart index 4b808eb..6aa590e 100644 --- a/lib/src/rotating_circle.dart +++ b/lib/src/rotating_circle.dart @@ -9,8 +9,7 @@ class SpinKitRotatingCircle extends StatefulWidget { this.duration = const Duration(milliseconds: 1200), this.controller, }) : assert( - !(itemBuilder is IndexedWidgetBuilder && color is Color) && - !(itemBuilder == null && color == null), + !(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), 'You should specify either a itemBuilder or a color', ), super(key: key); @@ -25,8 +24,7 @@ class SpinKitRotatingCircle extends StatefulWidget { State createState() => _SpinKitRotatingCircleState(); } -class _SpinKitRotatingCircleState extends State - with SingleTickerProviderStateMixin { +class _SpinKitRotatingCircleState extends State with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _animation1; late Animation _animation2; @@ -35,8 +33,7 @@ class _SpinKitRotatingCircleState extends State void initState() { super.initState(); - _controller = (widget.controller ?? - AnimationController(vsync: this, duration: widget.duration)) + _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) ..addListener(() { if (mounted) { setState(() {}); diff --git a/lib/src/rotating_plain.dart b/lib/src/rotating_plain.dart index 626cd96..e15340d 100644 --- a/lib/src/rotating_plain.dart +++ b/lib/src/rotating_plain.dart @@ -9,8 +9,7 @@ class SpinKitRotatingPlain extends StatefulWidget { this.duration = const Duration(milliseconds: 1200), this.controller, }) : assert( - !(itemBuilder is IndexedWidgetBuilder && color is Color) && - !(itemBuilder == null && color == null), + !(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), 'You should specify either a itemBuilder or a color', ), super(key: key); @@ -25,8 +24,7 @@ class SpinKitRotatingPlain extends StatefulWidget { State createState() => _SpinKitRotatingPlainState(); } -class _SpinKitRotatingPlainState extends State - with SingleTickerProviderStateMixin { +class _SpinKitRotatingPlainState extends State with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _animation1; late Animation _animation2; @@ -35,8 +33,7 @@ class _SpinKitRotatingPlainState extends State void initState() { super.initState(); - _controller = (widget.controller ?? - AnimationController(vsync: this, duration: widget.duration)) + _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) ..addListener(() { if (mounted) { setState(() {}); diff --git a/lib/src/spinning_circle.dart b/lib/src/spinning_circle.dart index c61c878..33315f6 100644 --- a/lib/src/spinning_circle.dart +++ b/lib/src/spinning_circle.dart @@ -12,8 +12,7 @@ class SpinKitSpinningCircle extends StatefulWidget { this.duration = const Duration(milliseconds: 1200), this.controller, }) : assert( - !(itemBuilder is IndexedWidgetBuilder && color is Color) && - !(itemBuilder == null && color == null), + !(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), 'You should specify either a itemBuilder or a color', ), super(key: key); @@ -29,8 +28,7 @@ class SpinKitSpinningCircle extends StatefulWidget { State createState() => _SpinKitSpinningCircleState(); } -class _SpinKitSpinningCircleState extends State - with SingleTickerProviderStateMixin { +class _SpinKitSpinningCircleState extends State with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _animation; @@ -38,8 +36,7 @@ class _SpinKitSpinningCircleState extends State void initState() { super.initState(); - _controller = (widget.controller ?? - AnimationController(vsync: this, duration: widget.duration)) + _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) ..addListener(() { if (mounted) { setState(() {}); diff --git a/lib/src/spinning_lines.dart b/lib/src/spinning_lines.dart index 2adc7e3..472d87f 100644 --- a/lib/src/spinning_lines.dart +++ b/lib/src/spinning_lines.dart @@ -27,8 +27,7 @@ class SpinKitSpinningLines extends StatefulWidget { State createState() => _SpinKitSpinningLinesState(); } -class _SpinKitSpinningLinesState extends State - with SingleTickerProviderStateMixin { +class _SpinKitSpinningLinesState extends State with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _animation; @@ -36,8 +35,7 @@ class _SpinKitSpinningLinesState extends State void initState() { super.initState(); - _controller = (widget.controller ?? - AnimationController(vsync: this, duration: widget.duration)) + _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) ..addListener(() { if (mounted) { setState(() {}); @@ -149,8 +147,7 @@ class SpinningLinesPainter extends CustomPainter { /// I use the following resource to calculate rotation of the canvas /// https://stackoverflow.com/a/54336099/9689717 void _rotateCanvas(Canvas canvas, Size size, double angle) { - final double r = - sqrt(size.width * size.width + size.height * size.height) / 2; + final double r = sqrt(size.width * size.width + size.height * size.height) / 2; final alpha = atan(size.height / size.width); final beta = alpha + angle; final shiftY = r * sin(beta); diff --git a/lib/src/square_circle.dart b/lib/src/square_circle.dart index eeae87c..65711ca 100644 --- a/lib/src/square_circle.dart +++ b/lib/src/square_circle.dart @@ -11,8 +11,7 @@ class SpinKitSquareCircle extends StatefulWidget { this.duration = const Duration(milliseconds: 500), this.controller, }) : assert( - !(itemBuilder is IndexedWidgetBuilder && color is Color) && - !(itemBuilder == null && color == null), + !(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), 'You should specify either a itemBuilder or a color', ), super(key: key); @@ -27,8 +26,7 @@ class SpinKitSquareCircle extends StatefulWidget { State createState() => _SpinKitSquareCircleState(); } -class _SpinKitSquareCircleState extends State - with SingleTickerProviderStateMixin { +class _SpinKitSquareCircleState extends State with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _animationCurve; late Animation _animationSize; @@ -37,8 +35,7 @@ class _SpinKitSquareCircleState extends State void initState() { super.initState(); - _controller = (widget.controller ?? - AnimationController(vsync: this, duration: widget.duration)) + _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration)) ..addListener(() { if (mounted) { setState(() {}); diff --git a/lib/src/three_bounce.dart b/lib/src/three_bounce.dart index c110808..a4e1979 100644 --- a/lib/src/three_bounce.dart +++ b/lib/src/three_bounce.dart @@ -10,8 +10,7 @@ class SpinKitThreeBounce extends StatefulWidget { this.duration = const Duration(milliseconds: 1400), this.controller, }) : assert( - !(itemBuilder is IndexedWidgetBuilder && color is Color) && - !(itemBuilder == null && color == null), + !(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), 'You should specify either a itemBuilder or a color', ), super(key: key); @@ -26,17 +25,14 @@ class SpinKitThreeBounce extends StatefulWidget { State createState() => _SpinKitThreeBounceState(); } -class _SpinKitThreeBounceState extends State - with SingleTickerProviderStateMixin { +class _SpinKitThreeBounceState extends State with SingleTickerProviderStateMixin { late AnimationController _controller; @override void initState() { super.initState(); - _controller = (widget.controller ?? - AnimationController(vsync: this, duration: widget.duration)) - ..repeat(); + _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration))..repeat(); } @override diff --git a/lib/src/three_in_out.dart b/lib/src/three_in_out.dart index e4ea5e2..d37d847 100644 --- a/lib/src/three_in_out.dart +++ b/lib/src/three_in_out.dart @@ -13,8 +13,7 @@ class SpinKitThreeInOut extends StatefulWidget { this.delay = const Duration(milliseconds: 50), this.controller, }) : assert( - !(itemBuilder is IndexedWidgetBuilder && color is Color) && - !(itemBuilder == null && color == null), + !(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), 'You should specify either a itemBuilder or a color', ), super(key: key); @@ -30,8 +29,7 @@ class SpinKitThreeInOut extends StatefulWidget { State createState() => _SpinKitThreeInOutState(); } -class _SpinKitThreeInOutState extends State - with SingleTickerProviderStateMixin { +class _SpinKitThreeInOutState extends State with SingleTickerProviderStateMixin { late AnimationController? _controller; late List _widgets; @@ -53,8 +51,7 @@ class _SpinKitThreeInOutState extends State ), ); - _controller = widget.controller ?? - AnimationController(vsync: this, duration: widget.duration); + _controller = widget.controller ?? AnimationController(vsync: this, duration: widget.duration); _controller!.forward(); diff --git a/lib/src/wandering_cubes.dart b/lib/src/wandering_cubes.dart index 9e833c7..19ef16c 100644 --- a/lib/src/wandering_cubes.dart +++ b/lib/src/wandering_cubes.dart @@ -9,8 +9,7 @@ class SpinKitWanderingCubes extends StatefulWidget { this.itemBuilder, this.duration = const Duration(milliseconds: 1800), }) : assert( - !(itemBuilder is IndexedWidgetBuilder && color is Color) && - !(itemBuilder == null && color == null), + !(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), 'You should specify either a itemBuilder or a color', ), offset = size * 0.75, @@ -27,8 +26,7 @@ class SpinKitWanderingCubes extends StatefulWidget { State createState() => _SpinKitWanderingCubesState(); } -class _SpinKitWanderingCubesState extends State - with SingleTickerProviderStateMixin { +class _SpinKitWanderingCubesState extends State with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _scale1; late Animation _scale2; diff --git a/lib/src/wave.dart b/lib/src/wave.dart index 07923f9..24b2ec3 100644 --- a/lib/src/wave.dart +++ b/lib/src/wave.dart @@ -14,8 +14,7 @@ class SpinKitWave extends StatefulWidget { this.duration = const Duration(milliseconds: 1200), this.controller, }) : assert( - !(itemBuilder is IndexedWidgetBuilder && color is Color) && - !(itemBuilder == null && color == null), + !(itemBuilder is IndexedWidgetBuilder && color is Color) && !(itemBuilder == null && color == null), 'You should specify either a itemBuilder or a color', ), assert(itemCount >= 2, 'itemCount Cant be less then 2 '), @@ -33,17 +32,14 @@ class SpinKitWave extends StatefulWidget { State createState() => _SpinKitWaveState(); } -class _SpinKitWaveState extends State - with SingleTickerProviderStateMixin { +class _SpinKitWaveState extends State with SingleTickerProviderStateMixin { late AnimationController _controller; @override void initState() { super.initState(); - _controller = (widget.controller ?? - AnimationController(vsync: this, duration: widget.duration)) - ..repeat(); + _controller = (widget.controller ?? AnimationController(vsync: this, duration: widget.duration))..repeat(); } @override diff --git a/lib/src/wave_spinner.dart b/lib/src/wave_spinner.dart index 1bd5f4e..66019bc 100644 --- a/lib/src/wave_spinner.dart +++ b/lib/src/wave_spinner.dart @@ -28,17 +28,14 @@ class SpinKitWaveSpinner extends StatefulWidget { State createState() => _SpinKitWaveSpinnerState(); } -class _SpinKitWaveSpinnerState extends State - with SingleTickerProviderStateMixin { +class _SpinKitWaveSpinnerState extends State with SingleTickerProviderStateMixin { late final AnimationController _controller; @override void initState() { super.initState(); - _controller = (widget.controller ?? - AnimationController(duration: widget.duration, vsync: this)) - ..repeat(); + _controller = (widget.controller ?? AnimationController(duration: widget.duration, vsync: this))..repeat(); } @override