组件优化
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,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user