quiz redirecionado aos videos | redesing da notificação
This commit is contained in:
@@ -19,6 +19,8 @@ import 'widgets/animated_nav_icon.dart';
|
||||
import 'widgets/app_dialogs.dart';
|
||||
import 'widgets/app_gradients.dart';
|
||||
import 'widgets/entrance.dart';
|
||||
import 'widgets/name_input_formatter.dart';
|
||||
import 'widgets/pill_snackbar.dart';
|
||||
import 'widgets/tap_bounce.dart';
|
||||
|
||||
/// Nomes só podem ter letras (incluindo acentuadas) e espaços — sem números.
|
||||
@@ -806,18 +808,20 @@ class _InicioTab extends StatelessWidget {
|
||||
await _requireFirstChild(context, uid);
|
||||
return;
|
||||
}
|
||||
final messenger = ScaffoldMessenger.of(context);
|
||||
if (!(await BrushingPrefs.canLogMore(scope))) {
|
||||
messenger.showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Já registou as ${BrushingPrefs.maxPerDay} escovagens de hoje!'),
|
||||
),
|
||||
);
|
||||
if (context.mounted) {
|
||||
showPillSnackBar(
|
||||
context,
|
||||
'Já registou as ${BrushingPrefs.maxPerDay} escovagens de hoje!',
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
await BrushingPrefs.logToday(scope);
|
||||
await state?.refreshStats();
|
||||
messenger.showSnackBar(const SnackBar(content: Text('Escovagem registada!')));
|
||||
if (context.mounted) {
|
||||
showPillSnackBar(context, 'Escovagem registada!');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1009,9 +1013,7 @@ Future<Map<String, dynamic>?> _createChildViaSheet(
|
||||
return inserted;
|
||||
} catch (e) {
|
||||
if (!context.mounted) return null;
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text('Erro ao adicionar criança: $e')));
|
||||
showPillSnackBar(context, 'Erro ao adicionar criança: $e');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1550,9 +1552,7 @@ class _PerfilTabState extends State<_PerfilTab> {
|
||||
}
|
||||
} catch (e) {
|
||||
if (!context.mounted) return;
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text('Erro ao enviar foto: $e')));
|
||||
showPillSnackBar(context, 'Erro ao enviar foto: $e');
|
||||
} finally {
|
||||
if (mounted) setState(() => _updatingPhoto = false);
|
||||
}
|
||||
@@ -1563,7 +1563,6 @@ class _PerfilTabState extends State<_PerfilTab> {
|
||||
required String childId,
|
||||
required String childName,
|
||||
}) async {
|
||||
final messenger = ScaffoldMessenger.of(context);
|
||||
final confirmed = await showConfirmDialog(
|
||||
context,
|
||||
title: 'Remover criança',
|
||||
@@ -1589,9 +1588,11 @@ class _PerfilTabState extends State<_PerfilTab> {
|
||||
|
||||
widget.onChildSelected(0, null, null);
|
||||
await _loadPerfilData();
|
||||
messenger.showSnackBar(const SnackBar(content: Text('Criança removida')));
|
||||
if (context.mounted) showPillSnackBar(context, 'Criança removida');
|
||||
} catch (e) {
|
||||
messenger.showSnackBar(SnackBar(content: Text('Erro ao remover: $e')));
|
||||
if (context.mounted) {
|
||||
showPillSnackBar(context, 'Erro ao remover: $e');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1666,7 +1667,6 @@ class _PerfilTabState extends State<_PerfilTab> {
|
||||
|
||||
Future<void> _addAnotherChild(BuildContext context, String uid) async {
|
||||
if (_addingChild) return;
|
||||
final messenger = ScaffoldMessenger.of(context);
|
||||
final result = await showModalBottomSheet<Map<String, dynamic>?>(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
@@ -1693,9 +1693,7 @@ class _PerfilTabState extends State<_PerfilTab> {
|
||||
|
||||
if (!mounted) return;
|
||||
await _loadPerfilData();
|
||||
messenger.showSnackBar(
|
||||
const SnackBar(content: Text('Criança adicionada')),
|
||||
);
|
||||
if (context.mounted) showPillSnackBar(context, 'Criança adicionada');
|
||||
|
||||
if (mounted) {
|
||||
setState(() => _addingChild = false);
|
||||
@@ -1721,15 +1719,11 @@ class _PerfilTabState extends State<_PerfilTab> {
|
||||
await _addAnotherChild(context, uid);
|
||||
}
|
||||
} on TimeoutException {
|
||||
if (!mounted) return;
|
||||
messenger.showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Tempo esgotado ao adicionar. Tente novamente.'),
|
||||
),
|
||||
);
|
||||
if (!mounted || !context.mounted) return;
|
||||
showPillSnackBar(context, 'Tempo esgotado ao adicionar. Tente novamente.');
|
||||
} catch (e) {
|
||||
if (!mounted) return;
|
||||
messenger.showSnackBar(SnackBar(content: Text('Erro ao adicionar: $e')));
|
||||
if (!mounted || !context.mounted) return;
|
||||
showPillSnackBar(context, 'Erro ao adicionar: $e');
|
||||
} finally {
|
||||
if (mounted) setState(() => _addingChild = false);
|
||||
}
|
||||
@@ -2220,6 +2214,7 @@ class _AddChildSheetState extends State<_AddChildSheet> {
|
||||
helpText: 'Data de nascimento',
|
||||
cancelText: 'Cancelar',
|
||||
confirmText: 'Confirmar',
|
||||
locale: const Locale('pt', 'PT'),
|
||||
);
|
||||
if (picked == null) return;
|
||||
setState(() {
|
||||
@@ -2278,6 +2273,8 @@ class _AddChildSheetState extends State<_AddChildSheet> {
|
||||
TextFormField(
|
||||
controller: _nameController,
|
||||
textInputAction: TextInputAction.next,
|
||||
textCapitalization: TextCapitalization.sentences,
|
||||
inputFormatters: [CapitalizeFirstLetterFormatter()],
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Nome da criança',
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user