Strings quase feitas

This commit is contained in:
2026-03-18 16:20:18 +00:00
parent 7f80ed47f3
commit 6322e8d798
8 changed files with 324 additions and 228 deletions

View File

@@ -77,7 +77,7 @@ class _BluetoothConnectionScreenState extends State<BluetoothConnectionScreen> {
} else {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
SnackBar(
content: Text(AppStrings.permissionsDenied),
behavior: SnackBarBehavior.floating,
),
@@ -93,19 +93,19 @@ class _BluetoothConnectionScreenState extends State<BluetoothConnectionScreen> {
showDialog(
context: context,
builder: (context) => AlertDialog(
title: const Text("Permissões Necessárias"),
content: const Text("As permissões de Bluetooth foram negadas permanentemente. Por favor, habilite-as nas configurações do sistema para continuar."),
title: Text(AppStrings.permissionsNeeded),
content: Text(AppStrings.permissionsDeniedPermanent),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text("CANCELAR"),
child: Text(AppStrings.btnCancel),
),
TextButton(
onPressed: () {
openAppSettings();
Navigator.pop(context);
},
child: const Text("CONFIGURAÇÕES"),
child: Text(AppStrings.settingsTitle),
),
],
),
@@ -117,7 +117,7 @@ class _BluetoothConnectionScreenState extends State<BluetoothConnectionScreen> {
if (await FlutterBluePlus.adapterState.first != BluetoothAdapterState.on) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
SnackBar(
content: Text(AppStrings.turnOnBluetooth),
behavior: SnackBarBehavior.floating,
),
@@ -174,7 +174,7 @@ class _BluetoothConnectionScreenState extends State<BluetoothConnectionScreen> {
});
FlutterBluePlus.stopScan();
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
SnackBar(
content: Text(AppStrings.connectedSuccess),
backgroundColor: AppColors.success,
behavior: SnackBarBehavior.floating,
@@ -208,9 +208,9 @@ class _BluetoothConnectionScreenState extends State<BluetoothConnectionScreen> {
return Scaffold(
backgroundColor: AppColors.background,
appBar: AppBar(
title: const Text(
title: Text(
AppStrings.bluetoothTitle,
style: TextStyle(
style: const TextStyle(
fontWeight: FontWeight.w900,
letterSpacing: 2,
color: Colors.white,

View File

@@ -192,17 +192,17 @@ class _GoogleMapScreenState extends State<GoogleMapScreen> {
builder: (context) => AlertDialog(
backgroundColor: AppColors.backgroundGrey,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(25)),
title: const Text("Iniciar Corrida?", style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)),
content: const Text("Deseja começar o monitoramento agora?", style: TextStyle(color: Colors.white70)),
title: Text(AppStrings.startRunQuestion, style: const TextStyle(color: Colors.white, fontWeight: FontWeight.bold)),
content: Text(AppStrings.startRunDescription, style: const TextStyle(color: Colors.white70)),
actions: [
TextButton(onPressed: () => Navigator.pop(context), child: const Text(AppStrings.cancel, style: TextStyle(color: Colors.white54))),
TextButton(onPressed: () => Navigator.pop(context), child: Text(AppStrings.cancel, style: const TextStyle(color: Colors.white54))),
ElevatedButton(
onPressed: () {
Navigator.pop(context);
_startCountdown();
},
style: ElevatedButton.styleFrom(backgroundColor: AppColors.coral, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15))),
child: const Text(AppStrings.yes, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)),
child: Text(AppStrings.yes, style: const TextStyle(color: Colors.white, fontWeight: FontWeight.bold)),
),
],
),
@@ -256,7 +256,7 @@ class _GoogleMapScreenState extends State<GoogleMapScreen> {
showGeneralDialog(
context: context,
barrierDismissible: false,
barrierLabel: "Resultados",
barrierLabel: AppStrings.results,
pageBuilder: (context, anim1, anim2) => const SizedBox(),
transitionBuilder: (context, anim1, anim2, child) {
return FadeTransition(
@@ -279,7 +279,7 @@ class _GoogleMapScreenState extends State<GoogleMapScreen> {
child: const Icon(Icons.emoji_events_rounded, color: Colors.white, size: 40),
),
const SizedBox(height: 20),
const Text(AppStrings.runFinished, style: TextStyle(color: Colors.white, fontSize: 24, fontWeight: FontWeight.w900, letterSpacing: 1)),
Text(AppStrings.runFinished, style: const TextStyle(color: Colors.white, fontSize: 24, fontWeight: FontWeight.w900, letterSpacing: 1)),
const SizedBox(height: 30),
Container(
height: 180,
@@ -317,7 +317,7 @@ class _GoogleMapScreenState extends State<GoogleMapScreen> {
const Divider(color: Colors.white10, height: 25),
_buildResultRow(AppStrings.totalTime, _formatTime(finalTime)),
const Divider(color: Colors.white10, height: 25),
_buildResultRow("VELOCIDADE MÁX", "${finalMaxSpeed.toStringAsFixed(1)} ${AppStrings.kmhUnit}"),
_buildResultRow(AppStrings.maxSpeed, "${finalMaxSpeed.toStringAsFixed(1)} ${AppStrings.kmhUnit}"),
const SizedBox(height: 35),
SizedBox(
width: double.infinity,
@@ -459,7 +459,7 @@ class _GoogleMapScreenState extends State<GoogleMapScreen> {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Text("PREPARAR", style: TextStyle(color: Colors.white54, fontSize: 24, fontWeight: FontWeight.bold, letterSpacing: 5)),
Text(AppStrings.prepare, style: const TextStyle(color: Colors.white54, fontSize: 24, fontWeight: FontWeight.bold, letterSpacing: 5)),
const SizedBox(height: 20),
Text("$_countdownValue", style: const TextStyle(color: AppColors.coral, fontSize: 160, fontWeight: FontWeight.w900)),
],

View File

@@ -47,12 +47,12 @@ class _LogadoScreenState extends State<LogadoScreen> {
builder: (context) => AlertDialog(
backgroundColor: AppColors.backgroundGrey,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(30)),
title: const Text("Definir Meta Diária", style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)),
title: Text(AppStrings.defineDailyGoal, style: const TextStyle(color: Colors.white, fontWeight: FontWeight.bold)),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
...[5, 10, 15, 20].map((km) => ListTile(
title: Text("$km KM", style: const TextStyle(color: Colors.white)),
title: Text("$km ${AppStrings.kmUnit}", style: const TextStyle(color: Colors.white)),
onTap: () {
setState(() {
_dailyGoal = km.toDouble();
@@ -63,7 +63,7 @@ class _LogadoScreenState extends State<LogadoScreen> {
const Divider(color: Colors.white10),
ListTile(
leading: const Icon(Icons.edit_note_rounded, color: AppColors.coral),
title: const Text("Personalizado", style: TextStyle(color: AppColors.coral, fontWeight: FontWeight.bold)),
title: Text(AppStrings.customGoal, style: const TextStyle(color: AppColors.coral, fontWeight: FontWeight.bold)),
onTap: () {
Navigator.pop(context);
_showCustomGoalDialog();
@@ -82,7 +82,7 @@ class _LogadoScreenState extends State<LogadoScreen> {
builder: (context) => AlertDialog(
backgroundColor: AppColors.backgroundGrey,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(30)),
title: const Text("Meta Personalizada", style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)),
title: Text(AppStrings.customGoalTitle, style: const TextStyle(color: Colors.white, fontWeight: FontWeight.bold)),
content: TextField(
controller: controller,
keyboardType: const TextInputType.numberWithOptions(decimal: true),
@@ -91,17 +91,17 @@ class _LogadoScreenState extends State<LogadoScreen> {
decoration: InputDecoration(
hintText: "Ex: 12.5",
hintStyle: const TextStyle(color: Colors.white24),
suffixText: "KM",
suffixText: AppStrings.kmUnit,
suffixStyle: const TextStyle(color: Colors.white54),
enabledBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.white24)),
focusedBorder: UnderlineInputBorder(borderSide: BorderSide(color: AppColors.coral)),
enabledBorder: const UnderlineInputBorder(borderSide: BorderSide(color: Colors.white24)),
focusedBorder: const UnderlineInputBorder(borderSide: BorderSide(color: AppColors.coral)),
),
autofocus: true,
),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text("CANCELAR", style: TextStyle(color: Colors.white54)),
child: Text(AppStrings.btnCancel, style: const TextStyle(color: Colors.white54)),
),
ElevatedButton(
onPressed: () {
@@ -117,7 +117,7 @@ class _LogadoScreenState extends State<LogadoScreen> {
backgroundColor: AppColors.coral,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)),
),
child: const Text("DEFINIR", style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)),
child: Text(AppStrings.btnDefine, style: const TextStyle(color: Colors.white, fontWeight: FontWeight.bold)),
),
],
),
@@ -127,7 +127,7 @@ class _LogadoScreenState extends State<LogadoScreen> {
@override
Widget build(BuildContext context) {
final user = SupabaseService.currentUser;
final userName = user?.userMetadata?['name'] ?? user?.email?.split('@')[0] ?? 'Corredor';
final userName = user?.userMetadata?['name'] ?? user?.email?.split('@')[0] ?? AppStrings.userPlaceholder;
return Scaffold(
backgroundColor: AppColors.background,
@@ -210,9 +210,9 @@ class _LogadoScreenState extends State<LogadoScreen> {
const SizedBox(height: 30),
// Personal Bests Section
const Text(
"RECORDS PESSOAIS",
style: TextStyle(
Text(
AppStrings.personalRecords,
style: const TextStyle(
color: Colors.white38,
fontSize: 11,
fontWeight: FontWeight.w900,
@@ -247,9 +247,9 @@ class _LogadoScreenState extends State<LogadoScreen> {
const SizedBox(height: 25),
// Steps Section (Atividade Geral)
const Text(
"ATIVIDADE GERAL",
style: TextStyle(
Text(
AppStrings.generalActivity,
style: const TextStyle(
color: Colors.white38,
fontSize: 11,
fontWeight: FontWeight.w900,
@@ -260,7 +260,7 @@ class _LogadoScreenState extends State<LogadoScreen> {
_buildWideRecordCard(
AppStrings.steps,
_steps.toString(),
"passos hoje",
AppStrings.stepsToday,
Icons.directions_walk_rounded,
AppColors.success,
),
@@ -347,9 +347,9 @@ class _LogadoScreenState extends State<LogadoScreen> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
Text(
AppStrings.dailyGoal,
style: TextStyle(color: Colors.white54, fontWeight: FontWeight.bold, letterSpacing: 1),
style: const TextStyle(color: Colors.white54, fontWeight: FontWeight.bold, letterSpacing: 1),
),
if (_dailyGoal > 0)
Text(
@@ -388,9 +388,9 @@ class _LogadoScreenState extends State<LogadoScreen> {
child: const Icon(Icons.add_task_rounded, color: AppColors.coral, size: 40),
),
const SizedBox(height: 10),
const Text(
"DEFINIR META",
style: TextStyle(color: Colors.white, fontSize: 12, fontWeight: FontWeight.w900, letterSpacing: 1),
Text(
AppStrings.setGoal,
style: const TextStyle(color: Colors.white, fontSize: 12, fontWeight: FontWeight.w900, letterSpacing: 1),
),
],
),
@@ -399,7 +399,7 @@ class _LogadoScreenState extends State<LogadoScreen> {
Column(
mainAxisSize: MainAxisSize.min,
children: [
const Text("DISTÂNCIA", style: TextStyle(color: Colors.white38, fontSize: 10, fontWeight: FontWeight.bold, letterSpacing: 2)),
Text(AppStrings.distance, style: const TextStyle(color: Colors.white38, fontSize: 10, fontWeight: FontWeight.bold, letterSpacing: 2)),
Text(
_currentDistance.toStringAsFixed(1),
style: const TextStyle(color: Colors.white, fontSize: 48, fontWeight: FontWeight.w900),
@@ -416,9 +416,9 @@ class _LogadoScreenState extends State<LogadoScreen> {
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
_buildSimpleStat("PASSOS", "${(_steps / 1000).toStringAsFixed(1)}k"),
_buildSimpleStat(AppStrings.steps, "${(_steps / 1000).toStringAsFixed(1)}k"),
const SizedBox(width: 40),
_buildSimpleStat("TEMPO", "${_totalTimeMinutes}m"),
_buildSimpleStat(AppStrings.time, "${_totalTimeMinutes}m"),
],
)
],

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import '../constants/app_colors.dart';
import '../constants/app_strings.dart';
import '../services/supabase_service.dart';
class SettingsScreen extends StatefulWidget {
@@ -18,15 +19,15 @@ class _SettingsScreenState extends State<SettingsScreen> {
Widget build(BuildContext context) {
final user = SupabaseService.currentUser;
final userName =
user?.userMetadata?['name'] ?? user?.email?.split('@')[0] ?? 'Usuário';
user?.userMetadata?['name'] ?? user?.email?.split('@')[0] ?? AppStrings.userPlaceholder;
final userEmail = user?.email ?? 'usuario@exemplo.com';
return Scaffold(
backgroundColor: AppColors.background,
appBar: AppBar(
title: const Text(
'CONFIGURAÇÕES',
style: TextStyle(
title: Text(
AppStrings.settingsTitle,
style: const TextStyle(
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.bold,
@@ -93,8 +94,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
icon: const Icon(Icons.edit, color: AppColors.buttonColor),
onPressed: () {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Editar perfil'),
SnackBar(
content: Text(AppStrings.editProfile),
backgroundColor: AppColors.buttonColor,
),
);
@@ -116,7 +117,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
children: [
_buildSettingsItem(
icon: Icons.schedule,
title: 'Ajustar Data e Hora',
title: AppStrings.adjustDateTime,
onTap: () {
_showDatePicker(context);
},
@@ -124,7 +125,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
_buildDivider(),
_buildSettingsItem(
icon: Icons.dark_mode,
title: 'Modo Noturno',
title: AppStrings.nightMode,
trailing: Switch(
value: _isNightMode,
activeThumbColor: AppColors.buttonColor,
@@ -138,7 +139,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
_buildDivider(),
_buildSettingsItem(
icon: Icons.language,
title: 'Idioma',
title: AppStrings.language,
trailing: Text(
_selectedLanguage,
style: TextStyle(
@@ -153,11 +154,11 @@ class _SettingsScreenState extends State<SettingsScreen> {
_buildDivider(),
_buildSettingsItem(
icon: Icons.accessibility,
title: 'Acessibilidade',
title: AppStrings.accessibility,
onTap: () {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Acessibilidade'),
SnackBar(
content: Text(AppStrings.accessibility),
backgroundColor: AppColors.buttonColor,
),
);
@@ -166,7 +167,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
_buildDivider(),
_buildSettingsItem(
icon: Icons.notifications,
title: 'Notificações',
title: AppStrings.notifications,
trailing: Switch(
value: _notificationsEnabled,
onChanged: (value) {
@@ -180,11 +181,11 @@ class _SettingsScreenState extends State<SettingsScreen> {
_buildDivider(),
_buildSettingsItem(
icon: Icons.privacy_tip,
title: 'Privacidade e Segurança',
title: AppStrings.privacySecurity,
onTap: () {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Privacidade e Segurança'),
SnackBar(
content: Text(AppStrings.privacySecurity),
backgroundColor: AppColors.buttonColor,
),
);
@@ -193,11 +194,11 @@ class _SettingsScreenState extends State<SettingsScreen> {
_buildDivider(),
_buildSettingsItem(
icon: Icons.description,
title: 'Termos de Uso',
title: AppStrings.termsOfUse,
onTap: () {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Termos de Uso'),
SnackBar(
content: Text(AppStrings.termsOfUse),
backgroundColor: AppColors.buttonColor,
),
);
@@ -206,7 +207,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
_buildDivider(),
_buildSettingsItem(
icon: Icons.info,
title: 'Sobre',
title: AppStrings.about,
onTap: () {
_showAboutDialog(context);
},
@@ -231,9 +232,9 @@ class _SettingsScreenState extends State<SettingsScreen> {
borderRadius: BorderRadius.circular(12),
),
),
child: const Text(
'Sair',
style: TextStyle(
child: Text(
AppStrings.logout,
style: const TextStyle(
color: Colors.white,
fontSize: 16,
fontWeight: FontWeight.bold,
@@ -287,7 +288,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
if (date != null && mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('Data selecionada: ${date.toString().split(' ')[0]}'),
content: Text('${AppStrings.dateSelected}: ${date.toString().split(' ')[0]}'),
backgroundColor: AppColors.buttonColor,
),
);
@@ -300,9 +301,9 @@ class _SettingsScreenState extends State<SettingsScreen> {
context: context,
builder: (context) => AlertDialog(
backgroundColor: AppColors.backgroundGrey,
title: const Text(
'Selecionar Idioma',
style: TextStyle(color: Colors.white),
title: Text(
AppStrings.selectLanguage,
style: const TextStyle(color: Colors.white),
),
content: Column(
mainAxisSize: MainAxisSize.min,
@@ -315,9 +316,9 @@ class _SettingsScreenState extends State<SettingsScreen> {
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text(
'Cancelar',
style: TextStyle(color: AppColors.buttonColor),
child: Text(
AppStrings.btnCancel,
style: const TextStyle(color: AppColors.buttonColor),
),
),
],
@@ -332,18 +333,25 @@ class _SettingsScreenState extends State<SettingsScreen> {
value: language,
groupValue: _selectedLanguage,
onChanged: (value) {
setState(() {
_selectedLanguage = value!;
});
Navigator.pop(context);
if (value != null) {
setState(() {
_selectedLanguage = value;
AppStrings.setLanguage(value);
});
Navigator.pop(context);
// Force rebuild of current screen to apply changes
setState(() {});
}
},
fillColor: WidgetStateProperty.all(AppColors.buttonColor),
),
onTap: () {
setState(() {
_selectedLanguage = language;
AppStrings.setLanguage(language);
});
Navigator.pop(context);
setState(() {});
},
);
}
@@ -353,33 +361,33 @@ class _SettingsScreenState extends State<SettingsScreen> {
context: context,
builder: (context) => AlertDialog(
backgroundColor: AppColors.backgroundGrey,
title: const Text('Sobre', style: TextStyle(color: Colors.white)),
content: const Column(
title: Text(AppStrings.about, style: const TextStyle(color: Colors.white)),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Run Vision Pro',
style: TextStyle(
AppStrings.appTitle,
style: const TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 8),
Text('Versão: 1.0.0', style: TextStyle(color: Colors.white70)),
SizedBox(height: 8),
const SizedBox(height: 8),
Text('${AppStrings.version}: 1.0.0', style: const TextStyle(color: Colors.white70)),
const SizedBox(height: 8),
Text(
'Aplicativo de corrida com estatísticas e mapas',
style: TextStyle(color: Colors.white70),
AppStrings.appDescription,
style: const TextStyle(color: Colors.white70),
),
],
),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text(
'OK',
style: TextStyle(color: AppColors.buttonColor),
child: Text(
AppStrings.btnOk,
style: const TextStyle(color: AppColors.buttonColor),
),
),
],
@@ -392,20 +400,20 @@ class _SettingsScreenState extends State<SettingsScreen> {
context: context,
builder: (context) => AlertDialog(
backgroundColor: AppColors.backgroundGrey,
title: const Text(
'Confirmar Logout',
style: TextStyle(color: Colors.white),
title: Text(
AppStrings.confirmLogout,
style: const TextStyle(color: Colors.white),
),
content: const Text(
'Tem certeza que deseja sair?',
style: TextStyle(color: Colors.white70),
content: Text(
AppStrings.confirmLogoutMessage,
style: const TextStyle(color: Colors.white70),
),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text(
'Cancelar',
style: TextStyle(color: AppColors.buttonColor),
child: Text(
AppStrings.btnCancel,
style: const TextStyle(color: AppColors.buttonColor),
),
),
TextButton(
@@ -413,7 +421,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
Navigator.pop(context);
Navigator.pushReplacementNamed(context, '/');
},
child: const Text('Sair', style: TextStyle(color: Colors.red)),
child: Text(AppStrings.logout, style: const TextStyle(color: Colors.red)),
),
],
),