Files
CheckTheethKids/lib/widgets/app_dialogs.dart
Carlos Correia a8af2c6845 CKT String|Colors
2026-07-15 19:13:15 +01:00

55 lines
1.7 KiB
Dart

import 'package:flutter/material.dart';
import '../colors/app_colors.dart';
import '../strings/common_strings.dart';
import 'tap_bounce.dart';
const Color _teal = AppColors.teal;
const Color _accentPink = AppColors.pink;
/// 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 = CommonStrings.cancel,
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: [
TapBounce(
child: TextButton(
style: TextButton.styleFrom(foregroundColor: _teal),
onPressed: () => Navigator.of(ctx).pop(false),
child: Text(cancelLabel),
),
),
TapBounce(
child: 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),
),
),
],
);
},
);
}