errorDialog static method
Future<void>
errorDialog({
- required BuildContext buildContext,
- String title = 'Erro',
- required String message,
- String buttonText = 'OK',
Exibe um diálogo de erro
Parâmetros:
buildContext
: Contexto do widgettitle
: Título do diálogo (padrão: "Erro")message
: Mensagem de errobuttonText
: Texto do botão (padrão: "OK")
Implementation
static Future<void> errorDialog({
required BuildContext buildContext,
String title = 'Erro',
required String message,
String buttonText = 'OK',
}) async {
final theme = SyncThemeProvider.current;
await showDialog(
context: buildContext,
builder: (context) => AlertDialog(
backgroundColor: theme.surface,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(theme.borderRadius),
),
title: Row(
children: [
Icon(
Icons.error_outline,
color: theme.error,
size: 24,
),
SizedBox(width: theme.spacingSmall),
Text(
title,
style: theme.titleStyle.copyWith(color: theme.error),
),
],
),
content: Text(
message,
style: theme.bodyStyle,
),
actions: [
ElevatedButton(
onPressed: () => Navigator.of(context).pop(),
style: ElevatedButton.styleFrom(
backgroundColor: theme.error,
foregroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(theme.borderRadius),
),
),
child: Text(
buttonText,
style: theme.buttonStyle,
),
),
],
),
);
}