reorganize and rename widgets

This commit is contained in:
Henry Hiles 2026-11-09 17:25:02 -05:00
commit d5f29dc344
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View 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),
),
],
),
);
}
}