mirror of
https://github.com/gskinnerTeam/flutter-wonderous-app.git
synced 2025-05-20 06:16:23 +08:00
Reimplemented _Times disabled state and implemented in scroll/page controller animations.
This commit is contained in:
@ -42,7 +42,8 @@ class AppStyle {
|
||||
late final _Text text = _Text(scale);
|
||||
|
||||
/// Animation Durations
|
||||
final _Times times = _Times();
|
||||
late final _Times times = _Times(disableAnimations);
|
||||
late final _CustomTime customTime = _CustomTime(disableAnimations);
|
||||
|
||||
/// Shared sizes
|
||||
late final _Sizes sizes = _Sizes();
|
||||
@ -135,10 +136,13 @@ class _Text {
|
||||
|
||||
@immutable
|
||||
class _Times {
|
||||
final Duration fast = Duration(milliseconds: 300);
|
||||
final Duration med = Duration(milliseconds: 600);
|
||||
final Duration slow = Duration(milliseconds: 900);
|
||||
final Duration pageTransition = Duration(milliseconds: 200);
|
||||
_Times(this.disabled);
|
||||
final bool disabled;
|
||||
late final Duration fast = Duration(milliseconds: disabled ? 1 : 300);
|
||||
late final Duration med = Duration(milliseconds: disabled ? 1 : 600);
|
||||
late final Duration slow = Duration(milliseconds: disabled ? 1 : 900);
|
||||
late final Duration extraSlow = Duration(milliseconds: disabled ? 1 : 1300);
|
||||
late final Duration pageTransition = Duration(milliseconds: disabled ? 1 : 200);
|
||||
}
|
||||
|
||||
@immutable
|
||||
|
@ -53,7 +53,7 @@ class _FullscreenUrlImgViewerState extends State<FullscreenUrlImgViewer> {
|
||||
|
||||
void _animateToPage(int page) {
|
||||
if (page >= 0 || page < widget.urls.length) {
|
||||
_controller.animateToPage(page, duration: 300.ms, curve: Curves.easeOut);
|
||||
_controller.animateToPage(page, duration: $styles.times.fast, curve: Curves.easeOut);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ class _IntroScreenState extends State<IntroScreen> {
|
||||
final int current = _pageController.page!.round();
|
||||
if (_isOnLastPage && dir > 0) return;
|
||||
if (_isOnFirstPage && dir < 0) return;
|
||||
_pageController.animateToPage(current + dir, duration: 250.ms, curve: Curves.easeIn);
|
||||
_pageController.animateToPage(current + dir, duration: $styles.times.fast, curve: Curves.easeIn);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -25,7 +25,7 @@ class _ScrollingViewportController extends ChangeNotifier {
|
||||
final data = wondersLogic.getData(w);
|
||||
final pos = calculateScrollPosFromYear(data.startYr);
|
||||
scroller.jumpTo(pos - 200);
|
||||
scroller.animateTo(pos, duration: 1.35.seconds, curve: Curves.easeOutCubic);
|
||||
scroller.animateTo(pos, duration: $styles.times.extraSlow, curve: Curves.easeOutCubic);
|
||||
scroller.addListener(_updateCurrentYear);
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user