reorganize and rename widgets
This commit is contained in:
parent
05d25869ef
commit
d5f29dc344
1 changed files with 568 additions and 547 deletions
56
lib/widgets/room_chat/tombstone_banner.dart
Normal file
56
lib/widgets/room_chat/tombstone_banner.dart
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||
import "package:hooks_riverpod/hooks_riverpod.dart";
|
||||
import "package:material_ui/material_ui.dart";
|
||||
import "package:nexus/helpers/extensions/open_link_info.dart";
|
||||
import "package:nexus/main.dart";
|
||||
import "package:nexus/models/content/tombstone.dart";
|
||||
import "package:nexus/models/event.dart";
|
||||
|
||||
class const TombstoneBanner(final Event tombstone, {super.key})
|
||||
extends ConsumerWidget {
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final theme = Theme.of(context);
|
||||
final content = tombstone.content;
|
||||
final sender = tombstone.sender;
|
||||
|
||||
return Container(
|
||||
color: theme.colorScheme.surfaceContainerHighest,
|
||||
padding: .symmetric(horizontal: 16, vertical: 8),
|
||||
margin: .only(top: 4),
|
||||
child: Row(
|
||||
spacing: 12,
|
||||
children: [
|
||||
Icon(Icons.upgrade),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: .min,
|
||||
crossAxisAlignment: .start,
|
||||
children: [
|
||||
Text(
|
||||
"This room has been replaced and is no longer active.",
|
||||
style: .new(fontWeight: .bold),
|
||||
),
|
||||
if (content case TombstoneContent(:final body)
|
||||
when body.isNotEmpty)
|
||||
Text(body, style: theme.textTheme.bodySmall),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (content case TombstoneContent(:final replacementRoom))
|
||||
FilledButton.icon(
|
||||
onPressed: () => ref
|
||||
.openLinkInfo(context, (
|
||||
identifier: replacementRoom,
|
||||
eventId: null,
|
||||
via: [sender.substring(sender.indexOf(":") + 1)].lock,
|
||||
))
|
||||
.onError(showError),
|
||||
label: Text("New room"),
|
||||
icon: Icon(Icons.open_in_new),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue