Watch
1
0
Fork
You've already forked nexus
0
forked from Nexus/nexus

add support for creating rooms

Fixes #81
This commit is contained in:
Henry Hiles 2026-10-15 19:49:04 -04:00
commit ed84410039
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
13 changed files with 540 additions and 66 deletions

View file

@ -0,0 +1,37 @@
import "package:material_ui/material_ui.dart";
extension WithProgressSnackbar on BuildContext {
/// Shows [progress] in a snackbar while [action] runs, and shows any error
/// it throws in an error snackbar.
///
/// Returns the result of [action], or null if it failed.
Future<T?> withProgressSnackbar<T>(
String progress,
Future<T> Function() action,
) async {
final messenger = ScaffoldMessenger.of(this);
final colorScheme = Theme.of(this).colorScheme;
final snackbar = messenger.showSnackBar(
.new(content: Text(progress), duration: const .new(days: 1)),
);
try {
return await action();
} catch (error) {
messenger.showSnackBar(
.new(
backgroundColor: colorScheme.errorContainer,
content: Text(
error.toString(),
style: .new(color: colorScheme.onErrorContainer),
),
),
);
return null;
} finally {
snackbar.close();
}
}
}