Skip to content

Commit 8defc23

Browse files
committed
Properly split up animations
1 parent e438857 commit 8defc23

File tree

1,682 files changed

+62368
-30
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,682 files changed

+62368
-30
lines changed

animations/codelab_rebuild.yaml

Lines changed: 124 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: Add animation effects to your Flutter app
22
steps:
33
- name: step_01
44
steps:
5-
- name: Remove generated code
6-
rmdir: step_01
75
- name: Create project
86
flutter: create --empty quiz
97
- name: Strip DEVELOPMENT_TEAM
@@ -410,24 +408,22 @@ steps:
410408
);
411409
}
412410
}
413-
# - name: Build web app
414-
# path: patterns_codelab
415-
# flutter: build web
416411
- name: Fetch dependencies
417412
path: quiz
418413
dart: pub get
419414
- name: Run Dart Analzyer
420415
path: quiz
421416
dart: analyze --fatal-infos
422-
# - name: Check formatting
423-
# path: quiz
424-
# dart: format --set-exit-if-changed
417+
- name: Remove step_01
418+
rmdir: step_01
425419
- name: Copy step_01
426420
copydir:
427421
from: quiz
428422
to: step_01
429423
- name: step_02
430424
steps:
425+
- name: Remove generated code
426+
rmdir: step_02
431427
- name: Create scoreboard.dart
432428
path: quiz/lib/scoreboard.dart
433429
replace-contents: |
@@ -462,6 +458,12 @@ steps:
462458
);
463459
}
464460
}
461+
- name: Remove step_02_a
462+
rmdir: step_02_a
463+
- name: Copy step_02_a
464+
copydir:
465+
from: quiz
466+
to: step_02_a
465467
- name: Use Scoreboard widget
466468
path: quiz/lib/question_screen.dart
467469
patch-u: |
@@ -490,6 +492,12 @@ steps:
490492
),
491493
],
492494
),
495+
- name: Remove step_02_b
496+
rmdir: step_02_b
497+
- name: Copy step_02_b
498+
copydir:
499+
from: quiz
500+
to: step_02_b
493501
- name: Use an ImplicitlyAnimatedWidget
494502
path: quiz/lib/scoreboard.dart
495503
patch-u: |
@@ -534,6 +542,12 @@ steps:
534542
+ );
535543
+ }
536544
+}
545+
- name: Remove step_02_c
546+
rmdir: step_02_c
547+
- name: Copy step_02_c
548+
copydir:
549+
from: quiz
550+
to: step_02_c
537551
- name: Use a TweenAnimationBuilder to change the color
538552
path: quiz/lib/scoreboard.dart
539553
patch-u: |
@@ -563,6 +577,12 @@ steps:
563577
),
564578
);
565579
}
580+
- name: Remove step_02_d
581+
rmdir: step_02_d
582+
- name: Copy step_02_d
583+
copydir:
584+
from: quiz
585+
to: step_02_d
566586
- name: Use a Curve
567587
path: quiz/lib/scoreboard.dart
568588
patch-u: |
@@ -587,7 +607,14 @@ steps:
587607
duration: _duration,
588608
tween: ColorTween(
589609
begin: _deactivatedColor,
590-
610+
- name: Remove step_02_e
611+
rmdir: step_02_e
612+
- name: Copy step_02_e
613+
copydir:
614+
from: quiz
615+
to: step_02_e
616+
617+
# TODO(DomesticMouse): Delete step_02 once the codelab is published with individual steps
591618
- name: Copy step_02
592619
copydir:
593620
from: quiz
@@ -597,9 +624,9 @@ steps:
597624
- name: Use AnimatedSwitcher
598625
path: quiz/lib/question_screen.dart
599626
patch-u: |
600-
--- a/animations/step_02/lib/question_screen.dart
601-
+++ b/animations/step_02/lib/question_screen.dart
602-
@@ -88,13 +88,17 @@ class QuestionCard extends StatelessWidget {
627+
--- b/animations/step_03_a/lib/question_screen.dart
628+
+++ a/animations/step_03_a/lib/question_screen.dart
629+
@@ -87,13 +87,17 @@ class QuestionCard extends StatelessWidget {
603630
604631
@override
605632
Widget build(BuildContext context) {
@@ -624,6 +651,12 @@ steps:
624651
),
625652
),
626653
);
654+
- name: Remove step_03_a
655+
rmdir: step_03_a
656+
- name: Copy step_03_a
657+
copydir:
658+
from: quiz
659+
to: step_03_a
627660
- name: Use a custom transitionBuilder
628661
path: quiz/lib/question_screen.dart
629662
patch-u: |
@@ -644,6 +677,12 @@ steps:
644677
duration: const Duration(milliseconds: 300),
645678
child: Card(
646679
key: ValueKey(question),
680+
- name: Remove step_03_b
681+
rmdir: step_03_b
682+
- name: Copy step_03_b
683+
copydir:
684+
from: quiz
685+
to: step_03_b
647686
- name: Apply a fade effect to the transitionBuilder
648687
path: quiz/lib/question_screen.dart
649688
patch-u: |
@@ -662,6 +701,12 @@ steps:
662701
},
663702
duration: const Duration(milliseconds: 300),
664703
child: Card(
704+
- name: Remove step_03_c
705+
rmdir: step_03_c
706+
- name: Copy step_03_c
707+
copydir:
708+
from: quiz
709+
to: step_03_c
665710
- name: Customize the layoutBuilder
666711
path: quiz/lib/question_screen.dart
667712
patch-u: |
@@ -683,6 +728,15 @@ steps:
683728
transitionBuilder: (Widget child, Animation<double> animation) {
684729
final curveAnimation =
685730
CurveTween(curve: Curves.easeInCubic).animate(animation);
731+
- name: Remove step_03_d
732+
rmdir: step_03_d
733+
- name: Copy step_03_d
734+
copydir:
735+
from: quiz
736+
to: step_03_d
737+
# TODO(DomesticMouse): Delete step_03 once the codelab is published with individual steps
738+
- name: Remove step_03
739+
rmdir: step_03
686740
- name: Copy step_03
687741
copydir:
688742
from: quiz
@@ -814,6 +868,12 @@ steps:
814868
),
815869
),
816870
),
871+
- name: Remove step_04_a
872+
rmdir: step_04_a
873+
- name: Copy step_04_a
874+
copydir:
875+
from: quiz
876+
to: step_04_a
817877
- name: Add delay using TweenSequence
818878
path: quiz/lib/flip_effect.dart
819879
patch-u: |
@@ -833,7 +893,31 @@ steps:
833893
});
834894
835895
@override
836-
@@ -19,19 +21,32 @@ class _CardFlipEffectState extends State<CardFlipEffect>
896+
- name: Add delay to question screen
897+
path: quiz/lib/question_screen.dart
898+
patch-u: |
899+
--- a/animations/step_04/lib/question_screen.dart
900+
+++ b/animations/step_04/lib/question_screen.dart
901+
@@ -151,6 +151,7 @@ class AnswerCards extends StatelessWidget {
902+
}
903+
904+
return CardFlipEffect(
905+
+ delayAmount: index.toDouble() / 2,
906+
duration: const Duration(milliseconds: 300),
907+
child: Card.filled(
908+
key: ValueKey(answers[index]),
909+
- name: Remove step_04_b
910+
rmdir: step_04_b
911+
- name: Copy step_04_b
912+
copydir:
913+
from: quiz
914+
to: step_04_b
915+
- name: Add delay using TweenSequence, part 2
916+
path: quiz/lib/flip_effect.dart
917+
patch-u: |
918+
--- b/animations/step_04_c/lib/flip_effect.dart
919+
+++ a/animations/step_04_c/lib/flip_effect.dart
920+
@@ -21,19 +21,32 @@ class _CardFlipEffectState extends State<CardFlipEffect>
837921
with SingleTickerProviderStateMixin {
838922
late final AnimationController _animationController;
839923
Widget? _previousChild;
@@ -867,7 +951,18 @@ steps:
867951
}
868952
869953
@override
870-
@@ -51,14 +66,14 @@ class _CardFlipEffectState extends State<CardFlipEffect>
954+
- name: Remove step_04_c
955+
rmdir: step_04_c
956+
- name: Copy step_04_c
957+
copydir:
958+
from: quiz
959+
to: step_04_c
960+
- name: Add delay using TweenSequence, part 3
961+
path: quiz/lib/flip_effect.dart
962+
patch-u: |
963+
--- b/animations/step_04_d/lib/flip_effect.dart
964+
+++ a/animations/step_04_d/lib/flip_effect.dart
965+
@@ -66,14 +66,14 @@ class _CardFlipEffectState extends State<CardFlipEffect>
871966
@override
872967
Widget build(BuildContext context) {
873968
return AnimatedBuilder(
@@ -885,19 +980,16 @@ steps:
885980
? _previousChild
886981
: Transform.flip(flipY: true, child: widget.child)
887982
: widget.child,
888-
- name: Add delay to question screen
889-
path: quiz/lib/question_screen.dart
890-
patch-u: |
891-
--- a/animations/step_04/lib/question_screen.dart
892-
+++ b/animations/step_04/lib/question_screen.dart
893-
@@ -151,6 +151,7 @@ class AnswerCards extends StatelessWidget {
894-
}
895-
896-
return CardFlipEffect(
897-
+ delayAmount: index.toDouble() / 2,
898-
duration: const Duration(milliseconds: 300),
899-
child: Card.filled(
900-
key: ValueKey(answers[index]),
983+
- name: Remove step_04_d
984+
rmdir: step_04_d
985+
- name: Copy step_04_d
986+
copydir:
987+
from: quiz
988+
to: step_04_d
989+
990+
# TODO(DomesticMouse): Delete step_04 once the codelab is published with individual steps
991+
- name: Remove step_04
992+
rmdir: step_04
901993
- name: Copy step_04
902994
copydir:
903995
from: quiz
@@ -1236,9 +1328,7 @@ steps:
12361328
),
12371329
);
12381330
}
1239-
- name: dart analyze
1240-
path: quiz
1241-
dart: analyze --fatal-infos
1331+
12421332
- name: Build Android app
12431333
platforms: [ macos ]
12441334
path: quiz
@@ -1262,6 +1352,10 @@ steps:
12621352
- name: Build Web app
12631353
path: quiz
12641354
flutter: build web
1355+
1356+
# TODO(DomesticMouse): Delete step_05 once the codelab is published with individual steps
1357+
- name: Remove step_05
1358+
rmdir: step_05
12651359
- name: Copy step_05
12661360
copydir:
12671361
from: quiz

animations/step_02_a/.gitignore

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
11+
migrate_working_dir/
12+
13+
# IntelliJ related
14+
*.iml
15+
*.ipr
16+
*.iws
17+
.idea/
18+
19+
# The .vscode folder contains launch configuration and tasks you configure in
20+
# VS Code which you may wish to be included in version control, so this line
21+
# is commented out by default.
22+
#.vscode/
23+
24+
# Flutter/Dart/Pub related
25+
**/doc/api/
26+
**/ios/Flutter/.last_build_id
27+
.dart_tool/
28+
.flutter-plugins
29+
.flutter-plugins-dependencies
30+
.pub-cache/
31+
.pub/
32+
/build/
33+
34+
# Symbolication related
35+
app.*.symbols
36+
37+
# Obfuscation related
38+
app.*.map.json
39+
40+
# Android Studio will place build artifacts here
41+
/android/app/debug
42+
/android/app/profile
43+
/android/app/release
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
include: package:flutter_lints/flutter.yaml
2+
3+
linter:
4+
rules:
5+
prefer_const_constructors: false
6+
prefer_const_constructors_in_immutables: false
7+
prefer_const_declarations: false
8+
prefer_const_literals_to_create_immutables: false
9+
annotate_overrides: false
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
gradle-wrapper.jar
2+
/.gradle
3+
/captures/
4+
/gradlew
5+
/gradlew.bat
6+
/local.properties
7+
GeneratedPluginRegistrant.java
8+
9+
# Remember to never publicly share your keystore.
10+
# See https://flutter.dev/to/reference-keystore
11+
key.properties
12+
**/*.keystore
13+
**/*.jks

0 commit comments

Comments
 (0)