Skip to content

Commit e21429e

Browse files
Refactor animation durations and curves using Motion
1 parent 5ceabd1 commit e21429e

1 file changed

Lines changed: 6 additions & 13 deletions

File tree

‎lib/widgets/home_menu.dart‎

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import 'package:launch_r/providers/launcher_settings.dart';
99
import 'package:launch_r/providers/shell_controller.dart';
1010
import 'package:launch_r/services/launcher_channel.dart';
1111
import 'package:launch_r/theme/launch_r_theme.dart';
12+
import 'package:launch_r/theme/motion.dart';
1213
import 'package:launch_r/widgets/app_icon.dart';
1314
import 'package:launch_r/widgets/settings_sheet.dart';
1415

@@ -21,7 +22,7 @@ class HomeMenu extends StatelessWidget {
2122
final open = context.select<ShellController, bool>((s) => s.menuOpen);
2223
return Positioned.fill(
2324
child: AnimatedSwitcher(
24-
duration: const Duration(milliseconds: 180),
25+
duration: Motion.base,
2526
child: open
2627
? _MenuOverlay(key: const ValueKey('menu'), homePages: homePages)
2728
: const SizedBox.shrink(key: ValueKey('none')),
@@ -68,11 +69,7 @@ class _MenuOverlayState extends State<_MenuOverlay> {
6869
context.read<ShellController>().closeMenu();
6970
if (home.hasClients) {
7071
unawaited(
71-
home.animateToPage(
72-
i,
73-
duration: const Duration(milliseconds: 300),
74-
curve: Curves.easeOutCubic,
75-
),
72+
home.animateToPage(i, duration: Motion.slow, curve: Motion.standard),
7673
);
7774
}
7875
}
@@ -90,11 +87,7 @@ class _MenuOverlayState extends State<_MenuOverlay> {
9087
final c = _cardsCtl;
9188
if (!mounted || c == null || !c.hasClients) return;
9289
unawaited(
93-
c.animateToPage(
94-
i,
95-
duration: const Duration(milliseconds: 280),
96-
curve: Curves.easeOutCubic,
97-
),
90+
c.animateToPage(i, duration: Motion.slow, curve: Motion.standard),
9891
);
9992
});
10093
}
@@ -171,8 +164,8 @@ class _MenuOverlayState extends State<_MenuOverlay> {
171164
return Center(
172165
child: TweenAnimationBuilder<double>(
173166
tween: Tween(begin: 0.94, end: 1),
174-
duration: const Duration(milliseconds: 240),
175-
curve: Curves.easeOutCubic,
167+
duration: Motion.base,
168+
curve: Motion.standard,
176169
builder: (context, v, child) =>
177170
Transform.scale(scale: v, child: child),
178171
child: SizedBox(

0 commit comments

Comments
 (0)