Files
DiasAbertos_RunVisionPro/lib/screens/logado_screen.dart

432 lines
13 KiB
Dart

import 'package:flutter/material.dart';
import '../constants/app_colors.dart';
import '../constants/app_strings.dart';
import 'setting_screen.dart';
import 'bluethoot_cpnnection_screen.dart';
import 'google_map_screen.dart';
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: [
// Background triangles
Positioned(
top: -50,
left: -80,
child: CustomPaint(
size: const Size(160, 120),
painter: TrianglePainter(
color: Colors.grey.shade800.withValues(alpha: 0.4),
),
),
),
Positioned(
top: 20,
right: -60,
child: CustomPaint(
size: const Size(120, 90),
painter: TrianglePainter(
color: Colors.grey.shade800.withValues(alpha: 0.3),
),
),
),
Positioned(
top: 80,
left: 40,
child: CustomPaint(
size: const Size(140, 105),
painter: TrianglePainter(
color: Colors.grey.shade800.withValues(alpha: 0.35),
),
),
),
Positioned(
top: 120,
right: 80,
child: CustomPaint(
size: const Size(100, 75),
painter: TrianglePainter(
color: Colors.grey.shade800.withValues(alpha: 0.2),
),
),
),
Positioned(
top: 160,
left: -40,
child: CustomPaint(
size: const Size(130, 98),
painter: TrianglePainter(
color: Colors.grey.shade800.withValues(alpha: 0.3),
),
),
),
// Main content
SafeArea(
child: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
children: [
const SizedBox(height: 60),
// 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,
),
),
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.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
class TrianglePainter extends CustomPainter {
final Color color;
TrianglePainter({required this.color});
@override
void paint(Canvas canvas, Size size) {
final paint = Paint()
..color = color
..style = PaintingStyle.fill;
final path = Path();
path.moveTo(size.width / 2, 0);
path.lineTo(0, size.height);
path.lineTo(size.width, size.height);
path.close();
canvas.drawPath(path, paint);
}
@override
bool shouldRepaint(covariant CustomPainter oldDelegate) {
return false;
}
}