atualização

This commit is contained in:
Carlos Correia
2026-03-05 18:08:06 +00:00
parent ebca3cfdce
commit 6931d6ada2
18 changed files with 725 additions and 2191 deletions

View File

@@ -1,24 +1,34 @@
import 'package:flutter/material.dart';
import '../constants/app_colors.dart';
import '../screens/inicial_screen.dart';
import '../constants/app_strings.dart';
import '../screens/setting_screen.dart';
import '../screens/bluetooth_connection_screen.dart';
import '../screens/google_maps_screen.dart';
class LogadoScreen extends StatelessWidget {
class LogadoScreen extends StatefulWidget {
const LogadoScreen({super.key});
@override
State<LogadoScreen> createState() => _LogadoScreenState();
}
class _LogadoScreenState extends State<LogadoScreen> {
double progress = 0.65; // Simulação de progresso
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.background,
body: Stack(
children: [
// Static dark gray triangles
// Background triangles
Positioned(
top: -50,
left: -80,
child: CustomPaint(
size: const Size(160, 120),
painter: TrianglePainter(
color: Colors.grey.shade800.withOpacity(0.4),
color: Colors.grey.shade800.withValues(alpha: 0.4),
),
),
),
@@ -28,7 +38,7 @@ class LogadoScreen extends StatelessWidget {
child: CustomPaint(
size: const Size(120, 90),
painter: TrianglePainter(
color: Colors.grey.shade800.withOpacity(0.3),
color: Colors.grey.shade800.withAlpha(76),
),
),
),
@@ -38,7 +48,7 @@ class LogadoScreen extends StatelessWidget {
child: CustomPaint(
size: const Size(140, 105),
painter: TrianglePainter(
color: Colors.grey.shade800.withOpacity(0.35),
color: Colors.grey.shade800.withAlpha(89),
),
),
),
@@ -48,7 +58,7 @@ class LogadoScreen extends StatelessWidget {
child: CustomPaint(
size: const Size(100, 75),
painter: TrianglePainter(
color: Colors.grey.shade800.withOpacity(0.25),
color: Colors.grey.shade800.withAlpha(51),
),
),
),
@@ -58,7 +68,7 @@ class LogadoScreen extends StatelessWidget {
child: CustomPaint(
size: const Size(130, 98),
painter: TrianglePainter(
color: Colors.grey.shade800.withOpacity(0.3),
color: Colors.grey.shade800.withAlpha(76),
),
),
),
@@ -68,127 +78,329 @@ class LogadoScreen extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(height: 80), // Space for triangles
// Success icon with animation
TweenAnimationBuilder(
duration: const Duration(milliseconds: 600),
tween: Tween<double>(begin: 0.0, end: 1.0),
builder: (context, value, child) {
return Transform.scale(
scale: value,
child: Container(
width: 100,
height: 100,
decoration: BoxDecoration(
color: AppColors.buttonColor,
borderRadius: BorderRadius.circular(50),
boxShadow: [
BoxShadow(
color: AppColors.buttonColor.withOpacity(0.3),
blurRadius: 20,
spreadRadius: 5,
),
],
),
child: const Icon(
Icons.check,
size: 50,
color: AppColors.white,
),
),
);
},
),
const SizedBox(height: 32),
const SizedBox(height: 60),
// Welcome message with fade in
TweenAnimationBuilder(
duration: const Duration(milliseconds: 800),
tween: Tween<double>(begin: 0.0, end: 1.0),
builder: (context, value, child) {
return Opacity(
opacity: value,
child: const Text(
'Login Realizado!',
style: TextStyle(
fontSize: 32,
fontWeight: FontWeight.bold,
color: Colors.white,
),
textAlign: TextAlign.center,
),
);
},
),
const SizedBox(height: 16),
TweenAnimationBuilder(
duration: const Duration(milliseconds: 1000),
tween: Tween<double>(begin: 0.0, end: 1.0),
builder: (context, value, child) {
return Opacity(
opacity: value,
child: const Text(
'Você está autenticado com sucesso.',
style: TextStyle(fontSize: 18, color: Colors.white70),
textAlign: TextAlign.center,
),
);
},
),
const SizedBox(height: 48),
// Back button with slide up animation
TweenAnimationBuilder(
duration: const Duration(milliseconds: 1200),
tween: Tween<Offset>(
begin: Offset(0, 1),
end: Offset(0, 0),
),
builder: (context, value, child) {
return Transform.translate(
offset: value * 50,
child: SizedBox(
width: double.infinity,
height: 60,
child: ElevatedButton(
onPressed: () {
Navigator.of(context).pushReplacement(
MaterialPageRoute(
builder: (context) => const InicialScreen(),
),
);
},
style: ElevatedButton.styleFrom(
backgroundColor: AppColors.buttonColor,
foregroundColor: AppColors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
elevation: 5,
// Header with user info
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'Bem-vindo!',
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: Colors.white,
),
child: const Text(
'Voltar para Tela Inicial',
),
Text(
'Usuário Logado',
style: TextStyle(
fontSize: 16,
color: Colors.white.withValues(alpha: 0.7),
),
),
],
),
Container(
width: 50,
height: 50,
decoration: BoxDecoration(
color: AppColors.buttonColor,
borderRadius: BorderRadius.circular(25),
),
child: const Icon(
Icons.person,
color: Colors.white,
size: 30,
),
),
],
),
const SizedBox(height: 40),
// Stats cards
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
_buildStatCard(
AppStrings.complete,
'85%',
AppColors.success,
),
_buildStatCard(
AppStrings.steps,
'8,432',
AppColors.buttonColor,
),
_buildStatCard(AppStrings.bpm, '72', AppColors.error),
_buildStatCard(AppStrings.kcal, '420', AppColors.coral),
],
),
const SizedBox(height: 30),
// Progress section
Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: AppColors.backgroundGrey,
borderRadius: BorderRadius.circular(15),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
'Meta Diária',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
Text(
'${(progress * 100).toInt()}%',
style: const TextStyle(
fontSize: 16,
color: Colors.white,
),
),
],
),
const SizedBox(height: 15),
ClipRRect(
borderRadius: BorderRadius.circular(10),
child: LinearProgressIndicator(
value: progress,
minHeight: 8,
backgroundColor: AppColors.white.withValues(
alpha: 0.1,
),
valueColor: const AlwaysStoppedAnimation<Color>(
AppColors.white,
),
),
),
],
),
),
const SizedBox(height: 30),
// Map preview
GestureDetector(
onTap: () {
// Navigate to GoogleMapScreen
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const GoogleMapScreen(),
),
);
},
child: Container(
height: 200,
decoration: BoxDecoration(
color: AppColors.backgroundGrey,
borderRadius: BorderRadius.circular(15),
),
child: const Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.map_outlined,
size: 50,
color: Colors.white54,
),
SizedBox(height: 10),
Text(
AppStrings.mapPreview,
style: TextStyle(
color: Colors.white54,
fontSize: 16,
),
),
],
),
),
),
),
],
),
),
),
// Bottom navigation menu
Positioned(
bottom: 50,
left: 0,
right: 0,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
_buildMenuButton(Icons.settings_outlined, AppStrings.settings),
_buildMenuButton(Icons.group_outlined, AppStrings.groups),
_buildMenuButton(Icons.history_rounded, AppStrings.history),
_buildMenuButton(
Icons.notifications_none_rounded,
AppStrings.notifications,
showBadge: true,
),
_buildMenuButton(
Icons.person_outline_rounded,
AppStrings.profile,
isAvatar: true,
),
],
),
),
// Bluetooth action button
Positioned(
top: 60,
right: 25,
child: _buildSmallActionButton(Icons.bluetooth, AppColors.error),
),
],
),
);
}
Widget _buildStatCard(String title, String value, Color color) {
return Container(
padding: const EdgeInsets.all(15),
decoration: BoxDecoration(
color: AppColors.backgroundGrey,
borderRadius: BorderRadius.circular(12),
),
child: Column(
children: [
Text(
value,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: color,
),
),
const SizedBox(height: 5),
Text(
title,
style: const TextStyle(fontSize: 12, color: Colors.white70),
),
],
),
);
}
Widget _buildMenuButton(
IconData icon,
String label, {
bool showBadge = false,
bool isAvatar = false,
}) {
return GestureDetector(
onTap: () {
_handleMenuTap(label);
},
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: 50,
height: 50,
decoration: BoxDecoration(
color: AppColors.backgroundGrey,
borderRadius: BorderRadius.circular(25),
),
child: Stack(
children: [
Center(child: Icon(icon, color: Colors.white, size: 24)),
if (showBadge)
Positioned(
top: 8,
right: 8,
child: Container(
width: 8,
height: 8,
decoration: BoxDecoration(
color: AppColors.error,
borderRadius: BorderRadius.circular(4),
),
),
),
],
),
),
const SizedBox(height: 8),
Text(
label,
style: const TextStyle(fontSize: 12, color: Colors.white70),
),
],
),
);
}
Widget _buildSmallActionButton(IconData icon, Color color) {
return GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const BluetoothConnectionScreen(),
),
);
},
child: Container(
width: 45,
height: 45,
decoration: BoxDecoration(
color: color,
borderRadius: BorderRadius.circular(22.5),
boxShadow: [
BoxShadow(
color: color.withValues(alpha: 0.3),
blurRadius: 10,
spreadRadius: 2,
),
],
),
child: Icon(icon, color: Colors.white, size: 20),
),
);
}
void _handleMenuTap(String label) {
switch (label) {
case 'Configurações':
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const SettingsScreen()),
);
break;
case 'Perfil':
// Navigate to profile
break;
case 'Histórico':
// Navigate to history
break;
case 'Grupos':
// Navigate to groups
break;
case 'Notificações':
// Navigate to notifications
break;
}
}
}
// Custom painter for triangles