diff --git a/lib/pages/home/controller.dart b/lib/pages/home/controller.dart index 9f6f8ac54..6113d901c 100644 --- a/lib/pages/home/controller.dart +++ b/lib/pages/home/controller.dart @@ -91,19 +91,21 @@ class HomeController extends GetxController with GetTickerProviderStateMixin { vsync: this, ); // 监听 tabController 切换 - tabController.animation!.addListener(() { - if (tabController.indexIsChanging) { - if (initialIndex.value != tabController.index) { - initialIndex.value = tabController.index; + if (enableGradientBg) { + tabController.animation!.addListener(() { + if (tabController.indexIsChanging) { + if (initialIndex.value != tabController.index) { + initialIndex.value = tabController.index; + } + } else { + final int temp = tabController.animation!.value.round(); + if (initialIndex.value != temp) { + initialIndex.value = temp; + tabController.index = initialIndex.value; + } } - } else { - final int temp = tabController.animation!.value.round(); - if (initialIndex.value != temp) { - initialIndex.value = temp; - tabController.index = initialIndex.value; - } - } - }); + }); + } } void searchDefault() async {