Realm detail page

This commit is contained in:
2025-05-04 23:07:36 +08:00
parent 4b6a5c28de
commit 2e37582b45
10 changed files with 975 additions and 164 deletions

View File

@ -85,7 +85,11 @@ class ChatDetailScreen extends HookConsumerWidget {
currentRoom.type == 1
? currentRoom.members!.first.account.nick
: currentRoom.name,
).textColor(Theme.of(context).appBarTheme.foregroundColor),
style: TextStyle(
color: Theme.of(context).appBarTheme.foregroundColor,
shadows: [iconShadow],
),
),
),
actions: [
IconButton(
@ -110,7 +114,7 @@ class ChatDetailScreen extends HookConsumerWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
currentRoom?.description ?? 'descriptionNone'.tr(),
currentRoom.description,
style: const TextStyle(fontSize: 16),
),
],
@ -124,14 +128,14 @@ class ChatDetailScreen extends HookConsumerWidget {
}
}
class _ChatRoomActionMenu extends StatelessWidget {
class _ChatRoomActionMenu extends HookConsumerWidget {
final int id;
final Shadow iconShadow;
const _ChatRoomActionMenu({required this.id, required this.iconShadow});
@override
Widget build(BuildContext context) {
Widget build(BuildContext context, WidgetRef ref) {
return PopupMenuButton(
icon: Icon(Icons.more_vert, shadows: [iconShadow]),
itemBuilder:
@ -163,30 +167,21 @@ class _ChatRoomActionMenu extends StatelessWidget {
],
),
onTap: () {
Navigator.pop(context);
showDialog(
context: context,
builder:
(context) => AlertDialog(
title: const Text('Delete Room'),
content: const Text(
'Are you sure you want to delete this room? This action cannot be undone.',
),
actions: [
TextButton(
child: const Text('Cancel'),
onPressed: () => Navigator.pop(context),
),
TextButton(
child: const Text(
'Delete',
style: TextStyle(color: Colors.red),
),
onPressed: () async {},
),
],
),
);
showConfirmAlert(
'deleteChatRoomHint'.tr(),
'deleteChatRoom'.tr(),
).then((confirm) {
if (confirm) {
final client = ref.watch(apiClientProvider);
client.delete('/chat/$id');
ref.invalidate(chatroomsJoinedProvider);
if (context.mounted) {
context.router.popUntil(
(route) => route is ChatRoomRoute,
);
}
}
});
},
),
],
@ -304,7 +299,7 @@ class _ChatMemberListSheet extends HookConsumerWidget {
child: Row(
children: [
Text(
'chatMembers'.plural(memberState.total),
'members'.plural(memberState.total),
style: Theme.of(context).textTheme.headlineSmall?.copyWith(
fontWeight: FontWeight.w600,
letterSpacing: -0.5,