🐛 Add realm entry to the account page, close #205

This commit is contained in:
2025-12-21 15:47:19 +08:00
parent 67a522753e
commit 59c34ada40
2 changed files with 76 additions and 74 deletions

View File

@@ -386,6 +386,17 @@ class AccountScreen extends HookConsumerWidget {
context.goNamed('files'); context.goNamed('files');
}, },
), ),
if (!isWideScreen(context))
ListTile(
minTileHeight: 48,
leading: const Icon(Symbols.group),
trailing: const Icon(Symbols.chevron_right),
contentPadding: EdgeInsets.symmetric(horizontal: 24),
title: Text('realms').tr(),
onTap: () {
context.goNamed('realmList');
},
),
ListTile( ListTile(
minTileHeight: 48, minTileHeight: 48,
leading: const Icon(Symbols.wallet), leading: const Icon(Symbols.wallet),
@@ -408,7 +419,7 @@ class AccountScreen extends HookConsumerWidget {
), ),
ListTile( ListTile(
minTileHeight: 48, minTileHeight: 48,
leading: const Icon(Symbols.emoji_emotions), leading: const Icon(Symbols.sticker_rounded),
trailing: const Icon(Symbols.chevron_right), trailing: const Icon(Symbols.chevron_right),
contentPadding: EdgeInsets.symmetric(horizontal: 24), contentPadding: EdgeInsets.symmetric(horizontal: 24),
title: Text('stickers').tr(), title: Text('stickers').tr(),

View File

@@ -63,6 +63,7 @@ class RealmListScreen extends HookConsumerWidget {
return AppScaffold( return AppScaffold(
isNoBackground: false, isNoBackground: false,
appBar: AppBar( appBar: AppBar(
leading: const PageBackButton(backTo: '/account'),
title: const Text('realms').tr(), title: const Text('realms').tr(),
actions: [ actions: [
IconButton( IconButton(
@@ -99,8 +100,7 @@ class RealmListScreen extends HookConsumerWidget {
), ),
body: ExtendedRefreshIndicator( body: ExtendedRefreshIndicator(
child: realms.when( child: realms.when(
data: data: (value) => Column(
(value) => Column(
children: [ children: [
Expanded( Expanded(
child: ListView.separated( child: ListView.separated(
@@ -121,8 +121,7 @@ class RealmListScreen extends HookConsumerWidget {
], ],
), ),
loading: () => const Center(child: CircularProgressIndicator()), loading: () => const Center(child: CircularProgressIndicator()),
error: error: (e, _) => ResponseErrorWidget(
(e, _) => ResponseErrorWidget(
error: e, error: e,
onRetry: () => ref.invalidate(realmsJoinedProvider), onRetry: () => ref.invalidate(realmsJoinedProvider),
), ),
@@ -183,15 +182,9 @@ class _RealmInviteSheet extends HookConsumerWidget {
), ),
], ],
child: invites.when( child: invites.when(
data: data: (items) => items.isEmpty
(items) =>
items.isEmpty
? Center( ? Center(
child: child: Text('invitesEmpty', textAlign: TextAlign.center).tr(),
Text(
'invitesEmpty',
textAlign: TextAlign.center,
).tr(),
) )
: ListView.builder( : ListView.builder(
shrinkWrap: true, shrinkWrap: true,
@@ -204,8 +197,7 @@ class _RealmInviteSheet extends HookConsumerWidget {
fallbackIcon: Symbols.group, fallbackIcon: Symbols.group,
), ),
title: Text(invite.realm!.name), title: Text(invite.realm!.name),
subtitle: subtitle: Text(
Text(
invite.role >= 100 invite.role >= 100
? 'permissionOwner' ? 'permissionOwner'
: invite.role >= 50 : invite.role >= 50
@@ -229,8 +221,7 @@ class _RealmInviteSheet extends HookConsumerWidget {
}, },
), ),
loading: () => const Center(child: CircularProgressIndicator()), loading: () => const Center(child: CircularProgressIndicator()),
error: error: (error, _) => ResponseErrorWidget(
(error, _) => ResponseErrorWidget(
error: error, error: error,
onRetry: () => ref.invalidate(realmInvitesProvider), onRetry: () => ref.invalidate(realmInvitesProvider),
), ),