CKT String|Colors
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../colors/app_colors.dart';
|
||||
|
||||
import '../main.dart' show supabase;
|
||||
import '../strings/settings_strings.dart';
|
||||
import '../widgets/app_dialogs.dart';
|
||||
import '../widgets/entrance.dart';
|
||||
import '../widgets/pill_snackbar.dart';
|
||||
@@ -8,8 +10,8 @@ import '../widgets/tap_bounce.dart';
|
||||
import 'credits_screen.dart';
|
||||
import 'terms_screen.dart';
|
||||
|
||||
const Color _teal = Color(0xFF2F9E94);
|
||||
const Color _accentPink = Color(0xFFFF55A7);
|
||||
const Color _teal = AppColors.teal;
|
||||
const Color _accentPink = AppColors.pink;
|
||||
|
||||
/// Conteúdo da aba de Configurações, para ser embutido na bottom navigation
|
||||
/// do LoggedHomeScreen (sem Scaffold/AppBar próprios).
|
||||
@@ -32,13 +34,9 @@ class _SettingsBodyState extends State<SettingsBody> {
|
||||
Future<void> _confirmDeleteAccountData() async {
|
||||
final confirmed = await showConfirmDialog(
|
||||
context,
|
||||
title: 'Apagar dados da conta',
|
||||
message:
|
||||
'Isto remove permanentemente a sua conta, perfil, crianças '
|
||||
'registadas e fotos — incluindo o login, permitindo criar uma '
|
||||
'nova conta com o mesmo e-mail depois. Esta ação não pode ser '
|
||||
'desfeita. Pretende continuar?',
|
||||
confirmLabel: 'Apagar',
|
||||
title: SettingsStrings.deleteAccountData,
|
||||
message: SettingsStrings.deleteAccountMessage,
|
||||
confirmLabel: SettingsStrings.delete,
|
||||
confirmColor: _accentPink,
|
||||
);
|
||||
|
||||
@@ -56,7 +54,8 @@ class _SettingsBodyState extends State<SettingsBody> {
|
||||
final errorMessage = (data is Map) ? data['error']?.toString() : null;
|
||||
if (response.status != 200 || errorMessage != null) {
|
||||
throw StateError(
|
||||
errorMessage ?? 'Erro ao apagar conta (status ${response.status})',
|
||||
errorMessage ??
|
||||
SettingsStrings.errorDeletingAccount(response.status),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -64,7 +63,7 @@ class _SettingsBodyState extends State<SettingsBody> {
|
||||
if (!mounted) return;
|
||||
Navigator.of(context).popUntil((route) => route.isFirst);
|
||||
} catch (e) {
|
||||
if (mounted) showPillSnackBar(context, 'Erro ao apagar: $e');
|
||||
if (mounted) showPillSnackBar(context, SettingsStrings.errorDeleting(e));
|
||||
} finally {
|
||||
if (mounted) setState(() => _deletingAccount = false);
|
||||
}
|
||||
@@ -83,18 +82,18 @@ class _SettingsBodyState extends State<SettingsBody> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
_SectionLabel('Conta'),
|
||||
_SectionLabel(SettingsStrings.account),
|
||||
_SettingsCard(
|
||||
children: [
|
||||
_InfoTile(
|
||||
icon: Icons.person_outline_rounded,
|
||||
title: name.isEmpty ? 'Sem nome' : name,
|
||||
title: name.isEmpty ? SettingsStrings.noName : name,
|
||||
subtitle: email,
|
||||
),
|
||||
const Divider(height: 1),
|
||||
_ActionTile(
|
||||
icon: Icons.logout_rounded,
|
||||
title: 'Sair',
|
||||
title: SettingsStrings.signOut,
|
||||
onTap: _signOut,
|
||||
),
|
||||
],
|
||||
@@ -108,12 +107,12 @@ class _SettingsBodyState extends State<SettingsBody> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
_SectionLabel('Sobre'),
|
||||
_SectionLabel(SettingsStrings.about),
|
||||
_SettingsCard(
|
||||
children: [
|
||||
_ActionTile(
|
||||
icon: Icons.description_outlined,
|
||||
title: 'Termos de Serviço',
|
||||
title: SettingsStrings.termsOfService,
|
||||
onTap: () => Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => const TermsScreen(),
|
||||
@@ -123,7 +122,7 @@ class _SettingsBodyState extends State<SettingsBody> {
|
||||
const Divider(height: 1),
|
||||
_ActionTile(
|
||||
icon: Icons.diversity_3_outlined,
|
||||
title: 'Criadores e colaboradores',
|
||||
title: SettingsStrings.creatorsAndContributors,
|
||||
onTap: () => Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => const CreditsScreen(),
|
||||
@@ -133,7 +132,7 @@ class _SettingsBodyState extends State<SettingsBody> {
|
||||
const Divider(height: 1),
|
||||
const _InfoTile(
|
||||
icon: Icons.info_outline_rounded,
|
||||
title: 'Versão do app',
|
||||
title: SettingsStrings.appVersion,
|
||||
subtitle: '1.0.0',
|
||||
),
|
||||
],
|
||||
@@ -147,12 +146,12 @@ class _SettingsBodyState extends State<SettingsBody> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
_SectionLabel('Zona de risco'),
|
||||
_SectionLabel(SettingsStrings.dangerZone),
|
||||
_SettingsCard(
|
||||
children: [
|
||||
_ActionTile(
|
||||
icon: Icons.delete_forever_rounded,
|
||||
title: 'Apagar dados da conta',
|
||||
title: SettingsStrings.deleteAccountData,
|
||||
titleColor: _accentPink,
|
||||
loading: _deletingAccount,
|
||||
onTap: _deletingAccount ? null : _confirmDeleteAccountData,
|
||||
|
||||
Reference in New Issue
Block a user