mirror of
https://github.com/kuhyx/wake-alarm.git
synced 2026-11-21 17:42:19 +01:00
Motion tokens hand-copied from DOCS-motion.md into theme.dart; every page route goes through appRoute() (slow, decelerate in, accelerate out, instant under Remove animations). mediumImpact on the picker confirm, heavyImpact on a refused time. The Clock app line shows only when the SET_ALARM handoff finished before its 3 s timeout. Sound is skipped on purpose. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
28 lines
1019 B
Dart
28 lines
1019 B
Dart
/// The app's one page route: slow slide, decelerate in, accelerate out.
|
|
library;
|
|
|
|
import 'package:material_ui/material_ui.dart';
|
|
import 'package:wake_alarm_sync/ui/theme.dart';
|
|
|
|
/// A route to [builder]'s page using the shared motion tokens; instant under
|
|
/// the OS "Remove animations" setting.
|
|
PageRoute<T> appRoute<T>(BuildContext context, WidgetBuilder builder) {
|
|
final duration = motionDuration(context, MotionDuration.slow);
|
|
return PageRouteBuilder<T>(
|
|
transitionDuration: duration,
|
|
reverseTransitionDuration: duration,
|
|
pageBuilder: (context, _, _) => builder(context),
|
|
transitionsBuilder: (context, animation, secondary, child) {
|
|
final slide = Tween<Offset>(begin: const Offset(1, 0), end: Offset.zero)
|
|
.animate(
|
|
CurvedAnimation(
|
|
parent: animation,
|
|
curve: MotionCurve.decelerate,
|
|
reverseCurve: MotionCurve.accelerate,
|
|
),
|
|
);
|
|
return SlideTransition(position: slide, child: child);
|
|
},
|
|
);
|
|
}
|