💄 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", "firstName": "First Name",
"lastName": "Last Name", "lastName": "Last Name",
"account": "Account", "account": "Account",
"accountPersonalize": "Personalize", "accountProfile": "Your profile",
"accountPersonalizeApplied": "Account personalize settings has been saved.", "accountProfileApplied": "Account profile has been saved.",
"accountStickers": "Stickers", "accountStickers": "Stickers",
"accountFriend": "Friend", "accountFriend": "Friend",
"accountFriendNew": "New friend", "accountFriendNew": "New friend",

View File

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

View File

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

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:solian/models/account.dart'; import 'package:solian/models/account.dart';
import 'package:solian/providers/auth.dart'; import 'package:solian/providers/auth.dart';
@ -23,9 +24,9 @@ class _AccountScreenState extends State<AccountScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final actionItems = [ final actionItems = [
( (
const Icon(Icons.color_lens), const Icon(Icons.face),
'accountPersonalize'.tr, 'accountProfile'.tr,
'accountPersonalize', 'accountProfile',
), ),
( (
Obx(() { Obx(() {
@ -64,7 +65,7 @@ class _AccountScreenState extends State<AccountScreen> {
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
ActionCard( _ActionCard(
icon: Icon( icon: Icon(
Icons.login, Icons.login,
color: Theme.of(context).colorScheme.onPrimary, color: Theme.of(context).colorScheme.onPrimary,
@ -85,7 +86,7 @@ class _AccountScreenState extends State<AccountScreen> {
}); });
}, },
), ),
ActionCard( _ActionCard(
icon: Icon( icon: Icon(
Icons.add, Icons.add,
color: Theme.of(context).colorScheme.onPrimary, 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( ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 34), contentPadding: const EdgeInsets.symmetric(horizontal: 34),
leading: const Icon(Icons.logout), 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 Widget icon;
final String title; final String title;
final String caption; final String caption;
final Function onTap; final Function onTap;
const ActionCard({ const _ActionCard({
super.key, super.key,
required this.onTap, required this.onTap,
required this.title, required this.title,

View File

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

View File

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

View File

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

View File

@ -269,43 +269,16 @@ class _AppNavigationDrawerState extends State<AppNavigationDrawer>
), ),
const Divider(thickness: 0.3, height: 1), const Divider(thickness: 0.3, height: 1),
Expanded( Expanded(
child: Material(
color: Theme.of(context).colorScheme.surface,
child: AppNavigationRegion( child: AppNavigationRegion(
isCollapsed: _isCollapsed, isCollapsed: _isCollapsed,
), ),
), ),
),
const Divider(thickness: 0.3, height: 1), const Divider(thickness: 0.3, height: 1),
Column( Column(
children: [ 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) if (_isCollapsed)
Tooltip( Tooltip(
message: 'expand'.tr, message: 'expand'.tr,