CKT 1.0.2 | otorrinolaringologista

This commit is contained in:
Carlos Correia
2026-07-16 12:58:46 +01:00
parent a8af2c6845
commit f5884d8c36
12 changed files with 611 additions and 53 deletions

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import '../colors/app_colors.dart';
import '../colors/app_gradients.dart';
import '../strings/common_strings.dart';
import 'tap_bounce.dart';
@@ -7,8 +8,9 @@ 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.
/// Diálogo de confirmação com a identidade visual do app (título rosa
/// centrado, botão principal em pílula com gradiente), usado para todas as
/// confirmações destrutivas/decisórias.
Future<bool?> showConfirmDialog(
BuildContext context, {
required String title,
@@ -17,16 +19,39 @@ Future<bool?> showConfirmDialog(
required String confirmLabel,
Color confirmColor = _teal,
}) {
// Só o teal (o valor por omissão, usado nas confirmações não-destrutivas
// como "Adicionar outra criança?") ganha o gradiente verde da app; ações
// destrutivas continuam com a cor sólida passada (normalmente rosa), para
// manter esse alerta visual.
final isDefaultColor = confirmColor == _teal;
return showDialog<bool>(
context: context,
builder: (ctx) {
return AlertDialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)),
titlePadding: const EdgeInsets.fromLTRB(24, 24, 24, 8),
contentPadding: const EdgeInsets.fromLTRB(24, 8, 24, 12),
actionsPadding: const EdgeInsets.fromLTRB(20, 0, 20, 20),
title: Text(
title,
style: const TextStyle(fontWeight: FontWeight.w900, color: _accentPink),
textAlign: TextAlign.center,
style: const TextStyle(
fontWeight: FontWeight.w900,
color: _accentPink,
),
),
content: message == null ? null : Text(message),
content: message == null
? null
: Text(
message,
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.black.withValues(alpha: 0.72),
height: 1.4,
),
),
actionsAlignment: MainAxisAlignment.center,
actions: [
TapBounce(
child: TextButton(
@@ -36,15 +61,24 @@ Future<bool?> showConfirmDialog(
),
),
TapBounce(
child: FilledButton(
style: FilledButton.styleFrom(
backgroundColor: confirmColor,
foregroundColor: Colors.white,
shape: const StadiumBorder(),
textStyle: const TextStyle(fontWeight: FontWeight.w800),
child: ClipRRect(
borderRadius: BorderRadius.circular(999),
child: DecoratedBox(
decoration: BoxDecoration(
gradient: isDefaultColor ? kGreenButtonGradient : null,
color: isDefaultColor ? null : confirmColor,
),
child: FilledButton(
style: FilledButton.styleFrom(
backgroundColor: Colors.transparent,
foregroundColor: Colors.white,
shape: const StadiumBorder(),
textStyle: const TextStyle(fontWeight: FontWeight.w800),
),
onPressed: () => Navigator.of(ctx).pop(true),
child: Text(confirmLabel),
),
),
onPressed: () => Navigator.of(ctx).pop(true),
child: Text(confirmLabel),
),
),
],