Mudança no mapa e Tela inicial
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import '../constants/app_colors.dart';
|
||||
import '../constants/app_strings.dart';
|
||||
import '../services/supabase_service.dart';
|
||||
import 'setting_screen.dart';
|
||||
import 'bluethoot_cpnnection_screen.dart';
|
||||
import 'bluetooth_connection_screen.dart';
|
||||
import 'google_map_screen.dart';
|
||||
|
||||
class LogadoScreen extends StatefulWidget {
|
||||
@@ -13,419 +15,492 @@ class LogadoScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _LogadoScreenState extends State<LogadoScreen> {
|
||||
double progress = 0.65; // Simulação de progresso
|
||||
// Estado dinâmico do utilizador
|
||||
double _dailyGoal = 0.0; // 0.0 significa que ainda não foi definida
|
||||
double _currentDistance = 0.0;
|
||||
double _bestDistance = 12.4; // Exemplo de recorde
|
||||
double _bestSpeed = 16.8; // Exemplo de recorde
|
||||
int _steps = 0;
|
||||
int _totalTimeMinutes = 0;
|
||||
|
||||
double get _progress => _dailyGoal > 0 ? (_currentDistance / _dailyGoal).clamp(0.0, 1.0) : 0.0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_loadUserData();
|
||||
}
|
||||
|
||||
Future<void> _loadUserData() async {
|
||||
// No futuro, aqui buscaríamos os dados reais do Supabase ou Local Storage
|
||||
setState(() {
|
||||
// Simulação de dados carregados
|
||||
_currentDistance = 0.0; // Começa o dia a zero
|
||||
_steps = 0;
|
||||
_totalTimeMinutes = 0;
|
||||
});
|
||||
}
|
||||
|
||||
void _showGoalDialog() {
|
||||
showDialog(
|
||||
context: context,
|
||||
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)),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
...[5, 10, 15, 20].map((km) => ListTile(
|
||||
title: Text("$km KM", style: const TextStyle(color: Colors.white)),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_dailyGoal = km.toDouble();
|
||||
});
|
||||
Navigator.pop(context);
|
||||
},
|
||||
)),
|
||||
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)),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
_showCustomGoalDialog();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _showCustomGoalDialog() {
|
||||
final TextEditingController controller = TextEditingController();
|
||||
showDialog(
|
||||
context: context,
|
||||
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)),
|
||||
content: TextField(
|
||||
controller: controller,
|
||||
keyboardType: const TextInputType.numberWithOptions(decimal: true),
|
||||
inputFormatters: [FilteringTextInputFormatter.allow(RegExp(r'^\d+\.?\d*'))],
|
||||
style: const TextStyle(color: Colors.white),
|
||||
decoration: InputDecoration(
|
||||
hintText: "Ex: 12.5",
|
||||
hintStyle: const TextStyle(color: Colors.white24),
|
||||
suffixText: "KM",
|
||||
suffixStyle: const TextStyle(color: Colors.white54),
|
||||
enabledBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.white24)),
|
||||
focusedBorder: UnderlineInputBorder(borderSide: BorderSide(color: AppColors.coral)),
|
||||
),
|
||||
autofocus: true,
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: const Text("CANCELAR", style: TextStyle(color: Colors.white54)),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
final value = double.tryParse(controller.text);
|
||||
if (value != null && value > 0) {
|
||||
setState(() {
|
||||
_dailyGoal = value;
|
||||
});
|
||||
Navigator.pop(context);
|
||||
}
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.coral,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)),
|
||||
),
|
||||
child: const Text("DEFINIR", style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final user = SupabaseService.currentUser;
|
||||
final userName = user?.userMetadata?['name'] ?? user?.email?.split('@')[0] ?? 'Corredor';
|
||||
|
||||
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),
|
||||
// Background Gradient
|
||||
Positioned.fill(
|
||||
child: Container(
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [Color(0xFF2D2D31), AppColors.background],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
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(
|
||||
child: Column(
|
||||
children: [
|
||||
// Header Bar
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
child: 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(
|
||||
AppStrings.welcome.toUpperCase(),
|
||||
style: const TextStyle(
|
||||
color: Colors.white38,
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w900,
|
||||
letterSpacing: 2,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Usuário Logado',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.white.withValues(alpha: 0.7),
|
||||
userName,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w900,
|
||||
letterSpacing: -0.5,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
width: 50,
|
||||
height: 50,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.buttonColor,
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.person,
|
||||
color: Colors.white,
|
||||
size: 30,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
_buildIconButton(
|
||||
Icons.bluetooth_audio_rounded,
|
||||
() => Navigator.push(context, MaterialPageRoute(builder: (context) => const BluetoothConnectionScreen())),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
_buildIconButton(
|
||||
Icons.settings_rounded,
|
||||
() => Navigator.push(context, MaterialPageRoute(builder: (context) => const SettingsScreen())),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
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),
|
||||
),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// Main Tracking Card (Meta Diária)
|
||||
_buildMainTrackingCard(),
|
||||
|
||||
const SizedBox(height: 30),
|
||||
|
||||
// Personal Bests Section
|
||||
const Text(
|
||||
"RECORDS PESSOAIS",
|
||||
style: TextStyle(
|
||||
color: Colors.white38,
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w900,
|
||||
letterSpacing: 1.5,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Text(
|
||||
'Meta Diária',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
Expanded(
|
||||
child: _buildRecordCard(
|
||||
AppStrings.bestDistance,
|
||||
_bestDistance.toStringAsFixed(1),
|
||||
AppStrings.kmUnit,
|
||||
Icons.auto_graph_rounded,
|
||||
AppColors.coral,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'${(progress * 100).toInt()}%',
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.white,
|
||||
const SizedBox(width: 15),
|
||||
Expanded(
|
||||
child: _buildRecordCard(
|
||||
AppStrings.bestSpeed,
|
||||
_bestSpeed.toStringAsFixed(1),
|
||||
AppStrings.kmhUnit,
|
||||
Icons.speed_rounded,
|
||||
Colors.cyanAccent,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
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: 25),
|
||||
|
||||
// Steps Section (Atividade Geral)
|
||||
const Text(
|
||||
"ATIVIDADE GERAL",
|
||||
style: TextStyle(
|
||||
color: Colors.white38,
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w900,
|
||||
letterSpacing: 1.5,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
_buildWideRecordCard(
|
||||
AppStrings.steps,
|
||||
_steps.toString(),
|
||||
"passos hoje",
|
||||
Icons.directions_walk_rounded,
|
||||
AppColors.success,
|
||||
),
|
||||
|
||||
const SizedBox(height: 120), // Espaço para o botão inferior
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
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 Action Button
|
||||
Positioned(
|
||||
bottom: 30,
|
||||
left: 50,
|
||||
right: 50,
|
||||
child: Container(
|
||||
height: 70,
|
||||
decoration: BoxDecoration(
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColors.coral.withValues(alpha: 0.3),
|
||||
blurRadius: 25,
|
||||
spreadRadius: -5,
|
||||
)
|
||||
],
|
||||
),
|
||||
child: ElevatedButton(
|
||||
onPressed: () => Navigator.push(context, MaterialPageRoute(builder: (context) => const GoogleMapScreen())),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.coral,
|
||||
foregroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(25)),
|
||||
elevation: 0,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(Icons.play_arrow_rounded, size: 30),
|
||||
const SizedBox(width: 10),
|
||||
Text(
|
||||
AppStrings.startTraining,
|
||||
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w900, letterSpacing: 1.5),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// 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) {
|
||||
Widget _buildIconButton(IconData icon, VoidCallback onTap) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withValues(alpha: 0.05),
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
border: Border.all(color: Colors.white10),
|
||||
),
|
||||
child: Icon(icon, color: Colors.white, size: 22),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMainTrackingCard() {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(15),
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(25),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.backgroundGrey,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderRadius: BorderRadius.circular(45),
|
||||
border: Border.all(color: Colors.white10, width: 2),
|
||||
boxShadow: const [BoxShadow(color: Colors.black26, blurRadius: 20, offset: Offset(0, 10))],
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
value,
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: color,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Text(
|
||||
AppStrings.dailyGoal,
|
||||
style: TextStyle(color: Colors.white54, fontWeight: FontWeight.bold, letterSpacing: 1),
|
||||
),
|
||||
if (_dailyGoal > 0)
|
||||
Text(
|
||||
"${(_progress * 100).toInt()}%",
|
||||
style: const TextStyle(color: AppColors.coral, fontWeight: FontWeight.w900),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Text(
|
||||
title,
|
||||
style: const TextStyle(fontSize: 12, color: Colors.white70),
|
||||
const SizedBox(height: 20),
|
||||
Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 180,
|
||||
height: 180,
|
||||
child: CircularProgressIndicator(
|
||||
value: _progress,
|
||||
strokeWidth: 15,
|
||||
backgroundColor: Colors.white.withValues(alpha: 0.05),
|
||||
valueColor: const AlwaysStoppedAnimation<Color>(AppColors.coral),
|
||||
strokeCap: StrokeCap.round,
|
||||
),
|
||||
),
|
||||
if (_dailyGoal == 0)
|
||||
GestureDetector(
|
||||
onTap: _showGoalDialog,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(15),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.coral.withValues(alpha: 0.1),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
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),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
else
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Text("DISTÂNCIA", style: 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),
|
||||
),
|
||||
Text(
|
||||
"/ ${_dailyGoal.toStringAsFixed(1)} ${AppStrings.kmUnit}",
|
||||
style: const TextStyle(color: Colors.white54, fontSize: 14, fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
_buildSimpleStat("PASSOS", "${(_steps / 1000).toStringAsFixed(1)}k"),
|
||||
const SizedBox(width: 40),
|
||||
_buildSimpleStat("TEMPO", "${_totalTimeMinutes}m"),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMenuButton(
|
||||
IconData icon,
|
||||
String label, {
|
||||
bool showBadge = false,
|
||||
bool isAvatar = false,
|
||||
}) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
_handleMenuTap(label);
|
||||
},
|
||||
Widget _buildSimpleStat(String label, String value) {
|
||||
return Column(
|
||||
children: [
|
||||
Text(value, style: const TextStyle(color: Colors.white, fontWeight: FontWeight.w900, fontSize: 16)),
|
||||
Text(label, style: const TextStyle(color: Colors.white38, fontSize: 9, fontWeight: FontWeight.bold)),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildRecordCard(String title, String value, String unit, IconData icon, Color accentColor) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.backgroundGrey,
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
border: Border.all(color: Colors.white10),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
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),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(color: accentColor.withValues(alpha: 0.1), shape: BoxShape.circle),
|
||||
child: Icon(icon, color: accentColor, size: 18),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(fontSize: 12, color: Colors.white70),
|
||||
const SizedBox(height: 15),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.baseline,
|
||||
textBaseline: TextBaseline.alphabetic,
|
||||
children: [
|
||||
Text(value, style: const TextStyle(color: Colors.white, fontSize: 22, fontWeight: FontWeight.w900)),
|
||||
const SizedBox(width: 4),
|
||||
Text(unit, style: const TextStyle(color: Colors.white38, fontSize: 10, fontWeight: FontWeight.bold)),
|
||||
],
|
||||
),
|
||||
Text(title, style: const TextStyle(color: Colors.white54, fontSize: 9, fontWeight: FontWeight.bold, letterSpacing: 0.5)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSmallActionButton(IconData icon, Color color) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const BluetoothConnectionScreen(),
|
||||
Widget _buildWideRecordCard(String title, String value, String unit, IconData icon, Color accentColor) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.backgroundGrey,
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
border: Border.all(color: Colors.white10),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(color: accentColor.withValues(alpha: 0.1), shape: BoxShape.circle),
|
||||
child: Icon(icon, color: accentColor, size: 24),
|
||||
),
|
||||
);
|
||||
},
|
||||
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),
|
||||
const SizedBox(width: 20),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.baseline,
|
||||
textBaseline: TextBaseline.alphabetic,
|
||||
children: [
|
||||
Text(value, style: const TextStyle(color: Colors.white, fontSize: 24, fontWeight: FontWeight.w900)),
|
||||
const SizedBox(width: 6),
|
||||
Text(unit, style: const TextStyle(color: Colors.white38, fontSize: 12, fontWeight: FontWeight.bold)),
|
||||
],
|
||||
),
|
||||
Text(title, style: const TextStyle(color: Colors.white54, fontSize: 11, fontWeight: FontWeight.bold, letterSpacing: 0.5)),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user