181 lines
7.2 KiB
Dart
181 lines
7.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class FavoritesTab extends StatelessWidget {
|
|
const FavoritesTab({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
// Beispiel-Daten für favorisierte Trainings
|
|
final List<Map<String, dynamic>> favoriteWorkouts = [
|
|
{
|
|
'title': 'Ganzkörper Workout',
|
|
'duration': '45 Minuten',
|
|
'level': 'Fortgeschritten',
|
|
'category': 'Krafttraining',
|
|
'isFavorite': true,
|
|
},
|
|
{
|
|
'title': 'Yoga Flow',
|
|
'duration': '30 Minuten',
|
|
'level': 'Anfänger',
|
|
'category': 'Yoga',
|
|
'isFavorite': true,
|
|
},
|
|
{
|
|
'title': 'HIIT Session',
|
|
'duration': '20 Minuten',
|
|
'level': 'Mittel',
|
|
'category': 'HIIT',
|
|
'isFavorite': true,
|
|
},
|
|
];
|
|
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text('Favoriten'),
|
|
actions: [
|
|
IconButton(
|
|
icon: const Icon(Icons.sort),
|
|
onPressed: () {
|
|
// TODO: Implement sorting functionality
|
|
},
|
|
),
|
|
],
|
|
),
|
|
body:
|
|
favoriteWorkouts.isEmpty
|
|
? const Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Icon(Icons.favorite_border, size: 64, color: Colors.grey),
|
|
SizedBox(height: 16),
|
|
Text(
|
|
'Noch keine Favoriten',
|
|
style: TextStyle(fontSize: 18, color: Colors.grey),
|
|
),
|
|
SizedBox(height: 8),
|
|
Text(
|
|
'Füge Trainings zu deinen Favoriten hinzu',
|
|
style: TextStyle(fontSize: 14, color: Colors.grey),
|
|
),
|
|
],
|
|
),
|
|
)
|
|
: ListView.builder(
|
|
padding: const EdgeInsets.all(16),
|
|
itemCount: favoriteWorkouts.length,
|
|
itemBuilder: (context, index) {
|
|
final workout = favoriteWorkouts[index];
|
|
return Card(
|
|
margin: const EdgeInsets.only(bottom: 16),
|
|
child: InkWell(
|
|
onTap: () {
|
|
// TODO: Navigate to workout details
|
|
},
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16),
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
width: 80,
|
|
height: 80,
|
|
decoration: BoxDecoration(
|
|
color: Colors.grey[200],
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
child: const Icon(
|
|
Icons.fitness_center,
|
|
size: 32,
|
|
color: Colors.grey,
|
|
),
|
|
),
|
|
const SizedBox(width: 16),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
workout['title'],
|
|
style: const TextStyle(
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
const SizedBox(height: 4),
|
|
Text(
|
|
workout['duration'],
|
|
style: TextStyle(color: Colors.grey[600]),
|
|
),
|
|
const SizedBox(height: 4),
|
|
Row(
|
|
children: [
|
|
Container(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: 8,
|
|
vertical: 4,
|
|
),
|
|
decoration: BoxDecoration(
|
|
color: Colors.blue[100],
|
|
borderRadius: BorderRadius.circular(
|
|
12,
|
|
),
|
|
),
|
|
child: Text(
|
|
workout['level'],
|
|
style: TextStyle(
|
|
color: Colors.blue[700],
|
|
fontSize: 12,
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(width: 8),
|
|
Container(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: 8,
|
|
vertical: 4,
|
|
),
|
|
decoration: BoxDecoration(
|
|
color: Colors.green[100],
|
|
borderRadius: BorderRadius.circular(
|
|
12,
|
|
),
|
|
),
|
|
child: Text(
|
|
workout['category'],
|
|
style: TextStyle(
|
|
color: Colors.green[700],
|
|
fontSize: 12,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
IconButton(
|
|
icon: Icon(
|
|
workout['isFavorite']
|
|
? Icons.favorite
|
|
: Icons.favorite_border,
|
|
color:
|
|
workout['isFavorite']
|
|
? Colors.red
|
|
: Colors.grey,
|
|
),
|
|
onPressed: () {
|
|
// TODO: Implement favorite toggle
|
|
},
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|