Skip to content

Commit b52d7f7

Browse files
Tidyup animations sample (#1672)
* Tidyup * Drop `flutterAnimateDemos`
1 parent 1a8c9a4 commit b52d7f7

15 files changed

+183
-108
lines changed

animations/analysis_options.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
11
include: package:analysis_defaults/flutter.yaml
2-
3-
linter:
4-
rules:
5-
# Required because of the numbered sources in lib/src/basics
6-
file_names: false

animations/lib/main.dart

Lines changed: 95 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,10 @@ import 'dart:io';
77
import 'package:flutter/foundation.dart';
88
import 'package:flutter/material.dart';
99
import 'package:go_router/go_router.dart';
10-
11-
// ignore: depend_on_referenced_packages
1210
import 'package:window_size/window_size.dart';
1311

14-
import 'src/basics/01_animated_container.dart';
15-
import 'src/basics/02_page_route_builder.dart';
16-
import 'src/basics/03_animation_controller.dart';
17-
import 'src/basics/04_tweens.dart';
18-
import 'src/basics/05_animated_builder.dart';
19-
import 'src/basics/06_custom_tween.dart';
20-
import 'src/basics/07_tween_sequence.dart';
21-
import 'src/basics/08_fade_transition.dart';
22-
import 'src/misc/animated_list.dart';
23-
import 'src/misc/animated_positioned.dart';
24-
import 'src/misc/animated_switcher.dart';
25-
import 'src/misc/card_swipe.dart';
26-
import 'src/misc/carousel.dart';
27-
import 'src/misc/curved_animation.dart';
28-
import 'src/misc/expand_card.dart';
29-
import 'src/misc/focus_image.dart';
30-
import 'src/misc/hero_animation.dart';
31-
import 'src/misc/physics_card_drag.dart';
32-
import 'src/misc/repeating_animation.dart';
12+
import 'src/basics/basics.dart';
13+
import 'src/misc/misc.dart';
3314

3415
void main() {
3516
setupWindow();
@@ -69,84 +50,103 @@ class Demo {
6950

7051
final basicDemos = [
7152
Demo(
72-
name: 'AnimatedContainer',
73-
route: AnimatedContainerDemo.routeName,
74-
builder: (context) => const AnimatedContainerDemo()),
75-
Demo(
76-
name: 'PageRouteBuilder',
77-
route: PageRouteBuilderDemo.routeName,
78-
builder: (context) => const PageRouteBuilderDemo()),
79-
Demo(
80-
name: 'Animation Controller',
81-
route: AnimationControllerDemo.routeName,
82-
builder: (context) => const AnimationControllerDemo()),
83-
Demo(
84-
name: 'Tweens',
85-
route: TweenDemo.routeName,
86-
builder: (context) => const TweenDemo()),
87-
Demo(
88-
name: 'AnimatedBuilder',
89-
route: AnimatedBuilderDemo.routeName,
90-
builder: (context) => const AnimatedBuilderDemo()),
91-
Demo(
92-
name: 'Custom Tween',
93-
route: CustomTweenDemo.routeName,
94-
builder: (context) => const CustomTweenDemo()),
95-
Demo(
96-
name: 'Tween Sequences',
97-
route: TweenSequenceDemo.routeName,
98-
builder: (context) => const TweenSequenceDemo()),
99-
Demo(
100-
name: 'Fade Transition',
101-
route: FadeTransitionDemo.routeName,
102-
builder: (context) => const FadeTransitionDemo()),
53+
name: 'AnimatedContainer',
54+
route: AnimatedContainerDemo.routeName,
55+
builder: (context) => const AnimatedContainerDemo(),
56+
),
57+
Demo(
58+
name: 'PageRouteBuilder',
59+
route: PageRouteBuilderDemo.routeName,
60+
builder: (context) => const PageRouteBuilderDemo(),
61+
),
62+
Demo(
63+
name: 'Animation Controller',
64+
route: AnimationControllerDemo.routeName,
65+
builder: (context) => const AnimationControllerDemo(),
66+
),
67+
Demo(
68+
name: 'Tweens',
69+
route: TweenDemo.routeName,
70+
builder: (context) => const TweenDemo(),
71+
),
72+
Demo(
73+
name: 'AnimatedBuilder',
74+
route: AnimatedBuilderDemo.routeName,
75+
builder: (context) => const AnimatedBuilderDemo(),
76+
),
77+
Demo(
78+
name: 'Custom Tween',
79+
route: CustomTweenDemo.routeName,
80+
builder: (context) => const CustomTweenDemo(),
81+
),
82+
Demo(
83+
name: 'Tween Sequences',
84+
route: TweenSequenceDemo.routeName,
85+
builder: (context) => const TweenSequenceDemo(),
86+
),
87+
Demo(
88+
name: 'Fade Transition',
89+
route: FadeTransitionDemo.routeName,
90+
builder: (context) => const FadeTransitionDemo(),
91+
),
10392
];
10493

10594
final miscDemos = [
10695
Demo(
107-
name: 'Expandable Card',
108-
route: ExpandCardDemo.routeName,
109-
builder: (context) => const ExpandCardDemo()),
110-
Demo(
111-
name: 'Carousel',
112-
route: CarouselDemo.routeName,
113-
builder: (context) => CarouselDemo()),
114-
Demo(
115-
name: 'Focus Image',
116-
route: FocusImageDemo.routeName,
117-
builder: (context) => const FocusImageDemo()),
118-
Demo(
119-
name: 'Card Swipe',
120-
route: CardSwipeDemo.routeName,
121-
builder: (context) => const CardSwipeDemo()),
122-
Demo(
123-
name: 'Repeating Animation',
124-
route: RepeatingAnimationDemo.routeName,
125-
builder: (context) => const RepeatingAnimationDemo()),
126-
Demo(
127-
name: 'Spring Physics',
128-
route: PhysicsCardDragDemo.routeName,
129-
builder: (context) => const PhysicsCardDragDemo()),
130-
Demo(
131-
name: 'AnimatedList',
132-
route: AnimatedListDemo.routeName,
133-
builder: (context) => const AnimatedListDemo()),
134-
Demo(
135-
name: 'AnimatedPositioned',
136-
route: AnimatedPositionedDemo.routeName,
137-
builder: (context) => const AnimatedPositionedDemo()),
138-
Demo(
139-
name: 'AnimatedSwitcher',
140-
route: AnimatedSwitcherDemo.routeName,
141-
builder: (context) => const AnimatedSwitcherDemo()),
142-
Demo(
143-
name: 'Hero Animation',
144-
route: HeroAnimationDemo.routeName,
145-
builder: (context) => const HeroAnimationDemo()),
146-
Demo(
147-
name: 'Curved Animation',
148-
route: CurvedAnimationDemo.routeName,
149-
builder: (context) => const CurvedAnimationDemo()),
96+
name: 'Expandable Card',
97+
route: ExpandCardDemo.routeName,
98+
builder: (context) => const ExpandCardDemo(),
99+
),
100+
Demo(
101+
name: 'Carousel',
102+
route: CarouselDemo.routeName,
103+
builder: (context) => CarouselDemo(),
104+
),
105+
Demo(
106+
name: 'Focus Image',
107+
route: FocusImageDemo.routeName,
108+
builder: (context) => const FocusImageDemo(),
109+
),
110+
Demo(
111+
name: 'Card Swipe',
112+
route: CardSwipeDemo.routeName,
113+
builder: (context) => const CardSwipeDemo(),
114+
),
115+
Demo(
116+
name: 'Repeating Animation',
117+
route: RepeatingAnimationDemo.routeName,
118+
builder: (context) => const RepeatingAnimationDemo(),
119+
),
120+
Demo(
121+
name: 'Spring Physics',
122+
route: PhysicsCardDragDemo.routeName,
123+
builder: (context) => const PhysicsCardDragDemo(),
124+
),
125+
Demo(
126+
name: 'AnimatedList',
127+
route: AnimatedListDemo.routeName,
128+
builder: (context) => const AnimatedListDemo(),
129+
),
130+
Demo(
131+
name: 'AnimatedPositioned',
132+
route: AnimatedPositionedDemo.routeName,
133+
builder: (context) => const AnimatedPositionedDemo(),
134+
),
135+
Demo(
136+
name: 'AnimatedSwitcher',
137+
route: AnimatedSwitcherDemo.routeName,
138+
builder: (context) => const AnimatedSwitcherDemo(),
139+
),
140+
Demo(
141+
name: 'Hero Animation',
142+
route: HeroAnimationDemo.routeName,
143+
builder: (context) => const HeroAnimationDemo(),
144+
),
145+
Demo(
146+
name: 'Curved Animation',
147+
route: CurvedAnimationDemo.routeName,
148+
builder: (context) => const CurvedAnimationDemo(),
149+
),
150150
];
151151

152152
final router = GoRouter(

animations/lib/src/basics/01_animated_container.dart renamed to animations/lib/src/basics/animated_container.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Color generateColor() => Color(0xFFFFFFFF & Random().nextInt(0xFFFFFFFF));
1212

1313
class AnimatedContainerDemo extends StatefulWidget {
1414
const AnimatedContainerDemo({super.key});
15-
static String routeName = 'basics/01_animated_container';
15+
static String routeName = 'basics/animated_container';
1616

1717
@override
1818
State<AnimatedContainerDemo> createState() => _AnimatedContainerDemoState();

animations/lib/src/basics/basics.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export 'animated_builder.dart';
2+
export 'animated_container.dart';
3+
export 'animation_controller.dart';
4+
export 'custom_tween.dart';
5+
export 'fade_transition.dart';
6+
export 'page_route_builder.dart';
7+
export 'tween_sequence.dart';
8+
export 'tweens.dart';

0 commit comments

Comments
 (0)