final
This commit is contained in:
@@ -5,23 +5,23 @@ import 'popup_animation_widget.dart';
|
||||
|
||||
class AnimationPointManager {
|
||||
List<AnimatedWidget> list = [];
|
||||
static AnimationController controller1;
|
||||
static AnimationController controller2;
|
||||
static AnimationController? controller1;
|
||||
static AnimationController? controller2;
|
||||
|
||||
Future<void> addParabolicAniamtion({
|
||||
@required TickerProvider vsync,
|
||||
@required GlobalKey stackKey,
|
||||
@required GlobalKey startKey,
|
||||
@required GlobalKey endKey,
|
||||
@required Duration duration,
|
||||
@required AnimationStatusListener statusListener,
|
||||
required TickerProvider vsync,
|
||||
required GlobalKey stackKey,
|
||||
required GlobalKey startKey,
|
||||
required GlobalKey endKey,
|
||||
required Duration duration,
|
||||
required AnimationStatusListener statusListener,
|
||||
Color color = Colors.red,
|
||||
double size = 20,
|
||||
Offset startAdjustOffset = Offset.zero,
|
||||
Offset endAdjustOffset = Offset.zero,
|
||||
}) async {
|
||||
controller1 = createController(vsync, duration);
|
||||
Animation animation = createAnimation(controller1);
|
||||
Animation<double> animation = createAnimation(controller1);
|
||||
|
||||
AnimatedWidget animatedWidget = ParabolicAnimationWidget(
|
||||
animation: animation,
|
||||
@@ -37,9 +37,9 @@ class AnimationPointManager {
|
||||
statusListener(AnimationStatus.dismissed);
|
||||
|
||||
try {
|
||||
await controller1.forward().orCancel;
|
||||
await controller1?.forward().orCancel;
|
||||
list.remove(animatedWidget);
|
||||
controller1.dispose();
|
||||
controller1?.dispose();
|
||||
print('Controller1 disposed');
|
||||
} on TickerCanceled {
|
||||
print("Ticker Canceled");
|
||||
@@ -51,31 +51,31 @@ class AnimationPointManager {
|
||||
}
|
||||
|
||||
Future<void> addPopupAniamtion({
|
||||
@required TickerProvider vsync,
|
||||
@required GlobalKey stackKey,
|
||||
@required GlobalKey startKey,
|
||||
@required Widget child,
|
||||
Duration duration,
|
||||
required TickerProvider vsync,
|
||||
required GlobalKey stackKey,
|
||||
required GlobalKey startKey,
|
||||
required Widget child,
|
||||
required Duration duration,
|
||||
Offset popupOffset = Offset.zero,
|
||||
AnimationStatusListener statusListener,
|
||||
AnimationStatusListener? statusListener,
|
||||
}) async {
|
||||
controller2 = createController(vsync, duration);
|
||||
|
||||
AnimatedWidget animatedWidget = PopupAnimationWidget(
|
||||
animation: controller2.view,
|
||||
animation: controller2!.view,
|
||||
stackKey: stackKey,
|
||||
startKey: startKey,
|
||||
child: child,
|
||||
popupOffset: popupOffset,
|
||||
);
|
||||
list.add(animatedWidget);
|
||||
statusListener(AnimationStatus.dismissed);
|
||||
if (statusListener != null) statusListener(AnimationStatus.dismissed);
|
||||
|
||||
try {
|
||||
await controller2.forward().orCancel;
|
||||
await controller2.reverse().orCancel;
|
||||
await controller2?.forward().orCancel;
|
||||
await controller2?.reverse().orCancel;
|
||||
list.remove(animatedWidget);
|
||||
controller2.dispose();
|
||||
controller2?.dispose();
|
||||
print('Controller2 disposed');
|
||||
} on TickerCanceled {
|
||||
print("Ticker Canceled");
|
||||
@@ -83,7 +83,7 @@ class AnimationPointManager {
|
||||
print('Error: $error');
|
||||
}
|
||||
|
||||
statusListener(AnimationStatus.completed);
|
||||
if (statusListener != null) statusListener(AnimationStatus.completed);
|
||||
}
|
||||
|
||||
static AnimationController createController(
|
||||
|
||||
Reference in New Issue
Block a user