|
@@ -1,41 +1,223 @@
|
|
|
+import 'package:cpt_main/modules/demo_page.dart';
|
|
|
+import 'package:cs_resources/generated/assets.dart';
|
|
|
+import 'package:cs_resources/generated/l10n.dart';
|
|
|
+import 'package:cs_resources/theme/app_colors_theme.dart';
|
|
|
+import 'package:cs_resources/theme/theme_config.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:auto_route/auto_route.dart';
|
|
|
-import 'package:plugin_basic/modules/global_web_page.dart';
|
|
|
-import 'package:plugin_basic/provider/user_config/user_config_service.dart';
|
|
|
-import 'package:router/componentRouter/component_service_manager.dart';
|
|
|
+import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
|
+import 'package:widgets/ext/ex_widget.dart';
|
|
|
+import 'package:widgets/my_appbar.dart';
|
|
|
+import 'package:widgets/my_load_image.dart';
|
|
|
+import 'package:widgets/my_text_view.dart';
|
|
|
+import 'package:widgets/shatter/setting_item_container.dart';
|
|
|
+
|
|
|
+import 'me_view_model.dart';
|
|
|
|
|
|
@RoutePage()
|
|
|
-class MePage extends StatelessWidget {
|
|
|
+class MePage extends HookConsumerWidget {
|
|
|
const MePage({Key? key}) : super(key: key);
|
|
|
|
|
|
@override
|
|
|
- Widget build(BuildContext context) {
|
|
|
+ Widget build(BuildContext context, WidgetRef ref) {
|
|
|
+ final viewModel = ref.watch(meViewModelProvider.notifier);
|
|
|
+
|
|
|
return Scaffold(
|
|
|
- appBar: AppBar(title: Text("Me")),
|
|
|
- body:Center(
|
|
|
- child: Column(
|
|
|
- children: [
|
|
|
- ElevatedButton(
|
|
|
- onPressed: () {
|
|
|
- UserConfigService.getInstance().setUserInfo("李四");
|
|
|
- },
|
|
|
- child: const Text('跨页面修改用户信息'),
|
|
|
- ),
|
|
|
- ElevatedButton(
|
|
|
- onPressed: () {
|
|
|
- ComponentServiceManager().profileService.startEditProfilePage(context: context);
|
|
|
- },
|
|
|
- child: const Text('Go to Edit Profile Page'),
|
|
|
- ),
|
|
|
- ElevatedButton(
|
|
|
- onPressed: () {
|
|
|
- GlobalWebPage.startInstance(context: context, title: "baidu", url: "https://www.baidu.com");
|
|
|
- },
|
|
|
- child: const Text('Go to Global Web Page'),
|
|
|
- ),
|
|
|
- ],
|
|
|
+ appBar: MyAppBar.appBar(
|
|
|
+ context,
|
|
|
+ "",
|
|
|
+ showBackButton: false,
|
|
|
+ backgroundColor: context.appColors.btnBgDefault,
|
|
|
+ systemUiOverlayStyle: ThemeConfig.systemUiOverlayStyleLightThemeWhite,
|
|
|
+ ),
|
|
|
+ backgroundColor: context.appColors.backgroundDark,
|
|
|
+ body: SingleChildScrollView(
|
|
|
+ scrollDirection: Axis.vertical,
|
|
|
+ physics: const BouncingScrollPhysics(),
|
|
|
+ child: SizedBox(
|
|
|
+ width: double.infinity,
|
|
|
+ child: Column(
|
|
|
+ mainAxisSize: MainAxisSize.max,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ //顶部信息
|
|
|
+ _buildTopProfile(context, ref),
|
|
|
+
|
|
|
+ //关注与粉丝
|
|
|
+ _buildFollower(context, ref),
|
|
|
+
|
|
|
+ //我的发布
|
|
|
+ SettingItemContainer(
|
|
|
+ title: S.current.my_post,
|
|
|
+ iconPath: Assets.mainMeMyPostIcon,
|
|
|
+ isShowMoreIcon: true,
|
|
|
+ rightWidget: MyTextView(
|
|
|
+ "265",
|
|
|
+ textColor: context.appColors.textPrimary,
|
|
|
+ fontSize: 20,
|
|
|
+ isFontMedium: true,
|
|
|
+ ),
|
|
|
+ ).onTap(viewModel.gotoMyPostPage).marginOnly(top: 10),
|
|
|
+
|
|
|
+ //家庭
|
|
|
+ SettingItemContainer(
|
|
|
+ title: S.current.household,
|
|
|
+ iconPath: Assets.mainMeHouseholdIcon,
|
|
|
+ isShowMoreIcon: true,
|
|
|
+ rightWidget: MyTextView(
|
|
|
+ "2",
|
|
|
+ textColor: context.appColors.textPrimary,
|
|
|
+ fontSize: 20,
|
|
|
+ isFontMedium: true,
|
|
|
+ ),
|
|
|
+ ).onTap(viewModel.gotoMyHouseholdPage),
|
|
|
+
|
|
|
+ //房产
|
|
|
+ SettingItemContainer(
|
|
|
+ title: S.current.estate,
|
|
|
+ iconPath: Assets.mainMeEstateIcon,
|
|
|
+ isShowMoreIcon: true,
|
|
|
+ rightWidget: MyTextView(
|
|
|
+ "2",
|
|
|
+ textColor: context.appColors.textPrimary,
|
|
|
+ fontSize: 20,
|
|
|
+ isFontMedium: true,
|
|
|
+ ),
|
|
|
+ ).onTap(viewModel.gotoMyEstatePage),
|
|
|
+
|
|
|
+ //设置
|
|
|
+ SettingItemContainer(
|
|
|
+ title: S.current.settings,
|
|
|
+ iconPath: Assets.mainMeSettingIcon,
|
|
|
+ isShowMoreIcon: true,
|
|
|
+ ).onTap(viewModel.gotoSettingPage),
|
|
|
+
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
);
|
|
|
}
|
|
|
+
|
|
|
+ //编辑顶部的关注与粉丝数量
|
|
|
+ Widget _buildFollower(BuildContext context, WidgetRef ref) {
|
|
|
+ final viewModel = ref.watch(meViewModelProvider.notifier);
|
|
|
+ return Container(
|
|
|
+ color: context.appColors.whiteSecondBG,
|
|
|
+ width: double.infinity,
|
|
|
+ height: 50,
|
|
|
+ child: Row(
|
|
|
+ children: [
|
|
|
+ //关注
|
|
|
+ Row(
|
|
|
+ mainAxisSize: MainAxisSize.min,
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ MyTextView(
|
|
|
+ S.current.following,
|
|
|
+ isFontBold: true,
|
|
|
+ fontSize: 16,
|
|
|
+ textColor: context.appColors.textBlack,
|
|
|
+ ),
|
|
|
+ MyTextView(
|
|
|
+ "(26)",
|
|
|
+ isFontBold: true,
|
|
|
+ fontSize: 16,
|
|
|
+ textColor: context.appColors.textPrimary,
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ).onTap(viewModel.gotoFollowingPage).expanded(),
|
|
|
+
|
|
|
+ Container(
|
|
|
+ width: 0.5,
|
|
|
+ height: 50,
|
|
|
+ color: context.appColors.dividerDefault,
|
|
|
+ ),
|
|
|
+ //粉丝
|
|
|
+ Row(
|
|
|
+ mainAxisSize: MainAxisSize.min,
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ MyTextView(
|
|
|
+ S.current.followers,
|
|
|
+ isFontBold: true,
|
|
|
+ fontSize: 16,
|
|
|
+ textColor: context.appColors.textBlack,
|
|
|
+ ),
|
|
|
+ MyTextView(
|
|
|
+ "(12)",
|
|
|
+ isFontBold: true,
|
|
|
+ fontSize: 16,
|
|
|
+ textColor: context.appColors.textPrimary,
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ).onTap(viewModel.gotoFollowerPage).expanded(),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ // 编辑顶部的个人信息
|
|
|
+ Widget _buildTopProfile(BuildContext context, WidgetRef ref) {
|
|
|
+ final viewModel = ref.watch(meViewModelProvider.notifier);
|
|
|
+ return Container(
|
|
|
+ color: context.appColors.btnBgDefault,
|
|
|
+ width: double.infinity,
|
|
|
+ padding: const EdgeInsets.only(left: 26, right: 20, top: 5),
|
|
|
+ height: 120,
|
|
|
+ child: Row(
|
|
|
+ mainAxisSize: MainAxisSize.max,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ MyLoadImage(
|
|
|
+ "https://img1.baidu.com/it/u=1656098746,3560654086&fm=253&fmt=auto&app=120&f=JPEG?w=800&h=800",
|
|
|
+ width: 80,
|
|
|
+ height: 80,
|
|
|
+ isCircle: true,
|
|
|
+ ),
|
|
|
+ Column(
|
|
|
+ mainAxisSize: MainAxisSize.min,
|
|
|
+ mainAxisAlignment: MainAxisAlignment.start,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ Row(
|
|
|
+ children: [
|
|
|
+ MyTextView(
|
|
|
+ "Wu Bing Bing",
|
|
|
+ textColor: Colors.white,
|
|
|
+ fontSize: 18,
|
|
|
+ isFontMedium: true,
|
|
|
+ ).expanded(),
|
|
|
+ const MyAssetImage(
|
|
|
+ Assets.mainMeEditIcon,
|
|
|
+ width: 20.5,
|
|
|
+ height: 20,
|
|
|
+ ).onTap(viewModel.gotoEditProfilePage, padding: 5),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+
|
|
|
+ //电话
|
|
|
+ MyTextView(
|
|
|
+ "+86 12345678901",
|
|
|
+ textColor: Colors.white,
|
|
|
+ fontSize: 15,
|
|
|
+ isFontRegular: true,
|
|
|
+ ),
|
|
|
+
|
|
|
+ //住宅
|
|
|
+ MyTextView(
|
|
|
+ "Owner135 #08-29",
|
|
|
+ marginTop: 12,
|
|
|
+ textColor: Colors.white,
|
|
|
+ fontSize: 15,
|
|
|
+ isFontRegular: true,
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ).marginOnly(left: 11).expanded(),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|