组件优化
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import 'package:chat/configs/app_colors.dart';
|
||||
import 'package:chat/routes/user_routes.dart';
|
||||
import 'package:chat/views/home/widgets/action_item.dart';
|
||||
import 'package:chat/views/user/index/widgets/user_top_bar.dart';
|
||||
@@ -14,51 +13,30 @@ class UserPage extends StatelessWidget {
|
||||
body: Column(
|
||||
children: [
|
||||
const UserTopBar(),
|
||||
const Divider(
|
||||
height: 0,
|
||||
color: AppColors.border,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
const Divider(
|
||||
height: 0,
|
||||
color: AppColors.border,
|
||||
),
|
||||
ActionItem(
|
||||
'服务',
|
||||
isFirst: true,
|
||||
isLast: true,
|
||||
onTap: () {
|
||||
Get.toNamed(UserRoutes.serve);
|
||||
},
|
||||
),
|
||||
const Divider(
|
||||
height: 0,
|
||||
color: AppColors.border,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
const Divider(
|
||||
height: 0,
|
||||
color: AppColors.border,
|
||||
),
|
||||
ActionItem(
|
||||
'分享邀请',
|
||||
isFirst: true,
|
||||
onTap: () {
|
||||
Get.toNamed(UserRoutes.share);
|
||||
},
|
||||
),
|
||||
const Divider(
|
||||
height: 0,
|
||||
color: AppColors.border,
|
||||
indent: 16,
|
||||
),
|
||||
ActionItem(
|
||||
'设置',
|
||||
isLast: true,
|
||||
onTap: () {
|
||||
Get.toNamed(UserRoutes.setting);
|
||||
},
|
||||
),
|
||||
const Divider(
|
||||
height: 0,
|
||||
color: AppColors.border,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -17,97 +17,108 @@ class UserTopBar extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: AppColors.white,
|
||||
padding: EdgeInsets.only(
|
||||
left: 24,
|
||||
top: paddingTop,
|
||||
right: 24,
|
||||
bottom: paddingBottom,
|
||||
),
|
||||
height: avatarHeight + paddingTop + paddingBottom,
|
||||
child: GetX<AuthService>(builder: (_) {
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Get.toNamed(UserRoutes.info);
|
||||
},
|
||||
child: CustomAvatar(
|
||||
_.userInfo.value.avatar,
|
||||
size: avatarHeight,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Get.toNamed(UserRoutes.info);
|
||||
},
|
||||
child: Text(
|
||||
_.userInfo.value.nickname ?? '',
|
||||
style: const TextStyle(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.w400,
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
color: AppColors.white,
|
||||
padding: EdgeInsets.only(
|
||||
left: 24,
|
||||
top: paddingTop,
|
||||
right: 24,
|
||||
bottom: paddingBottom,
|
||||
),
|
||||
height: avatarHeight + paddingTop + paddingBottom,
|
||||
child: GetX<AuthService>(
|
||||
builder: (_) {
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Get.toNamed(UserRoutes.info);
|
||||
},
|
||||
child: CustomAvatar(
|
||||
_.userInfo.value.avatar,
|
||||
size: avatarHeight,
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
Convert.hideCenterStr(_.userInfo.value.address ?? ''),
|
||||
style: const TextStyle(
|
||||
color: AppColors.unactive,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Clipboard.setData(
|
||||
ClipboardData(
|
||||
text: _.userInfo.value.address,
|
||||
const SizedBox(width: 16),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Get.toNamed(UserRoutes.info);
|
||||
},
|
||||
child: Text(
|
||||
_.userInfo.value.nickname ?? '',
|
||||
style: const TextStyle(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
);
|
||||
UiTools.toast('地址复制成功');
|
||||
},
|
||||
child: const Icon(
|
||||
Icons.copy,
|
||||
size: 12,
|
||||
color: AppColors.unactive,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Expanded(child: Container()),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Get.toNamed(UserRoutes.qrCode);
|
||||
},
|
||||
child: Row(
|
||||
children: const [
|
||||
Icon(
|
||||
Icons.qr_code,
|
||||
size: 18,
|
||||
color: AppColors.unactive,
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
Convert.hideCenterStr(
|
||||
_.userInfo.value.address ?? ''),
|
||||
style: const TextStyle(
|
||||
color: AppColors.unactive,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Clipboard.setData(
|
||||
ClipboardData(
|
||||
text: _.userInfo.value.address,
|
||||
),
|
||||
);
|
||||
UiTools.toast('地址复制成功');
|
||||
},
|
||||
child: const Icon(
|
||||
Icons.copy,
|
||||
size: 12,
|
||||
color: AppColors.unactive,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 16,
|
||||
color: AppColors.unactive,
|
||||
Expanded(child: Container()),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Get.toNamed(UserRoutes.qrCode);
|
||||
},
|
||||
child: Row(
|
||||
children: const [
|
||||
Icon(
|
||||
Icons.qr_code,
|
||||
size: 18,
|
||||
color: AppColors.unactive,
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 16,
|
||||
color: AppColors.unactive,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
const Divider(
|
||||
height: 0,
|
||||
color: AppColors.border,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:chat/configs/app_colors.dart';
|
||||
import 'package:chat/routes/app_routes.dart';
|
||||
import 'package:chat/routes/user_routes.dart';
|
||||
import 'package:chat/views/home/widgets/action_item.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -22,13 +22,17 @@ class _UserServePageState extends State<UserServePage> {
|
||||
children: [
|
||||
ActionItem(
|
||||
'谷歌验证器',
|
||||
isFirst: true,
|
||||
onTap: () {
|
||||
Get.toNamed(UserRoutes.serveGoogle);
|
||||
},
|
||||
),
|
||||
const Divider(
|
||||
height: 0,
|
||||
color: AppColors.border,
|
||||
ActionItem(
|
||||
'扫一扫',
|
||||
isLast: true,
|
||||
onTap: () {
|
||||
Get.toNamed(AppRoutes.scan);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -25,52 +25,35 @@ class _UserSettingPageState extends State<UserSettingPage> {
|
||||
children: [
|
||||
ActionItem(
|
||||
'账号与安全',
|
||||
isFirst: true,
|
||||
isLast: true,
|
||||
onTap: () {
|
||||
Get.toNamed(UserRoutes.settingSafe);
|
||||
},
|
||||
),
|
||||
const Divider(
|
||||
height: 0,
|
||||
color: AppColors.border,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
const Divider(
|
||||
height: 0,
|
||||
color: AppColors.border,
|
||||
),
|
||||
ActionItem(
|
||||
'新消息通知',
|
||||
isFirst: true,
|
||||
onTap: () {
|
||||
Get.toNamed(UserRoutes.settingSafe);
|
||||
},
|
||||
),
|
||||
const Divider(
|
||||
height: 0,
|
||||
color: AppColors.border,
|
||||
indent: 16,
|
||||
),
|
||||
ActionItem(
|
||||
'隐私权限',
|
||||
isLast: true,
|
||||
onTap: () {
|
||||
Get.toNamed(UserRoutes.settingPrivacy);
|
||||
},
|
||||
),
|
||||
const Divider(
|
||||
height: 0,
|
||||
color: AppColors.border,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
ActionItem(
|
||||
'关于ZH-CHAT',
|
||||
isFirst: true,
|
||||
onTap: () {
|
||||
Get.toNamed(UserRoutes.settingAbout);
|
||||
},
|
||||
),
|
||||
const Divider(
|
||||
height: 0,
|
||||
color: AppColors.border,
|
||||
indent: 16,
|
||||
),
|
||||
ActionItem(
|
||||
'帮助与反馈',
|
||||
onTap: () {
|
||||
@@ -78,26 +61,18 @@ class _UserSettingPageState extends State<UserSettingPage> {
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
const Divider(
|
||||
height: 0,
|
||||
color: AppColors.border,
|
||||
),
|
||||
ActionItem(
|
||||
'版本更新',
|
||||
isFirst: true,
|
||||
isLast: true,
|
||||
onTap: () {},
|
||||
),
|
||||
const Divider(
|
||||
height: 0,
|
||||
color: AppColors.border,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
const Divider(
|
||||
height: 0,
|
||||
color: AppColors.border,
|
||||
),
|
||||
ActionButton(
|
||||
'退出',
|
||||
color: AppColors.primary,
|
||||
hasTop: true,
|
||||
hasBottom: true,
|
||||
color: AppColors.red,
|
||||
onTap: () async {
|
||||
OkCancelResult result = await showOkCancelAlertDialog(
|
||||
style: AdaptiveStyle.iOS,
|
||||
@@ -113,10 +88,6 @@ class _UserSettingPageState extends State<UserSettingPage> {
|
||||
}
|
||||
},
|
||||
),
|
||||
const Divider(
|
||||
height: 0,
|
||||
color: AppColors.border,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -24,6 +24,8 @@ class _UserSettingSafePageState extends State<UserSettingSafePage> {
|
||||
children: [
|
||||
ActionItem(
|
||||
'导出助记词',
|
||||
isFirst: true,
|
||||
isLast: true,
|
||||
onTap: () {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
@@ -66,32 +68,17 @@ class _UserSettingSafePageState extends State<UserSettingSafePage> {
|
||||
);
|
||||
},
|
||||
),
|
||||
const Divider(
|
||||
height: 0,
|
||||
color: AppColors.border,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
const Divider(
|
||||
height: 0,
|
||||
color: AppColors.border,
|
||||
),
|
||||
ActionItem(
|
||||
'绑定手机',
|
||||
isFirst: true,
|
||||
onTap: () {},
|
||||
),
|
||||
const Divider(
|
||||
height: 0,
|
||||
indent: 16,
|
||||
color: AppColors.border,
|
||||
),
|
||||
ActionItem(
|
||||
'绑定邮箱',
|
||||
isLast: true,
|
||||
onTap: () {},
|
||||
),
|
||||
const Divider(
|
||||
height: 0,
|
||||
color: AppColors.border,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user