Show space hierarchies

Fixes #83
This commit is contained in:
Henry Hiles 2026-10-15 22:34:27 -04:00
commit b71a7f0bd6
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
10 changed files with 519 additions and 98 deletions

View file

@ -0,0 +1,39 @@
import "package:flutter_riverpod/flutter_riverpod.dart";
import "package:material_ui/material_ui.dart";
import "package:nexus/controllers/client.dart";
import "package:nexus/helpers/extensions/show_adaptive_sheet.dart";
import "package:nexus/helpers/extensions/with_progress_snackbar.dart";
import "package:nexus/widgets/sheet_layout.dart";
extension ShowLeaveRoomSheet on BuildContext {
/// Asks the user to confirm leaving the room, then leaves it.
Future<void> showLeaveRoomSheet(String roomId, {required String name}) =>
showAdaptiveSheet(
(context) => SheetLayout(
title: const Text("Leave Room"),
actions: [
TextButton(
onPressed: Navigator.of(context).pop,
child: const Text("Cancel"),
),
TextButton(
onPressed: () {
final client = ProviderScope.containerOf(
context,
).read(ClientController.provider.notifier);
context.withProgressSnackbar(
"Leaving $name...",
() => client.leaveRoom(roomId),
);
Navigator.of(context).pop();
},
style: TextButton.styleFrom(
foregroundColor: Theme.of(context).colorScheme.error,
),
child: const Text("Leave"),
),
],
children: [Text("Are you sure you want to leave \"$name\"?")],
),
);
}