From 9268b3b5ca65892a0d79ae47bc008c658bff4642 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Sun, 31 Dec 2023 16:23:22 +0800 Subject: [PATCH] =?UTF-8?q?mod:=20=E5=8F=96=E6=B6=88=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/main/view.dart | 53 ++++++---------------------------------- 1 file changed, 8 insertions(+), 45 deletions(-) diff --git a/lib/pages/main/view.dart b/lib/pages/main/view.dart index fef5620d..6e93bcbc 100644 --- a/lib/pages/main/view.dart +++ b/lib/pages/main/view.dart @@ -25,10 +25,6 @@ class _MainAppState extends State with SingleTickerProviderStateMixin { final MediaController _mediaController = Get.put(MediaController()); PageController? _pageController; - - late AnimationController? _animationController; - late Animation? _fadeAnimation; - late Animation? _slideAnimation; int selectedIndex = 0; int? _lastSelectTime; //上次点击时间 Box setting = GStrorage.setting; @@ -37,16 +33,6 @@ class _MainAppState extends State with SingleTickerProviderStateMixin { @override void initState() { super.initState(); - _animationController = AnimationController( - duration: const Duration(milliseconds: 800), - reverseDuration: const Duration(milliseconds: 0), - value: 1, - vsync: this, - ); - _fadeAnimation = - Tween(begin: 0.8, end: 1.0).animate(_animationController!); - _slideAnimation = - Tween(begin: 0.8, end: 1.0).animate(_animationController!); _lastSelectTime = DateTime.now().millisecondsSinceEpoch; _pageController = PageController(initialPage: selectedIndex); enableMYBar = setting.get(SettingBoxKey.enableMYBar, defaultValue: true); @@ -54,14 +40,6 @@ class _MainAppState extends State with SingleTickerProviderStateMixin { void setIndex(int value) async { feedBack(); - if (selectedIndex != value) { - selectedIndex = value; - _animationController!.reverse().then((_) { - selectedIndex = value; - _animationController!.forward(); - }); - setState(() {}); - } _pageController!.jumpToPage(value); var currentPage = _mainController.pages[value]; if (currentPage is HomePage) { @@ -119,29 +97,14 @@ class _MainAppState extends State with SingleTickerProviderStateMixin { onPopInvoked: (bool status) => _mainController.onBackPressed(context), child: Scaffold( extendBody: true, - body: FadeTransition( - opacity: _fadeAnimation!, - child: SlideTransition( - position: Tween( - begin: const Offset(0, 0.5), - end: Offset.zero, - ).animate( - CurvedAnimation( - parent: _slideAnimation!, - curve: Curves.fastOutSlowIn, - reverseCurve: Curves.linear, - ), - ), - child: PageView( - physics: const NeverScrollableScrollPhysics(), - controller: _pageController, - onPageChanged: (index) { - selectedIndex = index; - setState(() {}); - }, - children: _mainController.pages, - ), - ), + body: PageView( + physics: const NeverScrollableScrollPhysics(), + controller: _pageController, + onPageChanged: (index) { + selectedIndex = index; + setState(() {}); + }, + children: _mainController.pages, ), bottomNavigationBar: StreamBuilder( stream: _mainController.hideTabBar