💄 Optimized settings

This commit is contained in:
LittleSheep 2024-09-13 23:19:33 +08:00
parent c1cbcbe734
commit db808650e3
8 changed files with 70 additions and 76 deletions

View File

@ -76,8 +76,8 @@
"firstName": "First Name",
"lastName": "Last Name",
"account": "Account",
"accountPersonalize": "Personalize",
"accountPersonalizeApplied": "Account personalize settings has been saved.",
"accountProfile": "Your profile",
"accountProfileApplied": "Account profile has been saved.",
"accountStickers": "Stickers",
"accountFriend": "Friend",
"accountFriendNew": "New friend",

View File

@ -81,8 +81,8 @@
"firstName": "名称",
"lastName": "姓氏",
"account": "账号",
"accountPersonalize": "个性化",
"accountPersonalizeApplied": "账户的个性化设置已保存。",
"accountProfile": "个人资料",
"accountProfileApplied": "账户的资料已保存。",
"accountStickers": "贴图",
"accountFriend": "好友",
"accountFriendNew": "添加好友",

View File

@ -246,7 +246,7 @@ abstract class AppRouter {
),
GoRoute(
path: '/account/personalize',
name: 'accountPersonalize',
name: 'accountProfile',
builder: (context, state) => TitleShell(
state: state,
child: const PersonalizeScreen(),

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:get/get.dart';
import 'package:solian/models/account.dart';
import 'package:solian/providers/auth.dart';
@ -23,9 +24,9 @@ class _AccountScreenState extends State<AccountScreen> {
Widget build(BuildContext context) {
final actionItems = [
(
const Icon(Icons.color_lens),
'accountPersonalize'.tr,
'accountPersonalize',
const Icon(Icons.face),
'accountProfile'.tr,
'accountProfile',
),
(
Obx(() {
@ -47,9 +48,9 @@ class _AccountScreenState extends State<AccountScreen> {
'accountFriend',
),
(
const Icon(Icons.emoji_symbols),
'accountStickers'.tr,
'accountStickers',
const Icon(Icons.emoji_symbols),
'accountStickers'.tr,
'accountStickers',
),
];
@ -64,7 +65,7 @@ class _AccountScreenState extends State<AccountScreen> {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
ActionCard(
_ActionCard(
icon: Icon(
Icons.login,
color: Theme.of(context).colorScheme.onPrimary,
@ -85,7 +86,7 @@ class _AccountScreenState extends State<AccountScreen> {
});
},
),
ActionCard(
_ActionCard(
icon: Icon(
Icons.add,
color: Theme.of(context).colorScheme.onPrimary,
@ -104,6 +105,19 @@ class _AccountScreenState extends State<AccountScreen> {
});
},
),
const Gap(4),
TextButton(
style: const ButtonStyle(
visualDensity: VisualDensity(
horizontal: -4,
vertical: -2,
),
),
onPressed: () {
AppRouter.instance.pushNamed('settings');
},
child: Text('settings'.tr),
),
],
),
);
@ -126,6 +140,18 @@ class _AccountScreenState extends State<AccountScreen> {
},
),
)),
const Divider(thickness: 0.3, height: 1)
.paddingSymmetric(vertical: 4),
ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 34),
leading: const Icon(Icons.settings),
title: Text('settings'.tr),
onTap: () {
AppRouter.instance.pushNamed('settings');
},
),
const Divider(thickness: 0.3, height: 1)
.paddingSymmetric(vertical: 4),
ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 34),
leading: const Icon(Icons.logout),
@ -186,13 +212,13 @@ class _AccountHeadingState extends State<AccountHeading> {
}
}
class ActionCard extends StatelessWidget {
class _ActionCard extends StatelessWidget {
final Widget icon;
final String title;
final String caption;
final Function onTap;
const ActionCard({
const _ActionCard({
super.key,
required this.onTap,
required this.title,

View File

@ -134,7 +134,7 @@ class _PersonalizeScreenState extends State<PersonalizeScreen> {
);
if (resp.statusCode == 200) {
_syncWidget();
context.showSnackbar('accountPersonalizeApplied'.tr);
context.showSnackbar('accountProfileApplied'.tr);
} else {
context.showErrorDialog(resp.bodyString);
}
@ -163,7 +163,7 @@ class _PersonalizeScreenState extends State<PersonalizeScreen> {
);
if (resp.statusCode == 200) {
_syncWidget();
context.showSnackbar('accountPersonalizeApplied'.tr);
context.showSnackbar('accountProfileApplied'.tr);
} else {
context.showErrorDialog(resp.bodyString);
}

View File

@ -82,32 +82,27 @@ class _SettingScreenState extends State<SettingScreen> {
).paddingSymmetric(horizontal: 12, vertical: 8),
),
_buildCaptionHeader('more'.tr),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
TextButton(
style: const ButtonStyle(
visualDensity: VisualDensity(horizontal: -4, vertical: -4),
),
child: Text('about'.tr),
onPressed: () {
AppRouter.instance.pushNamed('about');
},
),
TextButton(
style: const ButtonStyle(
visualDensity: VisualDensity(horizontal: -4, vertical: -4),
),
child: Text('messageHistoryWipe'.tr),
onPressed: () {
final chatHistory = ChatEventController();
chatHistory.initialize().then((_) async {
await chatHistory.database.localEvents.wipeLocalEvents();
});
},
),
],
).paddingSymmetric(horizontal: 12, vertical: 8),
ListTile(
leading: const Icon(Icons.info_outline),
trailing: const Icon(Icons.chevron_right),
contentPadding: const EdgeInsets.symmetric(horizontal: 22),
title: Text('about'.tr),
onTap: () {
AppRouter.instance.pushNamed('about');
},
),
ListTile(
leading: const Icon(Icons.delete_sweep),
trailing: const Icon(Icons.chevron_right),
contentPadding: const EdgeInsets.symmetric(horizontal: 22),
title: Text('messageHistoryWipe'.tr),
onTap: () {
final chatHistory = ChatEventController();
chatHistory.initialize().then((_) async {
await chatHistory.database.localEvents.wipeLocalEvents();
});
},
),
],
),
);

View File

@ -20,7 +20,7 @@ abstract class AppNavigation {
),
AppNavigationDestination(
icon: Icons.forum,
label: 'channelTypeDirect'.tr,
label: 'chat'.tr,
page: 'chat',
),
];

View File

@ -269,43 +269,16 @@ class _AppNavigationDrawerState extends State<AppNavigationDrawer>
),
const Divider(thickness: 0.3, height: 1),
Expanded(
child: AppNavigationRegion(
isCollapsed: _isCollapsed,
child: Material(
color: Theme.of(context).colorScheme.surface,
child: AppNavigationRegion(
isCollapsed: _isCollapsed,
),
),
),
const Divider(thickness: 0.3, height: 1),
Column(
children: [
if (_isCollapsed)
Tooltip(
message: 'settings'.tr,
child: InkWell(
child: const Icon(
Icons.settings,
size: 20,
).paddingSymmetric(
horizontal: 28,
vertical: 10,
),
onTap: () {
AppRouter.instance.pushNamed('settings');
_closeDrawer();
},
),
)
else
ListTile(
minTileHeight: 0,
contentPadding: const EdgeInsets.symmetric(
horizontal: 20,
),
leading: const Icon(Icons.settings, size: 20).paddingAll(2),
title: Text('settings'.tr),
onTap: () {
AppRouter.instance.pushNamed('settings');
_closeDrawer();
},
),
if (_isCollapsed)
Tooltip(
message: 'expand'.tr,