组件优化
This commit is contained in:
@@ -66,9 +66,9 @@ class ContactFriendProfilePage extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
const Divider(height: 0),
|
||||
ActionItem(
|
||||
'设置备注',
|
||||
isLast: true,
|
||||
extend: _.currentFriend.value.friendRemark,
|
||||
onTap: () {
|
||||
Get.toNamed(
|
||||
@@ -76,9 +76,11 @@ class ContactFriendProfilePage extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
const SizedBox(height: 9),
|
||||
ActionItem(
|
||||
'他的动态',
|
||||
isFirst: true,
|
||||
isLast: true,
|
||||
onTap: () {
|
||||
Get.toNamed(
|
||||
MomentsRoutes.user,
|
||||
@@ -93,6 +95,8 @@ class ContactFriendProfilePage extends StatelessWidget {
|
||||
visible: !_.currentFriend.value.isFriend,
|
||||
child: ActionButton(
|
||||
'添加到通讯录',
|
||||
hasTop: true,
|
||||
hasBottom: true,
|
||||
onTap: () {
|
||||
Get.toNamed(
|
||||
ContactRoutes.friendRequestApply,
|
||||
@@ -107,7 +111,8 @@ class ContactFriendProfilePage extends StatelessWidget {
|
||||
visible: _.currentFriend.value.isFriend,
|
||||
child: ActionButton(
|
||||
'发消息',
|
||||
color: AppColors.primary,
|
||||
hasTop: true,
|
||||
hasBottom: true,
|
||||
onTap: () async {
|
||||
var result = await TimConversationService
|
||||
.to.conversationManager
|
||||
@@ -125,15 +130,11 @@ class ContactFriendProfilePage extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: _.currentFriend.value.isFriend,
|
||||
child: const Divider(height: 0),
|
||||
),
|
||||
Visibility(
|
||||
visible: _.currentFriend.value.isFriend,
|
||||
child: ActionButton(
|
||||
'音视频通话',
|
||||
color: AppColors.primary,
|
||||
hasBottom: true,
|
||||
onTap: () {
|
||||
ImTools.showTrtcMessage(_.currentFriend.value.userID);
|
||||
},
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
||||
import 'package:chat/configs/app_colors.dart';
|
||||
import 'package:chat/controllers/private_controller.dart';
|
||||
import 'package:chat/routes/contact_routes.dart';
|
||||
import 'package:chat/services/tim/block_service.dart';
|
||||
@@ -23,6 +24,8 @@ class ContactFriendProfileMorePage extends StatelessWidget {
|
||||
children: [
|
||||
ActionItem(
|
||||
'设置备注',
|
||||
isFirst: true,
|
||||
isLast: true,
|
||||
extend: _.currentFriend.value.friendRemark,
|
||||
onTap: () {
|
||||
Get.toNamed(
|
||||
@@ -33,6 +36,8 @@ class ContactFriendProfileMorePage extends StatelessWidget {
|
||||
const SizedBox(height: 8),
|
||||
ActionItem(
|
||||
'把他推荐给朋友',
|
||||
isFirst: true,
|
||||
isLast: true,
|
||||
onTap: () {
|
||||
Get.toNamed(
|
||||
ContactRoutes.friendRecommend,
|
||||
@@ -42,6 +47,8 @@ class ContactFriendProfileMorePage extends StatelessWidget {
|
||||
const SizedBox(height: 8),
|
||||
ActionItem(
|
||||
'加入黑名单',
|
||||
isFirst: true,
|
||||
isLast: true,
|
||||
rightWidget: SizedBox(
|
||||
height: 24,
|
||||
child: Switch(
|
||||
@@ -74,6 +81,9 @@ class ContactFriendProfileMorePage extends StatelessWidget {
|
||||
const SizedBox(height: 8),
|
||||
ActionButton(
|
||||
'删除',
|
||||
hasTop: true,
|
||||
hasBottom: true,
|
||||
color: AppColors.red,
|
||||
onTap: () async {
|
||||
OkCancelResult result = await showOkCancelAlertDialog(
|
||||
style: AdaptiveStyle.iOS,
|
||||
|
||||
@@ -37,6 +37,7 @@ class ConversationInfoGroupPage extends StatelessWidget {
|
||||
children: [
|
||||
ActionItem(
|
||||
'群聊名称',
|
||||
isFirst: true,
|
||||
extend: group?.groupName,
|
||||
onTap: () {
|
||||
if (currentGroup.isAdmin || currentGroup.isOwner) {
|
||||
@@ -46,7 +47,6 @@ class ConversationInfoGroupPage extends StatelessWidget {
|
||||
}
|
||||
},
|
||||
),
|
||||
const Divider(height: 0, indent: 16),
|
||||
ActionItem(
|
||||
'群二维码',
|
||||
onTap: () {
|
||||
@@ -55,7 +55,6 @@ class ConversationInfoGroupPage extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
),
|
||||
const Divider(height: 0, indent: 16),
|
||||
ActionItem(
|
||||
'群公告',
|
||||
bottom: group?.notification,
|
||||
@@ -65,13 +64,6 @@ class ConversationInfoGroupPage extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
),
|
||||
Visibility(
|
||||
visible: currentGroup.isAdmin || currentGroup.isOwner,
|
||||
child: const Divider(
|
||||
height: 0,
|
||||
indent: 16,
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: currentGroup.isAdmin || currentGroup.isOwner,
|
||||
child: ActionItem(
|
||||
@@ -83,17 +75,11 @@ class ConversationInfoGroupPage extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: currentGroup.isAdmin || currentGroup.isOwner,
|
||||
child: const Divider(
|
||||
height: 0,
|
||||
indent: 16,
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: currentGroup.isAdmin || currentGroup.isOwner,
|
||||
child: ActionItem(
|
||||
'加群申请',
|
||||
isLast: true,
|
||||
onTap: () {
|
||||
Get.toNamed(
|
||||
ContactRoutes.groupApprove,
|
||||
@@ -140,10 +126,6 @@ class ConversationInfoGroupPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
const Divider(
|
||||
height: 0,
|
||||
indent: 16,
|
||||
),
|
||||
ActionItem(
|
||||
'置顶聊天',
|
||||
rightWidget: SizedBox(
|
||||
|
||||
@@ -80,22 +80,21 @@ class ConversationInfoPrivatePage extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
const Divider(height: 0),
|
||||
const SizedBox(height: 8),
|
||||
const Divider(height: 0),
|
||||
ActionItem(
|
||||
'查找聊天记录',
|
||||
isFirst: true,
|
||||
isLast: true,
|
||||
onTap: () {
|
||||
// Get.toNamed(
|
||||
// ImRoutes.conversationSearch,
|
||||
// );
|
||||
},
|
||||
),
|
||||
const Divider(height: 0),
|
||||
const SizedBox(height: 8),
|
||||
const Divider(height: 0),
|
||||
ActionItem(
|
||||
'消息免打扰',
|
||||
isFirst: true,
|
||||
rightWidget: SizedBox(
|
||||
height: 24,
|
||||
child: Switch(
|
||||
@@ -107,12 +106,9 @@ class ConversationInfoPrivatePage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
const Divider(
|
||||
height: 0,
|
||||
indent: 16,
|
||||
),
|
||||
ActionItem(
|
||||
'置顶聊天',
|
||||
isLast: true,
|
||||
rightWidget: SizedBox(
|
||||
height: 24,
|
||||
child: Switch(
|
||||
@@ -124,11 +120,11 @@ class ConversationInfoPrivatePage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
const Divider(height: 0),
|
||||
const SizedBox(height: 8),
|
||||
const Divider(height: 0),
|
||||
ActionItem(
|
||||
'清空聊天记录',
|
||||
isFirst: true,
|
||||
isLast: true,
|
||||
onTap: () async {
|
||||
OkCancelResult result = await showOkCancelAlertDialog(
|
||||
style: AdaptiveStyle.iOS,
|
||||
@@ -147,7 +143,6 @@ class ConversationInfoPrivatePage extends StatelessWidget {
|
||||
}
|
||||
},
|
||||
),
|
||||
const Divider(height: 0),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -5,10 +5,14 @@ class ActionButton extends StatelessWidget {
|
||||
final String text;
|
||||
final Color color;
|
||||
final VoidCallback? onTap;
|
||||
final bool hasTop;
|
||||
final bool hasBottom;
|
||||
const ActionButton(
|
||||
this.text, {
|
||||
this.color = AppColors.red,
|
||||
this.color = AppColors.primary,
|
||||
this.onTap,
|
||||
this.hasTop = false,
|
||||
this.hasBottom = false,
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
@@ -19,14 +23,22 @@ class ActionButton extends StatelessWidget {
|
||||
onTap: () {
|
||||
onTap?.call();
|
||||
},
|
||||
child: Container(
|
||||
child: Column(
|
||||
children: [
|
||||
if (hasTop)
|
||||
const Divider(
|
||||
height: 0,
|
||||
color: AppColors.border,
|
||||
),
|
||||
Container(
|
||||
color: AppColors.white,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
padding: const EdgeInsets.all(14.0),
|
||||
child: Center(
|
||||
child: Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: color,
|
||||
),
|
||||
@@ -34,6 +46,13 @@ class ActionButton extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
if (hasBottom)
|
||||
const Divider(
|
||||
height: 0,
|
||||
color: AppColors.border,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,9 @@ class ActionItem extends StatelessWidget {
|
||||
final Widget? rightWidget;
|
||||
final String? bottom;
|
||||
final VoidCallback? onTap;
|
||||
final bool isFirst;
|
||||
final bool isLast;
|
||||
final double indent;
|
||||
|
||||
const ActionItem(
|
||||
this.title, {
|
||||
@@ -14,6 +17,9 @@ class ActionItem extends StatelessWidget {
|
||||
this.rightWidget,
|
||||
this.bottom,
|
||||
this.onTap,
|
||||
this.isFirst = false,
|
||||
this.isLast = false,
|
||||
this.indent = 16,
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
@@ -24,9 +30,18 @@ class ActionItem extends StatelessWidget {
|
||||
onTap: () {
|
||||
onTap?.call();
|
||||
},
|
||||
child: Container(
|
||||
color: AppColors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
if (isFirst)
|
||||
const Divider(
|
||||
height: 0.4,
|
||||
color: AppColors.border,
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColors.white,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -71,6 +86,19 @@ class ActionItem extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
if (isLast)
|
||||
const Divider(
|
||||
height: 0,
|
||||
color: AppColors.border,
|
||||
),
|
||||
if (!isLast)
|
||||
Divider(
|
||||
height: 0,
|
||||
color: AppColors.border,
|
||||
indent: indent,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,10 @@ class ScanPage extends StatefulWidget {
|
||||
class _ScanPageState extends State<ScanPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container();
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('扫一扫'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,7 +17,9 @@ class UserTopBar extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
color: AppColors.white,
|
||||
padding: EdgeInsets.only(
|
||||
left: 24,
|
||||
@@ -26,7 +28,8 @@ class UserTopBar extends StatelessWidget {
|
||||
bottom: paddingBottom,
|
||||
),
|
||||
height: avatarHeight + paddingTop + paddingBottom,
|
||||
child: GetX<AuthService>(builder: (_) {
|
||||
child: GetX<AuthService>(
|
||||
builder: (_) {
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
@@ -59,7 +62,8 @@ class UserTopBar extends StatelessWidget {
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
Convert.hideCenterStr(_.userInfo.value.address ?? ''),
|
||||
Convert.hideCenterStr(
|
||||
_.userInfo.value.address ?? ''),
|
||||
style: const TextStyle(
|
||||
color: AppColors.unactive,
|
||||
),
|
||||
@@ -107,7 +111,14 @@ class UserTopBar extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
},
|
||||
),
|
||||
),
|
||||
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