Skip to content

Commit cf1b7a4

Browse files
SaadArdatiBirjuVachhani
authored andcommitted
🔧 Update Pack V1 #12
1 parent d1fa308 commit cf1b7a4

File tree

8 files changed

+356
-331
lines changed

8 files changed

+356
-331
lines changed

example/lib/main.dart

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import 'package:flutter/material.dart';
55
import 'package:flutter/scheduler.dart';
66
import 'package:flutter/services.dart';
77
import 'package:flutter_box_transform/flutter_box_transform.dart';
8-
import 'package:hyper_effects_demo/stories/chained_animation.dart';
8+
import 'package:hyper_effects_demo/stories/spring_animation.dart';
99
import 'package:hyper_effects_demo/stories/color_filter_scroll_transition.dart';
1010
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/spring_animation.dart';
14+
import 'package:hyper_effects_demo/stories/one_shot_animation.dart';
1515
import 'package:hyper_effects_demo/stories/text_animation.dart';
1616
import 'package:hyper_effects_demo/stories/windows_settings_transition.dart';
1717

@@ -29,7 +29,6 @@ class MyApp extends StatelessWidget {
2929
return AdaptiveTheme(
3030
light: ThemeData(
3131
useMaterial3: true,
32-
// brightness: Brightness.light,
3332
colorScheme: ColorScheme.fromSeed(
3433
brightness: Brightness.light,
3534
seedColor: Colors.blue,
@@ -46,8 +45,6 @@ class MyApp extends StatelessWidget {
4645
),
4746
dark: ThemeData(
4847
useMaterial3: true,
49-
// brightness: Brightness.dark,
50-
// colorSchemeSeed: Colors.blue,
5148
colorScheme: ColorScheme.fromSeed(
5249
brightness: Brightness.dark,
5350
seedColor: Colors.blue,
@@ -84,25 +81,21 @@ class Storyboard extends StatefulWidget {
8481
class _StoryboardState extends State<Storyboard> {
8582
final List<Story> animationStories = [
8683
const Story(
87-
title: 'Spring Animation',
88-
child: SpringAnimation(),
84+
title: 'Text Rolling Animations',
85+
child: TextAnimation(),
8986
),
9087
const Story(
91-
title: 'Text Animations',
92-
child: TextAnimation(),
88+
title: 'Rolling Counter App',
89+
child: CounterApp(),
9390
),
9491
const Story(
95-
title: 'Chained Animation',
96-
child: ChainedAnimation(),
92+
title: 'Fade In Animation',
93+
child: OneShotAnimation(),
9794
),
9895
const Story(
99-
title: 'Counter App',
100-
child: CounterApp(),
96+
title: 'Spring Animation',
97+
child: SpringAnimation(),
10198
),
102-
// const Story(
103-
// title: 'Chained Animation',
104-
// child: ChainedAnimation(),
105-
// )
10699
];
107100
final List<Story> transitionStories = [
108101
const Story(

example/lib/stories/chained_animation.dart

Lines changed: 0 additions & 39 deletions
This file was deleted.

example/lib/stories/counter_app.dart

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,10 @@ class _CounterAppState extends State<CounterApp> {
3333
const Text(
3434
'You have pushed the button this many times:',
3535
),
36-
Container(
37-
width: double.infinity,
38-
alignment: Alignment.center,
39-
decoration: const BoxDecoration(),
40-
clipBehavior: Clip.hardEdge,
41-
child: Text(
42-
'${max(0, _counter - 1)}',
43-
style: Theme.of(context).textTheme.headlineMedium,
44-
)
45-
.roll(
46-
'$_counter',
47-
clipBehavior: Clip.none,
48-
)
49-
.animate(
50-
toggle: _counter,
51-
duration: const Duration(milliseconds: 1000),
52-
),
53-
),
36+
Text(
37+
'${max(0, _counter - 1)}',
38+
style: Theme.of(context).textTheme.headlineMedium,
39+
).roll('$_counter').animate(toggle: _counter),
5440
],
5541
),
5642
),
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:hyper_effects/hyper_effects.dart';
3+
4+
class OneShotAnimation extends StatefulWidget {
5+
const OneShotAnimation({super.key});
6+
7+
@override
8+
State<OneShotAnimation> createState() => _OneShotAnimationState();
9+
}
10+
11+
class _OneShotAnimationState extends State<OneShotAnimation> {
12+
@override
13+
Widget build(BuildContext context) {
14+
return Center(
15+
child: Image.asset('assets/pin_ball_256x.png', width: 150, height: 150)
16+
.fadeIn()
17+
.slideInFromBottom()
18+
.blurIn()
19+
.oneShot(
20+
duration: const Duration(milliseconds: 1000),
21+
).then(context).slideOutToLeft().oneShot(),
22+
);
23+
}
24+
}

example/lib/stories/spring_animation.dart

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +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)
25-
.fadeIn()
26-
.slideInFromBottom()
27-
.oneShot(
28-
duration: const Duration(milliseconds: 1000),
29-
),
30-
// .animate(
31-
// toggle: selected,
32-
// curve: selected ? Curves.easeOutQuart : Curves.elasticOut,
33-
// duration: Duration(milliseconds: selected ? 1000 : 450),
34-
// onEnd: () {
35-
// if (selected) {
36-
// setState(() {
37-
// selected = false;
38-
// });
39-
// }
40-
// }),
24+
.translateY(selected ? 300 : 0)
25+
.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+
}),
4136
),
4237
);
4338
}

0 commit comments

Comments
 (0)