Browse Source

一些反馈修改-3

liukai 4 days ago
parent
commit
6ab67c7d13
1 changed files with 4 additions and 3 deletions
  1. 4 3
      packages/cpt_main/lib/modules/home/home_page.dart

+ 4 - 3
packages/cpt_main/lib/modules/home/home_page.dart

@@ -45,6 +45,8 @@ class HomePage extends HookConsumerWidget {
   Widget build(BuildContext context, WidgetRef ref) {
     final viewModel = ref.read(homeViewModelProvider.notifier);
     final state = ref.watch(homeViewModelProvider);
+    String? notificationCount = UserConfigService.getState(ref: ref).user?.unreadNotificationsCount;
+
     final bannerIndex = useState(0);
 
     useEffect(() {
@@ -121,11 +123,10 @@ class HomePage extends HookConsumerWidget {
                           left: 0,
                           top: 0,
                           child: Visibility(
-                            visible: UserConfigService.getState(ref: ref).user?.unreadNotificationsCount != null,
+                            visible: notificationCount != null && notificationCount != "0",
                             child: Transform.translate(
                               offset: const Offset(-10, -5),
-                              child: MyTextView(
-                                UserConfigService.getState(ref: ref).user?.unreadNotificationsCount ?? "0",
+                              child: MyTextView(notificationCount ?? "0",
                                 boxWidth: 20.0,
                                 textColor: Colors.white,
                                 fontSize: 10,