Skip to content

Commit 00a2a7d

Browse files
committed
🔧 Update spring example title.
1 parent 868ce0e commit 00a2a7d

File tree

3 files changed

+46
-2
lines changed

3 files changed

+46
-2
lines changed

example/lib/main.dart

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ 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/animate_buttons.dart';
8+
import 'package:hyper_effects_demo/stories/chained_animation.dart';
9+
import 'package:hyper_effects_demo/stories/spring_animation.dart';
910
import 'package:hyper_effects_demo/stories/color_filter_scroll_transition.dart';
1011
import 'package:hyper_effects_demo/stories/scroll_phase_transition.dart';
1112
import 'package:hyper_effects_demo/stories/scroll_wheel_blur.dart';
@@ -72,9 +73,13 @@ class Storyboard extends StatefulWidget {
7273
class _StoryboardState extends State<Storyboard> {
7374
final List<Story> animationStories = [
7475
const Story(
75-
title: 'Animated Buttons',
76+
title: 'Spring Animation',
7677
child: SpringAnimation(),
7778
),
79+
// const Story(
80+
// title: 'Chained Animation',
81+
// child: ChainedAnimation(),
82+
// )
7883
];
7984
final List<Story> transitionStories = [
8085
const Story(
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:hyper_effects/hyper_effects.dart';
3+
4+
class ChainedAnimation extends StatefulWidget {
5+
const ChainedAnimation({super.key});
6+
7+
@override
8+
State<ChainedAnimation> createState() => _ChainedAnimationState();
9+
}
10+
11+
class _ChainedAnimationState extends State<ChainedAnimation> {
12+
bool selected = false;
13+
14+
@override
15+
Widget build(BuildContext context) {
16+
return Center(
17+
child: GestureDetector(
18+
onTap: () {
19+
setState(() {
20+
selected = !selected;
21+
});
22+
},
23+
child: Image.asset('assets/pin_ball_256x.png', width: 150, height: 150)
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+
}),
36+
),
37+
);
38+
}
39+
}

0 commit comments

Comments
 (0)