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

treewide: small refactors

This commit is contained in:
Henry Hiles 2026-10-15 20:10:44 -04:00
commit 8d944831f5
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
10 changed files with 63 additions and 63 deletions

View file

@ -0,0 +1,28 @@
import "package:material_ui/material_ui.dart";
extension ShowErrorSnackBar on ScaffoldMessengerState {
/// Shows [message] in a snackbar styled as an error.
ScaffoldFeatureController<SnackBar, SnackBarClosedReason> showErrorSnackBar(
String message, {
({String label, VoidCallback onPressed})? action,
}) {
final colorScheme = Theme.of(context).colorScheme;
return showSnackBar(
.new(
backgroundColor: colorScheme.errorContainer,
content: Text(
message,
style: .new(color: colorScheme.onErrorContainer),
),
action: action == null
? null
: .new(
label: action.label,
onPressed: action.onPressed,
textColor: colorScheme.onErrorContainer,
),
),
);
}
}