redesign app phase 3
This commit is contained in:
@@ -3,29 +3,35 @@ import 'package:flutter/material.dart';
|
||||
import 'package:finamp/l10n/app_localizations.dart';
|
||||
|
||||
/// Snackbar with error icon for displaying errors
|
||||
ScaffoldFeatureController<SnackBar, SnackBarClosedReason> errorSnackbar(
|
||||
dynamic error, BuildContext context) {
|
||||
return ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(AppLocalizations.of(context)!.anErrorHasOccured),
|
||||
action: SnackBarAction(
|
||||
label: MaterialLocalizations.of(context).moreButtonTooltip,
|
||||
onPressed: () => showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text(AppLocalizations.of(context)!.error),
|
||||
content: Text(_errorText(error, context)),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: Text(MaterialLocalizations.of(context).closeButtonLabel),
|
||||
)
|
||||
],
|
||||
void errorSnackbar(dynamic error, BuildContext context) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (!context.mounted) {
|
||||
return;
|
||||
}
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(AppLocalizations.of(context)!.anErrorHasOccured),
|
||||
action: SnackBarAction(
|
||||
label: MaterialLocalizations.of(context).moreButtonTooltip,
|
||||
onPressed: () => showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text(AppLocalizations.of(context)!.error),
|
||||
content: Text(_errorText(error, context)),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child:
|
||||
Text(MaterialLocalizations.of(context).closeButtonLabel),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
String _errorText(dynamic error, BuildContext context) {
|
||||
|
||||
Reference in New Issue
Block a user