Skip to content

Commit

Permalink
fix: 首页tarbar指示器跳动
Browse files Browse the repository at this point in the history
  • Loading branch information
guozhigq committed Mar 4, 2024
1 parent b248158 commit f1b829c
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions lib/pages/home/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit f1b829c

Please sign in to comment.