Skip to content

Commit

Permalink
* Breaking Change
Browse files Browse the repository at this point in the history
  - Now, child is changes to required named parameter for animation wrappers
* update: example
  • Loading branch information
jagritjkh committed Jul 4, 2021
1 parent bec5115 commit 5053f23
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 27 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [1.0.0] - 2021-07-04

* Breaking Change
- Now, child is changes to required named parameter for animation wrappers
* update: example

## [0.0.5] - 2021-06-28

* fix: slideDurationInMilliseconds is now assigned to the animation
Expand Down
8 changes: 3 additions & 5 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import 'package:animation_wrappers/animation_wrappers.dart';
import 'package:flutter/material.dart';

void main() {
runApp(MyApp());
}
void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
@override
Expand All @@ -24,14 +22,14 @@ class AnimationWrappers extends StatelessWidget {
body: Column(
children: [
FadedScaleAnimation(
Container(
child: Container(
height: 200,
width: 200,
color: Colors.red,
),
),
FadedSlideAnimation(
Container(
child: Container(
height: 200,
width: 200,
color: Colors.blue,
Expand Down
8 changes: 4 additions & 4 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ packages:
path: ".."
relative: true
source: path
version: "0.0.3"
version: "0.0.5"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.0"
version: "2.6.1"
boolean_selector:
dependency: transitive
description:
Expand Down Expand Up @@ -106,7 +106,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
version: "1.8.1"
stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -141,7 +141,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.19"
version: "0.3.0"
typed_data:
dependency: transitive
description:
Expand Down
11 changes: 6 additions & 5 deletions lib/Animations/faded_scale_animation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ class FadedScaleAnimation extends StatefulWidget {
final int durationInMilliseconds;
final Curve curve;

FadedScaleAnimation(this.child,
FadedScaleAnimation(
{Key? key,
required this.child,
this.durationInMilliseconds = 400,
this.curve = Curves.decelerate})
: super(key: key);
Expand All @@ -24,7 +25,7 @@ class FadedScaleAnimation extends StatefulWidget {

class _FadedScaleAnimationState extends State<FadedScaleAnimation>
with SingleTickerProviderStateMixin {
AnimationController? controller;
late AnimationController controller;
late CurvedAnimation animation;

@override
Expand All @@ -36,13 +37,13 @@ class _FadedScaleAnimationState extends State<FadedScaleAnimation>
)..addListener(() {
setState(() {});
});
animation = CurvedAnimation(parent: controller!, curve: widget.curve);
controller!.forward();
animation = CurvedAnimation(parent: controller, curve: widget.curve);
controller.forward();
}

@override
void dispose() {
controller?.dispose();
controller.dispose();
super.dispose();
}

Expand Down
18 changes: 9 additions & 9 deletions lib/Animations/faded_slide_animation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class FadedSlideAnimation extends StatefulWidget {
final Curve curve;
final Curve slideCurve;

FadedSlideAnimation(
this.child, {
FadedSlideAnimation({
Key? key,
required this.child,
required this.beginOffset,
required this.endOffset,
this.durationInMilliseconds = 400,
Expand All @@ -35,9 +35,9 @@ class FadedSlideAnimation extends StatefulWidget {

class _FadedSlideAnimationState extends State<FadedSlideAnimation>
with TickerProviderStateMixin {
AnimationController? controller;
late AnimationController controller;
late CurvedAnimation animation;
AnimationController? slideController;
late AnimationController slideController;
late Animation<Offset> offsetAnimation;

@override
Expand All @@ -49,22 +49,22 @@ class _FadedSlideAnimationState extends State<FadedSlideAnimation>
)..addListener(() {
setState(() {});
});
animation = CurvedAnimation(parent: controller!, curve: widget.curve);
controller!.forward();
animation = CurvedAnimation(parent: controller, curve: widget.curve);
controller.forward();
slideController = AnimationController(
duration: Duration(milliseconds: widget.slideDurationInMilliseconds),
vsync: this,
)..forward();
offsetAnimation =
Tween<Offset>(begin: widget.beginOffset, end: widget.endOffset).animate(
CurvedAnimation(parent: slideController!, curve: widget.slideCurve),
CurvedAnimation(parent: slideController, curve: widget.slideCurve),
);
}

@override
void dispose() {
controller?.dispose();
slideController?.dispose();
controller.dispose();
slideController.dispose();
super.dispose();
}

Expand Down
6 changes: 3 additions & 3 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.0"
version: "2.6.1"
boolean_selector:
dependency: transitive
description:
Expand Down Expand Up @@ -92,7 +92,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
version: "1.8.1"
stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -127,7 +127,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.19"
version: "0.3.0"
typed_data:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: animation_wrappers
description: Animation Wrapper widgets, just wrap the child to be animated with this wrapper widget and that child will be animated.
version: 0.0.5
version: 1.0.0
homepage: https://github.com/jagritjkh/animation_wrappers

environment:
Expand Down

0 comments on commit 5053f23

Please sign in to comment.