diff --git a/lib/widget/home.dart b/lib/widget/home.dart index d1a5b841..6705aa19 100644 --- a/lib/widget/home.dart +++ b/lib/widget/home.dart @@ -45,7 +45,7 @@ class Home extends StatefulWidget { final Account account; } -class _HomeState extends State { +class _HomeState extends State with TickerProviderStateMixin { @override initState() { super.initState(); @@ -56,6 +56,13 @@ class _HomeState extends State { } }); } + _animationController.value = 1; + } + + @override + dispose() { + _animationController.dispose(); + super.dispose(); } @override @@ -90,7 +97,16 @@ class _HomeState extends State { controller: _pageController, physics: const NeverScrollableScrollPhysics(), itemCount: 2, - itemBuilder: _buildPage, + itemBuilder: (context, index) => SlideTransition( + position: Tween( + begin: const Offset(0, .05), + end: Offset.zero, + ).animate(_animation), + child: FadeTransition( + opacity: _animation, + child: _buildPage(context, index), + ), + ), ); } @@ -120,11 +136,13 @@ class _HomeState extends State { } void _onTapNavItem(int index) { - _pageController.animateToPage(index, - duration: k.animationDurationNormal, curve: Curves.easeInOut); + _pageController.jumpToPage(index); setState(() { _nextPage = index; }); + _animationController + ..reset() + ..forward(); } Future> _importPotentialSharedAlbum() async { @@ -148,5 +166,14 @@ class _HomeState extends State { final _pageController = PageController(initialPage: 0, keepPage: false); int _nextPage = 0; + late final _animationController = AnimationController( + duration: k.animationDurationLong, + vsync: this, + ); + late final _animation = CurvedAnimation( + parent: _animationController, + curve: Curves.easeIn, + ); + static final _log = Logger("widget.home._HomeState"); }