Skip to content

Commit 782a012

Browse files
SaadArdatiBirjuVachhani
authored andcommitted
🔧 Update Pack V1 #13
1 parent 9756b59 commit 782a012

24 files changed

+487
-252
lines changed

example/lib/main.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import 'package:hyper_effects_demo/stories/counter_app.dart';
1111
import 'package:hyper_effects_demo/stories/scroll_phase_transition.dart';
1212
import 'package:hyper_effects_demo/stories/scroll_wheel_blur.dart';
1313
import 'package:hyper_effects_demo/stories/scroll_wheel_transition.dart';
14-
import 'package:hyper_effects_demo/stories/one_shot_animation.dart';
14+
import 'package:hyper_effects_demo/stories/one_shot_reset_animation.dart';
1515
import 'package:hyper_effects_demo/stories/text_animation.dart';
1616
import 'package:hyper_effects_demo/stories/windows_settings_transition.dart';
1717

@@ -89,8 +89,8 @@ class _StoryboardState extends State<Storyboard> {
8989
child: CounterApp(),
9090
),
9191
const Story(
92-
title: 'Fade In Animation',
93-
child: OneShotAnimation(),
92+
title: 'One-Shot Reset Animation',
93+
child: OneShotResetAnimation(),
9494
),
9595
const Story(
9696
title: 'Spring Animation',
@@ -363,7 +363,7 @@ class _ContentViewState extends State<ContentView> with WidgetsBindingObserver {
363363
strokeAlign: BorderSide.strokeAlignOutside,
364364
),
365365
),
366-
child: Center(child: widget.child),
366+
child: Center(child: ClipRect(child: widget.child)),
367367
);
368368
},
369369
),

example/lib/stories/one_shot_animation.dart

Lines changed: 0 additions & 35 deletions
This file was deleted.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:hyper_effects/hyper_effects.dart';
3+
4+
class OneShotResetAnimation extends StatefulWidget {
5+
const OneShotResetAnimation({super.key});
6+
7+
@override
8+
State<OneShotResetAnimation> createState() => _OneShotResetAnimationState();
9+
}
10+
11+
class _OneShotResetAnimationState extends State<OneShotResetAnimation> {
12+
@override
13+
Widget build(BuildContext context) {
14+
return Center(
15+
child: Image.asset('assets/pin_ball_256x.png', width: 150, height: 150)
16+
// Step 1
17+
.translateX(100, from: -100)
18+
.oneShot()
19+
// Step 2
20+
.slideOutToBottom()
21+
.animateAfter()
22+
// Step 3
23+
.slideOutToLeft(value: -200)
24+
.animateAfter()
25+
// Step 4
26+
.slideOutToTop()
27+
.animateAfter()
28+
.resetAll(),
29+
);
30+
}
31+
}

example/lib/stories/spring_animation.dart

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@ class _SpringAnimationState extends State<SpringAnimation> {
2121
});
2222
},
2323
child: Image.asset('assets/pin_ball_256x.png', width: 150, height: 150)
24-
.translateY(selected ? 300 : 0)
24+
.translateY(300, from: 0)
2525
.animate(
26-
toggle: selected,
27-
curve: selected ? Curves.easeOutQuart : Curves.elasticOut,
28-
duration: Duration(milliseconds: selected ? 1000 : 450),
29-
onEnd: () {
30-
if (selected) {
31-
setState(() {
32-
selected = false;
33-
});
34-
}
35-
}),
26+
toggle: selected,
27+
curve: Curves.easeOutQuart,
28+
duration: const Duration(milliseconds: 1000),
29+
)
30+
.slideOut(const Offset(0, -300))
31+
.animateAfter(
32+
curve: Curves.elasticOut,
33+
duration: const Duration(milliseconds: 450),
34+
)
35+
.resetAll(),
3636
),
3737
);
3838
}

lib/hyper_effects.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
library hyper_effects;
22

33
export 'src/animated_effect.dart';
4-
export 'src/effect_builder.dart';
4+
export 'src/effect_widget.dart';
55
export 'src/effects/effects.dart';
66
export 'src/extensions.dart';
77
export 'src/scroll_phase.dart';

0 commit comments

Comments
 (0)