mirror of
https://github.com/wgh136/pixes.git
synced 2025-09-27 12:57:24 +00:00
Improve animation
This commit is contained in:
@@ -121,8 +121,13 @@ mixin _AppRouteTransitionMixin<T> on PageRoute<T> {
|
|||||||
@override
|
@override
|
||||||
Widget buildTransitions(BuildContext context, Animation<double> animation,
|
Widget buildTransitions(BuildContext context, Animation<double> animation,
|
||||||
Animation<double> secondaryAnimation, Widget child) {
|
Animation<double> secondaryAnimation, Widget child) {
|
||||||
|
child = ColoredBox(
|
||||||
|
color: FluentTheme.of(context).micaBackgroundColor,
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
|
||||||
if (isRoot) {
|
if (isRoot) {
|
||||||
return EntrancePageTransition(
|
child = EntrancePageTransition(
|
||||||
animation: CurvedAnimation(
|
animation: CurvedAnimation(
|
||||||
parent: animation,
|
parent: animation,
|
||||||
curve: FluentTheme.of(context).animationCurve,
|
curve: FluentTheme.of(context).animationCurve,
|
||||||
@@ -135,21 +140,25 @@ mixin _AppRouteTransitionMixin<T> on PageRoute<T> {
|
|||||||
child: child)
|
child: child)
|
||||||
: child,
|
: child,
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
child = DrillInPageTransition(
|
||||||
|
animation: CurvedAnimation(
|
||||||
|
parent: animation,
|
||||||
|
curve: FluentTheme
|
||||||
|
.of(context)
|
||||||
|
.animationCurve,
|
||||||
|
),
|
||||||
|
child: enableIOSGesture && App.isIOS
|
||||||
|
? IOSBackGestureDetector(
|
||||||
|
gestureWidth: _kBackGestureWidth,
|
||||||
|
enabledCallback: () => _isPopGestureEnabled<T>(this),
|
||||||
|
onStartPopGesture: () => _startPopGesture(this),
|
||||||
|
child: child)
|
||||||
|
: child,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return DrillInPageTransition(
|
return child;
|
||||||
animation: CurvedAnimation(
|
|
||||||
parent: animation,
|
|
||||||
curve: FluentTheme.of(context).animationCurve,
|
|
||||||
),
|
|
||||||
child: enableIOSGesture && App.isIOS
|
|
||||||
? IOSBackGestureDetector(
|
|
||||||
gestureWidth: _kBackGestureWidth,
|
|
||||||
enabledCallback: () => _isPopGestureEnabled<T>(this),
|
|
||||||
onStartPopGesture: () => _startPopGesture(this),
|
|
||||||
child: child)
|
|
||||||
: child,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IOSBackGestureController _startPopGesture(PageRoute<T> route) {
|
IOSBackGestureController _startPopGesture(PageRoute<T> route) {
|
||||||
@@ -427,17 +436,14 @@ class EntrancePageTransition extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ColoredBox(
|
return SlideTransition(
|
||||||
color: FluentTheme.of(context).micaBackgroundColor,
|
position: Tween<Offset>(
|
||||||
child: SlideTransition(
|
begin: const Offset(0, 0.1),
|
||||||
position: Tween<Offset>(
|
end: Offset.zero,
|
||||||
begin: const Offset(0, 0.1),
|
).animate(animation),
|
||||||
end: Offset.zero,
|
child: FadeTransition(
|
||||||
).animate(animation),
|
opacity: animation,
|
||||||
child: FadeTransition(
|
child: child,
|
||||||
opacity: animation,
|
|
||||||
child: child,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user