|
@@ -10,10 +10,15 @@ import 'package:flutter/src/widgets/framework.dart';
|
|
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
|
import 'package:auto_route/auto_route.dart';
|
|
|
+import 'package:plugin_basic/basic_export.dart';
|
|
|
+import 'package:plugin_basic/constants/app_constant.dart';
|
|
|
+import 'package:plugin_basic/provider/user_config/user_config.dart';
|
|
|
import 'package:plugin_basic/provider/user_config/user_config_service.dart';
|
|
|
import 'package:plugin_platform/engine/toast/toast_engine.dart';
|
|
|
import 'package:router/componentRouter/community_service.dart';
|
|
|
import 'package:router/componentRouter/component_service_manager.dart';
|
|
|
+import 'package:shared/utils/event_bus.dart';
|
|
|
+import 'package:shared/utils/log_utils.dart';
|
|
|
import 'package:widgets/ext/ex_widget.dart';
|
|
|
import 'package:widgets/my_appbar.dart';
|
|
|
import 'package:widgets/my_load_image.dart';
|
|
@@ -51,9 +56,20 @@ class HomePage extends HookConsumerWidget {
|
|
|
}, []);
|
|
|
|
|
|
return AnnotatedRegion<SystemUiOverlayStyle>(
|
|
|
- value: MediaQuery.of(context).platformBrightness == Brightness.dark
|
|
|
- ? ThemeConfig.systemUiOverlayStyleDarkTheme
|
|
|
- : ThemeConfig.systemUiOverlayStyleLightThemeWhite,
|
|
|
+ value: MediaQuery.of(context).platformBrightness == Brightness.dark
|
|
|
+ ? ThemeConfig.systemUiOverlayStyleDarkTheme
|
|
|
+ : ThemeConfig.systemUiOverlayStyleLightThemeWhite,
|
|
|
+ child: VisibilityDetector(
|
|
|
+ key: const Key('unique-key'),
|
|
|
+ onVisibilityChanged: (VisibilityInfo info) {
|
|
|
+ if (info.visibleFraction == 1) {
|
|
|
+ Log.d("Home Page 全部显示");
|
|
|
+ //发送通知刷新用户信息
|
|
|
+ bus.emit(AppConstant.eventProfileRefresh, true);
|
|
|
+ } else {
|
|
|
+ Log.d("Home Page 隐藏了");
|
|
|
+ }
|
|
|
+ },
|
|
|
child: Scaffold(
|
|
|
backgroundColor: context.appColors.backgroundDefault,
|
|
|
body: Stack(
|
|
@@ -107,7 +123,7 @@ class HomePage extends HookConsumerWidget {
|
|
|
child: Transform.translate(
|
|
|
offset: const Offset(-10, -5),
|
|
|
child: MyTextView(
|
|
|
- "99",
|
|
|
+ UserConfigService.getState(ref: ref).user?.unreadNotificationsCount ?? "0",
|
|
|
boxWidth: 20.0,
|
|
|
textColor: Colors.white,
|
|
|
fontSize: 10,
|
|
@@ -212,7 +228,9 @@ class HomePage extends HookConsumerWidget {
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
- ));
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
//顶部的支付与奖励的布局
|
|
@@ -269,7 +287,7 @@ class HomePage extends HookConsumerWidget {
|
|
|
isFontRegular: true,
|
|
|
).paddingOnly(left: 8, right: 4).expanded(),
|
|
|
MyTextView(
|
|
|
- "9568",
|
|
|
+ UserConfigService.getState(ref: ref).user?.rewardPoints ?? "0",
|
|
|
textColor: context.appColors.textBlack,
|
|
|
fontSize: 14,
|
|
|
isFontBold: true,
|