🐛 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');
},
),
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(
minTileHeight: 48,
leading: const Icon(Symbols.wallet),
@@ -408,7 +419,7 @@ class AccountScreen extends HookConsumerWidget {
),
ListTile(
minTileHeight: 48,
leading: const Icon(Symbols.emoji_emotions),
leading: const Icon(Symbols.sticker_rounded),
trailing: const Icon(Symbols.chevron_right),
contentPadding: EdgeInsets.symmetric(horizontal: 24),
title: Text('stickers').tr(),

View File

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