diff --git a/.gitignore b/.gitignore index 59ab426..208172b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,34 @@ +# 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/ + +# Custom +.pub/ coverage/ -ios/.generated/ -ios/Flutter/Generated.xcconfig -ios/Runner/GeneratedPluginRegistrant.* 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/example/pubspec.lock b/example/pubspec.lock index 8cc0d52..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: @@ -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 @@ -94,10 +94,10 @@ packages: dependency: transitive description: name: matcher - sha256: c94db23593b89766cda57aab9ac311e3616cf87c6fa4e9749df032f66f30dcb8 + sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb" url: "https://pub.dev" source: hosted - version: "0.12.14" + version: "0.12.15" material_color_utilities: dependency: transitive description: @@ -110,10 +110,10 @@ packages: dependency: transitive description: name: meta - sha256: "12307e7f0605ce3da64cf0db90e5fcab0869f3ca03f76be6bb2991ce0a55e82b" + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.9.1" path: dependency: transitive description: @@ -171,10 +171,10 @@ packages: dependency: transitive description: name: test_api - sha256: "6182294da5abf431177fccc1ee02401f6df30f766bc6130a0852c6b6d7ee6b2d" + sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb url: "https://pub.dev" source: hosted - version: "0.4.18" + version: "0.5.1" 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: ">=3.0.0-0 <4.0.0" flutter: ">=2.0.0" diff --git a/lib/src/chasing_dots.dart b/lib/src/chasing_dots.dart index 6f9ae52..8f8ba56 100644 --- a/lib/src/chasing_dots.dart +++ b/lib/src/chasing_dots.dart @@ -7,8 +7,10 @@ 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; @@ -37,12 +39,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 +83,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..9089fd9 100644 --- a/lib/src/circle.dart +++ b/lib/src/circle.dart @@ -9,8 +9,10 @@ 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; @@ -59,8 +61,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 +82,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..51cc336 100644 --- a/lib/src/cube_grid.dart +++ b/lib/src/cube_grid.dart @@ -8,8 +8,10 @@ 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; @@ -36,16 +38,36 @@ class _SpinKitCubeGridState extends State with SingleTickerProv _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 +121,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..8bc64b4 100644 --- a/lib/src/dancing_square.dart +++ b/lib/src/dancing_square.dart @@ -10,8 +10,10 @@ 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; @@ -63,7 +65,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 +86,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 +107,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 +128,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 +152,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..76aee36 100644 --- a/lib/src/double_bounce.dart +++ b/lib/src/double_bounce.dart @@ -8,8 +8,10 @@ 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; @@ -37,7 +39,9 @@ class _SpinKitDoubleBounceState extends State with SingleTi } }) ..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 +59,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 +71,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..365e41e 100644 --- a/lib/src/dual_ring.dart +++ b/lib/src/dual_ring.dart @@ -37,8 +37,12 @@ class _SpinKitDualRingState extends State with SingleTickerProv } }) ..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 @@ -56,7 +60,11 @@ class _SpinKitDualRingState extends State with SingleTickerProv 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 +73,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..2441b85 100644 --- a/lib/src/fading_circle.dart +++ b/lib/src/fading_circle.dart @@ -9,8 +9,10 @@ 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; @@ -59,8 +61,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 +82,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..d7fcdf8 100644 --- a/lib/src/fading_cube.dart +++ b/lib/src/fading_cube.dart @@ -9,8 +9,10 @@ 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; @@ -63,8 +65,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..bbb858a 100644 --- a/lib/src/fading_four.dart +++ b/lib/src/fading_four.dart @@ -10,8 +10,10 @@ 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; @@ -60,8 +62,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 +83,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..1ad7453 100644 --- a/lib/src/fading_grid.dart +++ b/lib/src/fading_grid.dart @@ -10,8 +10,10 @@ 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; @@ -105,7 +107,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 +121,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..7af9ae9 100644 --- a/lib/src/folding_cube.dart +++ b/lib/src/folding_cube.dart @@ -10,8 +10,10 @@ 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; @@ -57,11 +59,23 @@ class _SpinKitFoldingCubeState extends State with TickerProv _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), ]); diff --git a/lib/src/hour_glass.dart b/lib/src/hour_glass.dart index 14cee0e..bc8af35 100644 --- a/lib/src/hour_glass.dart +++ b/lib/src/hour_glass.dart @@ -35,8 +35,12 @@ class _SpinKitHourGlassState extends State with SingleTickerPr } }) ..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..7b9322a 100644 --- a/lib/src/piano_wave.dart +++ b/lib/src/piano_wave.dart @@ -14,8 +14,10 @@ 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); @@ -59,7 +61,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 +91,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 +105,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 +119,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..0a123f9 100644 --- a/lib/src/pouring_hour_glass.dart +++ b/lib/src/pouring_hour_glass.dart @@ -38,10 +38,16 @@ class _SpinKitPouringHourGlassState extends State with } }) ..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 +115,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 +136,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..4fbcb02 100644 --- a/lib/src/pouring_hour_glass_refined.dart +++ b/lib/src/pouring_hour_glass_refined.dart @@ -39,10 +39,16 @@ 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 +113,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 +137,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 +159,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 +180,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..fb152b7 100644 --- a/lib/src/pulse.dart +++ b/lib/src/pulse.dart @@ -8,8 +8,10 @@ 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; @@ -66,5 +68,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..f5f328f 100644 --- a/lib/src/pulsing_grid.dart +++ b/lib/src/pulsing_grid.dart @@ -11,8 +11,10 @@ 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; @@ -70,10 +72,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 +94,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..29b68ef 100644 --- a/lib/src/pumping_heart.dart +++ b/lib/src/pumping_heart.dart @@ -11,8 +11,10 @@ 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; @@ -34,8 +36,12 @@ class _SpinKitPumpingHeartState extends State with SingleTi 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()))); + _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..d032dcb 100644 --- a/lib/src/ring.dart +++ b/lib/src/ring.dart @@ -39,12 +39,24 @@ class _SpinKitRingState extends State with SingleTickerProviderStat } }) ..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 diff --git a/lib/src/ripple.dart b/lib/src/ripple.dart index c7ec0bd..7e4f831 100644 --- a/lib/src/ripple.dart +++ b/lib/src/ripple.dart @@ -9,8 +9,10 @@ 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; @@ -40,10 +42,18 @@ class _SpinKitRippleState extends State with SingleTickerProvider } }) ..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 +71,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 +96,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..6aa590e 100644 --- a/lib/src/rotating_circle.dart +++ b/lib/src/rotating_circle.dart @@ -8,8 +8,10 @@ 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; @@ -38,10 +40,18 @@ class _SpinKitRotatingCircleState extends State with Sing } }) ..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 +70,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..e15340d 100644 --- a/lib/src/rotating_plain.dart +++ b/lib/src/rotating_plain.dart @@ -8,8 +8,10 @@ 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; @@ -38,10 +40,18 @@ class _SpinKitRotatingPlainState extends State with Single } }) ..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..33315f6 100644 --- a/lib/src/spinning_circle.dart +++ b/lib/src/spinning_circle.dart @@ -11,8 +11,10 @@ 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; @@ -41,8 +43,12 @@ class _SpinKitSpinningCircleState extends State with Sing } }) ..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 +75,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..472d87f 100644 --- a/lib/src/spinning_lines.dart +++ b/lib/src/spinning_lines.dart @@ -161,9 +161,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..65711ca 100644 --- a/lib/src/square_circle.dart +++ b/lib/src/square_circle.dart @@ -10,8 +10,10 @@ 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; @@ -40,7 +42,10 @@ class _SpinKitSquareCircleState extends State with SingleTi } }) ..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 +73,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..a4e1979 100644 --- a/lib/src/three_bounce.dart +++ b/lib/src/three_bounce.dart @@ -9,8 +9,10 @@ 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; @@ -50,8 +52,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 +70,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..d37d847 100644 --- a/lib/src/three_in_out.dart +++ b/lib/src/three_in_out.dart @@ -12,8 +12,10 @@ 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; @@ -63,7 +65,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 +119,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..19ef16c 100644 --- a/lib/src/wandering_cubes.dart +++ b/lib/src/wandering_cubes.dart @@ -8,8 +8,10 @@ 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); @@ -48,23 +50,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 +145,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..24b2ec3 100644 --- a/lib/src/wave.dart +++ b/lib/src/wave.dart @@ -13,8 +13,10 @@ 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); @@ -58,8 +60,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 +90,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 +104,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 +118,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 +150,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..66019bc 100644 --- a/lib/src/wave_spinner.dart +++ b/lib/src/wave_spinner.dart @@ -48,32 +48,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 +100,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 +165,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 +187,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 +211,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/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" 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..30b4742 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: const SingleChildScrollView( + child: Column( + children: [ + 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();