78 lines
2.8 KiB
Dart
78 lines
2.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:cloud_firestore/cloud_firestore.dart';
|
|
|
|
class TrainingDetailScreen extends StatelessWidget {
|
|
final String trainingId;
|
|
|
|
const TrainingDetailScreen({super.key, required this.trainingId});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text('Training Details'),
|
|
),
|
|
body: FutureBuilder<DocumentSnapshot>(
|
|
future: FirebaseFirestore.instance.collection('Training').doc(trainingId).get(),
|
|
builder: (context, snapshot) {
|
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
|
return const Center(child: CircularProgressIndicator());
|
|
}
|
|
if (!snapshot.hasData || !snapshot.data!.exists) {
|
|
return const Center(child: Text('Training nicht gefunden'));
|
|
}
|
|
final data = snapshot.data!.data() as Map<String, dynamic>;
|
|
return SingleChildScrollView(
|
|
padding: const EdgeInsets.all(16.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Container(
|
|
width: double.infinity,
|
|
height: 200,
|
|
color: Colors.grey[300],
|
|
child: const Center(
|
|
child: Icon(Icons.image, size: 64, color: Colors.grey),
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
Text(
|
|
data['title'] ?? 'Unbekannt',
|
|
style: const TextStyle(
|
|
fontSize: 24,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
data['description'] ?? 'Keine Beschreibung',
|
|
style: TextStyle(color: Colors.grey[600]),
|
|
),
|
|
const SizedBox(height: 16),
|
|
Text(
|
|
'Dauer: ${data['duration'] ?? '-'} Minuten',
|
|
style: TextStyle(color: Colors.grey[600]),
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
'Level: ${data['year'] ?? '-'}',
|
|
style: TextStyle(color: Colors.grey[600]),
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
'Bewertung: ${data['rating overall'] ?? '-'}',
|
|
style: TextStyle(color: Colors.grey[600]),
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
'Kategorie: ${data['category'] ?? '-'}',
|
|
style: TextStyle(color: Colors.grey[600]),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
} |