From 099d2b442333a7712a03b01ab1a7d5f834df8a3d Mon Sep 17 00:00:00 2001 From: Jason Date: Wed, 26 Oct 2022 13:41:29 +0800 Subject: [PATCH] user-page --- lib/configs/app_colors.dart | 17 ---- lib/views/home/widgets/action_item.dart | 2 +- .../index/widgets/moment_list_reply.dart | 10 +-- .../index/widgets/quick_reply_bar.dart | 2 +- lib/views/moments/publish/publish_page.dart | 2 +- lib/views/user/index/index_page.dart | 28 +++--- .../user/index/widgets/user_top_bar.dart | 15 ++-- lib/views/user/info/index_page.dart | 10 +-- lib/views/user/setting/index_page.dart | 90 ++++++++++++++++++- lib/views/user/widgets/link_action_item.dart | 10 ++- 10 files changed, 132 insertions(+), 54 deletions(-) diff --git a/lib/configs/app_colors.dart b/lib/configs/app_colors.dart index 7dec946..97984f8 100644 --- a/lib/configs/app_colors.dart +++ b/lib/configs/app_colors.dart @@ -51,21 +51,4 @@ class AppColors { static const Color golden = Color(0xfffca106); // 枇杷黄 static const Color mainBlack = Color(0xff000000); - - static const Color tMainBg = Color(0xfff9f9f9); - static const Color tVipBg = Color(0xff242430); - static const Color tNack = Color(0xfffcc590); - static const Color tNack1 = Color(0xfffcc692); - static const Color tVip1 = Color(0xfffce3c5); - static const Color tVip2 = Color(0xfffcc590); - static const Color tVip3 = Color(0xff9f5529); - static const Color tVip4 = Color(0xff3e5364); - static const Color tVip5 = Color(0xff31364a); - - static const Color tMainColor = Color(0xfffdbb03); - static const Color tMainRedColor = Color(0xffe6576b); - static const Color tTextColor = Color(0xff333333); - static const Color tTextColor333 = Color(0xff333333); - static const Color tTextColor666 = Color(0xff666666); - static const Color tTextColor999 = Color(0xff999999); } diff --git a/lib/views/home/widgets/action_item.dart b/lib/views/home/widgets/action_item.dart index e043719..38aecfd 100644 --- a/lib/views/home/widgets/action_item.dart +++ b/lib/views/home/widgets/action_item.dart @@ -50,7 +50,7 @@ class ActionItem extends StatelessWidget { rightWidget ?? const Icon( Icons.arrow_forward_ios, - size: 16, + size: 14, color: AppColors.unactive, ), ], diff --git a/lib/views/moments/index/widgets/moment_list_reply.dart b/lib/views/moments/index/widgets/moment_list_reply.dart index f98689d..75698bd 100644 --- a/lib/views/moments/index/widgets/moment_list_reply.dart +++ b/lib/views/moments/index/widgets/moment_list_reply.dart @@ -94,7 +94,7 @@ class MomentListItemReplay extends StatelessWidget { Text( '查看全部$listLength条回复', style: const TextStyle( - color: AppColors.tTextColor999, + color: AppColors.active, fontSize: 12, ), ), @@ -104,7 +104,7 @@ class MomentListItemReplay extends StatelessWidget { ), child: Icon( Icons.keyboard_arrow_down, - color: AppColors.tTextColor999, + color: AppColors.active, size: 16, ), ), @@ -143,7 +143,7 @@ class MomentListItemReplay extends StatelessWidget { text: comment.content ?? '', style: const TextStyle( fontWeight: FontWeight.normal, - color: AppColors.tTextColor333, + color: AppColors.active, fontSize: 13, ), ), @@ -161,7 +161,7 @@ class MomentListItemReplay extends StatelessWidget { text: ' 回复 ', style: TextStyle( fontWeight: FontWeight.normal, - color: AppColors.tTextColor333, + color: AppColors.active, fontSize: 13, ), ), @@ -175,7 +175,7 @@ class MomentListItemReplay extends StatelessWidget { text: comment.content ?? '', style: const TextStyle( fontWeight: FontWeight.normal, - color: AppColors.tTextColor333, + color: AppColors.active, fontSize: 13, ), ), diff --git a/lib/views/moments/index/widgets/quick_reply_bar.dart b/lib/views/moments/index/widgets/quick_reply_bar.dart index 031d17a..77bdca4 100644 --- a/lib/views/moments/index/widgets/quick_reply_bar.dart +++ b/lib/views/moments/index/widgets/quick_reply_bar.dart @@ -75,7 +75,7 @@ class _QuickReplyBarState extends State { backgroundColor: MaterialStateProperty.resolveWith( (states) { if (states.contains(MaterialState.disabled)) { - return AppColors.tTextColor999.withAlpha(128); + return AppColors.active.withAlpha(128); } else { return AppColors.primary; } diff --git a/lib/views/moments/publish/publish_page.dart b/lib/views/moments/publish/publish_page.dart index 3ef1553..da542c6 100644 --- a/lib/views/moments/publish/publish_page.dart +++ b/lib/views/moments/publish/publish_page.dart @@ -29,7 +29,7 @@ class MomentsPublishPage extends StatelessWidget { backgroundColor: MaterialStateProperty.resolveWith( (states) { if (states.contains(MaterialState.disabled)) { - return AppColors.tTextColor999.withAlpha(128); + return AppColors.active.withAlpha(128); } else { return AppColors.primary; } diff --git a/lib/views/user/index/index_page.dart b/lib/views/user/index/index_page.dart index 9232781..f112e68 100644 --- a/lib/views/user/index/index_page.dart +++ b/lib/views/user/index/index_page.dart @@ -29,6 +29,21 @@ class _UserPageState extends State { height: 0, color: AppColors.border, ), + ActionItem( + '服务', + onTap: () { + Get.toNamed(UserRoutes.share); + }, + ), + const Divider( + height: 0, + color: AppColors.border, + ), + const SizedBox(height: 8), + const Divider( + height: 0, + color: AppColors.border, + ), ActionItem( '分享邀请', onTap: () { @@ -41,18 +56,7 @@ class _UserPageState extends State { indent: 16, ), ActionItem( - '安全设置', - onTap: () { - Get.toNamed(UserRoutes.safe); - }, - ), - const Divider( - height: 0, - color: AppColors.border, - indent: 16, - ), - ActionItem( - '设置中心', + '设置', onTap: () { Get.toNamed(UserRoutes.setting); }, diff --git a/lib/views/user/index/widgets/user_top_bar.dart b/lib/views/user/index/widgets/user_top_bar.dart index 4298d7a..04de801 100644 --- a/lib/views/user/index/widgets/user_top_bar.dart +++ b/lib/views/user/index/widgets/user_top_bar.dart @@ -40,11 +40,16 @@ class UserTopBar extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - _.userInfo.value.nickname ?? '', - style: const TextStyle( - fontSize: 22, - fontWeight: FontWeight.w400, + InkWell( + onTap: () { + Get.toNamed(UserRoutes.info); + }, + child: Text( + _.userInfo.value.nickname ?? '', + style: const TextStyle( + fontSize: 22, + fontWeight: FontWeight.w400, + ), ), ), Row( diff --git a/lib/views/user/info/index_page.dart b/lib/views/user/info/index_page.dart index d7f6a8a..742eaeb 100644 --- a/lib/views/user/info/index_page.dart +++ b/lib/views/user/info/index_page.dart @@ -1,9 +1,8 @@ -import 'package:chat/configs/app_colors.dart'; import 'package:chat/controllers/user_controller.dart'; import 'package:chat/routes/user_routes.dart'; import 'package:chat/services/auth_service.dart'; import 'package:chat/views/user/widgets/link_action_item.dart'; -import 'package:chat/widgets/custom_circle_avatar.dart'; +import 'package:chat/widgets/custom_avatar.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:image_cropper/image_cropper.dart'; @@ -45,11 +44,10 @@ class _UserInfoPageState extends State { _cropImage((await result.first.file)!.path); }, - trailing: CustomCircleAvatar( + isLink: true, + trailing: CustomAvatar( _.userInfo.value.avatar, - size: 44, - borderWidth: 0.8, - borderColor: AppColors.primary, + size: 52, ), ), LinkActionItem( diff --git a/lib/views/user/setting/index_page.dart b/lib/views/user/setting/index_page.dart index 17554e1..e7c0305 100644 --- a/lib/views/user/setting/index_page.dart +++ b/lib/views/user/setting/index_page.dart @@ -1,5 +1,10 @@ +import 'package:chat/configs/app_colors.dart'; +import 'package:chat/routes/user_routes.dart'; import 'package:chat/services/auth_service.dart'; +import 'package:chat/views/home/widgets/action_button.dart'; +import 'package:chat/views/home/widgets/action_item.dart'; import 'package:flutter/material.dart'; +import 'package:get/get.dart'; class UserSettingPage extends StatefulWidget { const UserSettingPage({Key? key}) : super(key: key); @@ -17,11 +22,90 @@ class _UserSettingPageState extends State { ), body: Column( children: [ - ElevatedButton( - onPressed: () { + ActionItem( + '账号与安全', + onTap: () { + Get.toNamed(UserRoutes.safe); + }, + ), + const Divider( + height: 0, + color: AppColors.border, + ), + const SizedBox(height: 8), + const Divider( + height: 0, + color: AppColors.border, + ), + ActionItem( + '新消息通知', + onTap: () { + Get.toNamed(UserRoutes.safe); + }, + ), + const Divider( + height: 0, + color: AppColors.border, + indent: 16, + ), + ActionItem( + '隐私权限', + onTap: () { + Get.toNamed(UserRoutes.safe); + }, + ), + const Divider( + height: 0, + color: AppColors.border, + ), + const SizedBox(height: 8), + ActionItem( + '关于ZH-CHAT', + onTap: () { + Get.toNamed(UserRoutes.safe); + }, + ), + const Divider( + height: 0, + color: AppColors.border, + indent: 16, + ), + ActionItem( + '帮助与反馈', + onTap: () { + Get.toNamed(UserRoutes.safe); + }, + ), + const SizedBox(height: 8), + const Divider( + height: 0, + color: AppColors.border, + ), + ActionItem( + '版本更新', + onTap: () { + Get.toNamed(UserRoutes.safe); + }, + ), + const Divider( + height: 0, + color: AppColors.border, + ), + const SizedBox(height: 8), + const Divider( + height: 0, + color: AppColors.border, + ), + ActionButton( + '退出', + color: AppColors.primary, + onTap: () async { AuthService.to.logout(); }, - child: const Text('退出登录'), + ), + const Divider( + height: 0, + color: AppColors.border, ), ], ), diff --git a/lib/views/user/widgets/link_action_item.dart b/lib/views/user/widgets/link_action_item.dart index 73f627c..6fb61bd 100644 --- a/lib/views/user/widgets/link_action_item.dart +++ b/lib/views/user/widgets/link_action_item.dart @@ -59,9 +59,13 @@ class LinkActionItem extends StatelessWidget { ), if (trailing != null) trailing!, if (isLink == true) - const Icon( - Icons.chevron_right, - color: AppColors.unactive, + const Padding( + padding: EdgeInsets.only(left: 4), + child: Icon( + Icons.arrow_forward_ios, + color: AppColors.unactive, + size: 14, + ), ), ], ),