Skip to content

Commit

Permalink
v5.2.0 (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
jogboms authored May 1, 2023
2 parents bd5827f + 9397db0 commit 4211f37
Show file tree
Hide file tree
Showing 38 changed files with 151 additions and 142 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ jobs:
- uses: actions/setup-java@v1
with:
java-version: "12.x"
- uses: subosito/flutter-action@v1
- uses: subosito/flutter-action@v2
with:
channel: "dev"
cache: true
channel: 'stable'
- run: flutter doctor
- run: flutter pub get
- run: flutter format --set-exit-if-changed -l 120 lib -l 120 example
- run: flutter analyze lib example
Expand All @@ -31,4 +33,4 @@ jobs:
- name: Upload coverage to codecov
uses: codecov/codecov-action@v1
with:
fail_ci_if_error: true
fail_ci_if_error: true
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

A collection of loading indicators animated with flutter. Heavily inspired by @tobiasahlin's SpinKit.

## 5.2.0

- Fix `SpinKitCircle`, `SpinKitFadingCircle`, `SpinKitDancingSquare` animation
- Fix calling `setState` on unmounted states
- Introduced [SpinKitWaveSpinner]
- Introduced [SpinKitPulsingGrid]

## 5.1.0

- Renamed `SpinKitPouringHourglass` -> `SpinKitPouringHourGlass` for correctness
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ A collection of loading indicators animated with flutter. Heavily inspired by [@

```yaml
dependencies:
flutter_spinkit: ^5.1.0
flutter_spinkit: ^5.2.0
```
### ⚡️ Import
Expand Down
6 changes: 2 additions & 4 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
include: package:flutter_lints/flutter.yaml

analyzer:
strong-mode:
implicit-casts: false
implicit-dynamic: false
errors:
missing_required_param: error
missing_return: error
Expand Down Expand Up @@ -40,4 +37,5 @@ linter:
- unnecessary_statements
- use_late_for_private_fields_and_variables
- use_named_constants
- use_raw_strings
- use_raw_strings
- use_super_parameters
2 changes: 1 addition & 1 deletion lib/src/chasing_dots.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SpinKitChasingDots extends StatefulWidget {
final Duration duration;

@override
_SpinKitChasingDotsState createState() => _SpinKitChasingDotsState();
State<SpinKitChasingDots> createState() => _SpinKitChasingDotsState();
}

class _SpinKitChasingDotsState extends State<SpinKitChasingDots> with TickerProviderStateMixin {
Expand Down
15 changes: 8 additions & 7 deletions lib/src/circle.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ class SpinKitCircle extends StatefulWidget {
final AnimationController? controller;

@override
_SpinKitCircleState createState() => _SpinKitCircleState();
State<SpinKitCircle> createState() => _SpinKitCircleState();
}

class _SpinKitCircleState extends State<SpinKitCircle> with SingleTickerProviderStateMixin {
final List<double> delays = [.0, -1.1, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1];
static const _itemCount = 12;

late AnimationController _controller;

@override
Expand All @@ -48,17 +49,17 @@ class _SpinKitCircleState extends State<SpinKitCircle> with SingleTickerProvider
child: SizedBox.fromSize(
size: Size.square(widget.size),
child: Stack(
children: List.generate(delays.length, (index) {
final _position = widget.size * .5;
children: List.generate(_itemCount, (index) {
final position = widget.size * .5;
return Positioned.fill(
left: _position,
top: _position,
left: position,
top: position,
child: Transform(
transform: Matrix4.rotationZ(30.0 * index * 0.0174533),
child: Align(
alignment: Alignment.center,
child: ScaleTransition(
scale: DelayTween(begin: 0.0, end: 1.0, delay: delays[index]).animate(_controller),
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)),
),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/src/cube_grid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class SpinKitCubeGrid extends StatefulWidget {
final AnimationController? controller;

@override
_SpinKitCubeGridState createState() => _SpinKitCubeGridState();
State<SpinKitCubeGrid> createState() => _SpinKitCubeGridState();
}

class _SpinKitCubeGridState extends State<SpinKitCubeGrid> with SingleTickerProviderStateMixin {
Expand Down
34 changes: 18 additions & 16 deletions lib/src/dancing_square.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ class SpinKitDancingSquare extends StatefulWidget {
final AnimationController? controller;

@override
_SpinKitDancingSquareState createState() => _SpinKitDancingSquareState();
State<SpinKitDancingSquare> createState() => _SpinKitDancingSquareState();
}

class _SpinKitDancingSquareState extends State<SpinKitDancingSquare> with SingleTickerProviderStateMixin {
final List<double> delays = [.0, -1.1, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1];
static const _itemCount = 12;

late AnimationController _controller;

@override
Expand All @@ -49,19 +50,20 @@ class _SpinKitDancingSquareState extends State<SpinKitDancingSquare> with Single
child: SizedBox.fromSize(
size: Size.square(widget.size),
child: Stack(
children: List.generate(delays.length, (index) {
final _position = widget.size * .5;
children: List.generate(_itemCount, (index) {
final position = widget.size * .5;
final delay = index / _itemCount;
return Stack(
children: [
Positioned.fill(
left: _position,
top: _position,
left: position,
top: position,
child: Transform(
transform: Matrix4.rotationX(30.0 * index * 0.0174533),
child: Align(
alignment: Alignment.center,
child: ScaleTransition(
scale: DelayTween(begin: 0.0, end: 1.0, delay: delays[index]).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),
Expand All @@ -71,14 +73,14 @@ class _SpinKitDancingSquareState extends State<SpinKitDancingSquare> with Single
),
),
Positioned.fill(
left: _position,
top: -1 * _position,
left: position,
top: -1 * position,
child: Transform(
transform: Matrix4.rotationY(30.0 * index * 0.0174533),
child: Align(
alignment: Alignment.center,
child: ScaleTransition(
scale: DelayTween(begin: 0.0, end: 1.0, delay: delays[index]).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),
Expand All @@ -88,14 +90,14 @@ class _SpinKitDancingSquareState extends State<SpinKitDancingSquare> with Single
),
),
Positioned.fill(
left: -1 * _position,
top: _position,
left: -1 * position,
top: position,
child: Transform(
transform: Matrix4.rotationX(30.0 * index * 0.0174533),
child: Align(
alignment: Alignment.center,
child: ScaleTransition(
scale: DelayTween(begin: 0.0, end: 1.0, delay: delays[index]).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),
Expand All @@ -105,14 +107,14 @@ class _SpinKitDancingSquareState extends State<SpinKitDancingSquare> with Single
),
),
Positioned.fill(
left: _position,
top: _position,
left: position,
top: position,
child: Transform(
transform: Matrix4.rotationY(30.0 * index * 0.0174533),
child: Align(
alignment: Alignment.center,
child: ScaleTransition(
scale: DelayTween(begin: 0.0, end: 1.0, delay: delays[index]).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),
Expand Down
2 changes: 1 addition & 1 deletion lib/src/double_bounce.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class SpinKitDoubleBounce extends StatefulWidget {
final AnimationController? controller;

@override
_SpinKitDoubleBounceState createState() => _SpinKitDoubleBounceState();
State<SpinKitDoubleBounce> createState() => _SpinKitDoubleBounceState();
}

class _SpinKitDoubleBounceState extends State<SpinKitDoubleBounce> with SingleTickerProviderStateMixin {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/dual_ring.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class SpinKitDualRing extends StatefulWidget {
final AnimationController? controller;

@override
_SpinKitDualRingState createState() => _SpinKitDualRingState();
State<SpinKitDualRing> createState() => _SpinKitDualRingState();
}

class _SpinKitDualRingState extends State<SpinKitDualRing> with SingleTickerProviderStateMixin {
Expand Down Expand Up @@ -56,8 +56,8 @@ class _SpinKitDualRingState extends State<SpinKitDualRing> with SingleTickerProv
transform: Matrix4.identity()..rotateZ((_animation.value) * math.pi * 2),
alignment: FractionalOffset.center,
child: CustomPaint(
child: SizedBox.fromSize(size: Size.square(widget.size)),
painter: _DualRingPainter(angle: 90, paintWidth: widget.lineWidth, color: widget.color),
child: SizedBox.fromSize(size: Size.square(widget.size)),
),
),
);
Expand Down
14 changes: 8 additions & 6 deletions lib/src/fading_circle.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ class SpinKitFadingCircle extends StatefulWidget {
final AnimationController? controller;

@override
_SpinKitFadingCircleState createState() => _SpinKitFadingCircleState();
State<SpinKitFadingCircle> createState() => _SpinKitFadingCircleState();
}

class _SpinKitFadingCircleState extends State<SpinKitFadingCircle> with SingleTickerProviderStateMixin {
static const _itemCount = 12;

late AnimationController _controller;

@override
Expand All @@ -47,17 +49,17 @@ class _SpinKitFadingCircleState extends State<SpinKitFadingCircle> with SingleTi
child: SizedBox.fromSize(
size: Size.square(widget.size),
child: Stack(
children: List.generate(12, (i) {
final _position = widget.size * .5;
children: List.generate(_itemCount, (i) {
final position = widget.size * .5;
return Positioned.fill(
left: _position,
top: _position,
left: position,
top: position,
child: Transform(
transform: Matrix4.rotationZ(30.0 * i * 0.0174533),
child: Align(
alignment: Alignment.center,
child: FadeTransition(
opacity: DelayTween(begin: 0.0, end: 1.0, delay: i / 12).animate(_controller),
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)),
),
),
Expand Down
12 changes: 6 additions & 6 deletions lib/src/fading_cube.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class SpinKitFadingCube extends StatefulWidget {
final AnimationController? controller;

@override
_SpinKitFadingCubeState createState() => _SpinKitFadingCubeState();
State<SpinKitFadingCube> createState() => _SpinKitFadingCubeState();
}

class _SpinKitFadingCubeState extends State<SpinKitFadingCube> with SingleTickerProviderStateMixin {
Expand Down Expand Up @@ -51,20 +51,20 @@ class _SpinKitFadingCubeState extends State<SpinKitFadingCube> with SingleTicker
angle: -45.0 * 0.0174533,
child: Stack(
children: List.generate(4, (i) {
final _size = widget.size * 0.5, _position = widget.size * .5;
final size = widget.size * 0.5, position = widget.size * .5;
return Positioned.fill(
top: _position,
left: _position,
top: position,
left: position,
child: Transform.scale(
scale: 1.1,
origin: Offset(-_size * .5, -_size * .5),
origin: Offset(-size * .5, -size * .5),
child: Transform(
transform: Matrix4.rotationZ(90.0 * i * 0.0174533),
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)),
child: SizedBox.fromSize(size: Size.square(size), child: _itemBuilder(i)),
),
),
),
Expand Down
12 changes: 6 additions & 6 deletions lib/src/fading_four.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ class SpinKitFadingFour extends StatefulWidget {
final AnimationController? controller;

@override
_SpinKitFadingFourState createState() => _SpinKitFadingFourState();
State<SpinKitFadingFour> createState() => _SpinKitFadingFourState();
}

class _SpinKitFadingFourState extends State<SpinKitFadingFour> with SingleTickerProviderStateMixin {
final List<double> delays = [.0, -0.9, -0.6, -0.3];
static const List<double> _delays = [.0, -0.9, -0.6, -0.3];
late AnimationController _controller;

@override
Expand All @@ -51,16 +51,16 @@ class _SpinKitFadingFourState extends State<SpinKitFadingFour> with SingleTicker
size: Size.square(widget.size),
child: Stack(
children: List.generate(4, (i) {
final _position = widget.size * .5;
final position = widget.size * .5;
return Positioned.fill(
left: _position,
top: _position,
left: position,
top: position,
child: Transform(
transform: Matrix4.rotationZ(30.0 * (i * 3) * 0.0174533),
child: Align(
alignment: Alignment.center,
child: FadeTransition(
opacity: DelayTween(begin: 0.0, end: 1.0, delay: delays[i]).animate(_controller),
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)),
),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/src/fading_grid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class SpinKitFadingGrid extends StatefulWidget {
final AnimationController? controller;

@override
_SpinKitFadingGridState createState() => _SpinKitFadingGridState();
State<SpinKitFadingGrid> createState() => _SpinKitFadingGridState();
}

class _SpinKitFadingGridState extends State<SpinKitFadingGrid> with SingleTickerProviderStateMixin {
Expand Down
Loading

0 comments on commit 4211f37

Please sign in to comment.