185 lines
6.2 KiB
Dart
185 lines
6.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class ProfileTab extends StatelessWidget {
|
|
const ProfileTab({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
// Beispiel-Benutzerdaten
|
|
final Map<String, dynamic> userData = {
|
|
'name': 'Max Mustermann',
|
|
'email': 'max.mustermann@example.com',
|
|
'level': 'Fortgeschritten',
|
|
'joinedDate': '01.01.2024',
|
|
'workoutsCompleted': 42,
|
|
'totalMinutes': 1260,
|
|
};
|
|
|
|
return Scaffold(
|
|
body: CustomScrollView(
|
|
slivers: [
|
|
SliverAppBar(
|
|
expandedHeight: 200,
|
|
pinned: true,
|
|
flexibleSpace: FlexibleSpaceBar(
|
|
title: Text(userData['name']),
|
|
background: Container(
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topCenter,
|
|
end: Alignment.bottomCenter,
|
|
colors: [Colors.blue[700]!, Colors.blue[500]!],
|
|
),
|
|
),
|
|
child: const Center(
|
|
child: Icon(Icons.person, size: 80, color: Colors.white),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
SliverToBoxAdapter(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
_buildInfoCard(
|
|
title: 'Statistiken',
|
|
child: Column(
|
|
children: [
|
|
_buildStatisticRow(
|
|
'Trainings absolviert',
|
|
userData['workoutsCompleted'].toString(),
|
|
Icons.fitness_center,
|
|
),
|
|
const Divider(),
|
|
_buildStatisticRow(
|
|
'Gesamtzeit',
|
|
'${userData['totalMinutes']} Minuten',
|
|
Icons.timer,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
_buildInfoCard(
|
|
title: 'Persönliche Informationen',
|
|
child: Column(
|
|
children: [
|
|
_buildInfoRow('E-Mail', userData['email'], Icons.email),
|
|
const Divider(),
|
|
_buildInfoRow('Level', userData['level'], Icons.star),
|
|
const Divider(),
|
|
_buildInfoRow(
|
|
'Mitglied seit',
|
|
userData['joinedDate'],
|
|
Icons.calendar_today,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
_buildInfoCard(
|
|
title: 'Einstellungen',
|
|
child: Column(
|
|
children: [
|
|
ListTile(
|
|
leading: const Icon(Icons.notifications),
|
|
title: const Text('Benachrichtigungen'),
|
|
trailing: Switch(
|
|
value: true,
|
|
onChanged: (value) {
|
|
// TODO: Implement notification settings
|
|
},
|
|
),
|
|
),
|
|
const Divider(),
|
|
ListTile(
|
|
leading: const Icon(Icons.dark_mode),
|
|
title: const Text('Dark Mode'),
|
|
trailing: Switch(
|
|
value: false,
|
|
onChanged: (value) {
|
|
// TODO: Implement dark mode
|
|
},
|
|
),
|
|
),
|
|
const Divider(),
|
|
ListTile(
|
|
leading: const Icon(Icons.language),
|
|
title: const Text('Sprache'),
|
|
trailing: const Text('Deutsch'),
|
|
onTap: () {
|
|
// TODO: Implement language selection
|
|
},
|
|
),
|
|
],
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
Center(
|
|
child: TextButton.icon(
|
|
onPressed: () {
|
|
// TODO: Implement logout
|
|
},
|
|
icon: const Icon(Icons.logout),
|
|
label: const Text('Abmelden'),
|
|
style: TextButton.styleFrom(foregroundColor: Colors.red),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildInfoCard({required String title, required Widget child}) {
|
|
return Card(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.all(16.0),
|
|
child: Text(
|
|
title,
|
|
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
|
),
|
|
),
|
|
child,
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildStatisticRow(String label, String value, IconData icon) {
|
|
return Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12.0),
|
|
child: Row(
|
|
children: [
|
|
Icon(icon, color: Colors.blue),
|
|
const SizedBox(width: 16),
|
|
Expanded(child: Text(label)),
|
|
Text(value, style: const TextStyle(fontWeight: FontWeight.bold)),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildInfoRow(String label, String value, IconData icon) {
|
|
return Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12.0),
|
|
child: Row(
|
|
children: [
|
|
Icon(icon, color: Colors.blue),
|
|
const SizedBox(width: 16),
|
|
Expanded(child: Text(label)),
|
|
Text(value, style: TextStyle(color: Colors.grey[600])),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|