feat: enhance error handling; implement copyable SnackBar for user messages across various screens
Test Suite / test (24.15.0) (push) Has been cancelled
Test Suite / test (24.15.0) (push) Has been cancelled
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../l10n/l10n.dart';
|
||||
import 'api_exception.dart';
|
||||
@@ -21,3 +22,18 @@ String mapErrorToUserMessage(Object error, BuildContext context) {
|
||||
}
|
||||
return l10n.unexpectedError;
|
||||
}
|
||||
|
||||
SnackBar buildCopyableErrorSnackBar(BuildContext context, String message) {
|
||||
return SnackBar(
|
||||
content: Text(message),
|
||||
action: SnackBarAction(
|
||||
label: context.l10n.errorDialogCopy,
|
||||
onPressed: () {
|
||||
Clipboard.setData(ClipboardData(text: message));
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(context.l10n.errorDialogCopied)),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user