Atualização geral de optimazação e desing
This commit is contained in:
46
lib/widgets/app_dialogs.dart
Normal file
46
lib/widgets/app_dialogs.dart
Normal file
@@ -0,0 +1,46 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
const Color _teal = Color(0xFF2F9E94);
|
||||
const Color _accentPink = Color(0xFFFF55A7);
|
||||
|
||||
/// Diálogo de confirmação com a identidade visual do app (título rosa,
|
||||
/// botões em pílula), usado para todas as confirmações destrutivas/decisórias.
|
||||
Future<bool?> showConfirmDialog(
|
||||
BuildContext context, {
|
||||
required String title,
|
||||
String? message,
|
||||
String cancelLabel = 'Cancelar',
|
||||
required String confirmLabel,
|
||||
Color confirmColor = _teal,
|
||||
}) {
|
||||
return showDialog<bool>(
|
||||
context: context,
|
||||
builder: (ctx) {
|
||||
return AlertDialog(
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
|
||||
title: Text(
|
||||
title,
|
||||
style: const TextStyle(fontWeight: FontWeight.w900, color: _accentPink),
|
||||
),
|
||||
content: message == null ? null : Text(message),
|
||||
actions: [
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(foregroundColor: _teal),
|
||||
onPressed: () => Navigator.of(ctx).pop(false),
|
||||
child: Text(cancelLabel),
|
||||
),
|
||||
FilledButton(
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor: confirmColor,
|
||||
foregroundColor: Colors.white,
|
||||
shape: const StadiumBorder(),
|
||||
textStyle: const TextStyle(fontWeight: FontWeight.w800),
|
||||
),
|
||||
onPressed: () => Navigator.of(ctx).pop(true),
|
||||
child: Text(confirmLabel),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user