Translate App into German
This commit is contained in:
@@ -23,9 +23,13 @@ class _CreateTeamPageState extends State<CreateTeamPage> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_nameController = TextEditingController(text: widget.teamToEdit?.name ?? '');
|
||||
_nameController = TextEditingController(
|
||||
text: widget.teamToEdit?.name ?? '',
|
||||
);
|
||||
_tagController = TextEditingController(text: widget.teamToEdit?.tag ?? '');
|
||||
_descriptionController = TextEditingController(text: widget.teamToEdit?.description ?? '');
|
||||
_descriptionController = TextEditingController(
|
||||
text: widget.teamToEdit?.description ?? '',
|
||||
);
|
||||
}
|
||||
|
||||
void _submitForm() async {
|
||||
@@ -42,9 +46,9 @@ class _CreateTeamPageState extends State<CreateTeamPage> {
|
||||
tag: _tagController.text,
|
||||
description: _descriptionController.text,
|
||||
);
|
||||
if (!context.mounted) return;
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Team updated successfully')),
|
||||
const SnackBar(content: Text('Team erfolgreich aktualisiert')),
|
||||
);
|
||||
} else {
|
||||
await provider.createTeam(
|
||||
@@ -52,20 +56,24 @@ class _CreateTeamPageState extends State<CreateTeamPage> {
|
||||
tag: _tagController.text,
|
||||
description: _descriptionController.text,
|
||||
);
|
||||
if (!context.mounted) return;
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Team created successfully')),
|
||||
const SnackBar(content: Text('Team erfolgreich erstellt')),
|
||||
);
|
||||
}
|
||||
if (!context.mounted) return;
|
||||
if (!mounted) return;
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
if (!context.mounted) return;
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Error: $e')),
|
||||
SnackBar(
|
||||
content: Text(
|
||||
'Fehler: ${e.toString().replaceFirst('Exception: ', '')}',
|
||||
),
|
||||
),
|
||||
);
|
||||
} finally {
|
||||
if (context.mounted) setState(() => _isLoading = false);
|
||||
if (mounted) setState(() => _isLoading = false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +90,7 @@ class _CreateTeamPageState extends State<CreateTeamPage> {
|
||||
final isEditing = widget.teamToEdit != null;
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(isEditing ? 'Edit Team' : 'Create Team'),
|
||||
title: Text(isEditing ? 'Team bearbeiten' : 'Team erstellen'),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
@@ -94,12 +102,12 @@ class _CreateTeamPageState extends State<CreateTeamPage> {
|
||||
TextFormField(
|
||||
controller: _nameController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Team Name',
|
||||
hintText: 'Enter team name',
|
||||
labelText: 'Teamname',
|
||||
hintText: 'Teamname eingeben',
|
||||
),
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Team name is required';
|
||||
return 'Der Teamname ist erforderlich';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -108,17 +116,17 @@ class _CreateTeamPageState extends State<CreateTeamPage> {
|
||||
TextFormField(
|
||||
controller: _tagController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Team Tag',
|
||||
hintText: 'Enter team tag (max 3 characters)',
|
||||
labelText: 'Teamkürzel',
|
||||
hintText: 'Teamkürzel eingeben (max. 3 Zeichen)',
|
||||
),
|
||||
maxLength: 3,
|
||||
textCapitalization: TextCapitalization.characters,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Team tag is required';
|
||||
return 'Das Teamkürzel ist erforderlich';
|
||||
}
|
||||
if (value.length > 3) {
|
||||
return 'Tag must be at most 3 characters';
|
||||
return 'Das Kürzel darf höchstens 3 Zeichen lang sein';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -127,8 +135,8 @@ class _CreateTeamPageState extends State<CreateTeamPage> {
|
||||
TextFormField(
|
||||
controller: _descriptionController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Description',
|
||||
hintText: 'Enter team description (optional)',
|
||||
labelText: 'Beschreibung',
|
||||
hintText: 'Teambeschreibung eingeben (optional)',
|
||||
),
|
||||
maxLines: 3,
|
||||
),
|
||||
@@ -137,7 +145,7 @@ class _CreateTeamPageState extends State<CreateTeamPage> {
|
||||
onPressed: _isLoading ? null : _submitForm,
|
||||
child: _isLoading
|
||||
? const CircularProgressIndicator()
|
||||
: Text(isEditing ? 'Update Team' : 'Create Team'),
|
||||
: Text(isEditing ? 'Team aktualisieren' : 'Team erstellen'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -22,12 +22,13 @@ class _CreateTournamentPageState extends State<CreateTournamentPage> {
|
||||
|
||||
bool _isLoading = false;
|
||||
|
||||
final DateFormat _dateFormat = DateFormat('yyyy-MM-dd');
|
||||
final DateFormat _dateFormat = DateFormat('dd.MM.yyyy', 'de_DE');
|
||||
|
||||
Future<void> _selectDate(BuildContext context, bool isStart) async {
|
||||
final initialDate = DateTime.now();
|
||||
final picked = await showDatePicker(
|
||||
context: context,
|
||||
locale: const Locale('de', 'DE'),
|
||||
initialDate: initialDate,
|
||||
firstDate: initialDate,
|
||||
lastDate: DateTime(2101),
|
||||
@@ -47,14 +48,20 @@ class _CreateTournamentPageState extends State<CreateTournamentPage> {
|
||||
if (!_formKey.currentState!.validate()) return;
|
||||
if (_startDate == null || _endDate == null) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Please select both start and end dates.')),
|
||||
const SnackBar(
|
||||
content: Text(
|
||||
'Bitte wähle sowohl ein Start- als auch ein Enddatum aus.',
|
||||
),
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_endDate!.isBefore(_startDate!)) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('End date cannot be before start date.')),
|
||||
const SnackBar(
|
||||
content: Text('Das Enddatum darf nicht vor dem Startdatum liegen.'),
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -70,15 +77,19 @@ class _CreateTournamentPageState extends State<CreateTournamentPage> {
|
||||
_startDate!,
|
||||
_endDate!,
|
||||
);
|
||||
if (!context.mounted) return;
|
||||
if (!mounted) return;
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
if (!context.mounted) return;
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text('Error: $e')));
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
'Fehler: ${e.toString().replaceFirst('Exception: ', '')}',
|
||||
),
|
||||
),
|
||||
);
|
||||
} finally {
|
||||
if (context.mounted) setState(() => _isLoading = false);
|
||||
if (mounted) setState(() => _isLoading = false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +103,7 @@ class _CreateTournamentPageState extends State<CreateTournamentPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Create Tournament')),
|
||||
appBar: AppBar(title: const Text('Turnier erstellen')),
|
||||
body: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Form(
|
||||
@@ -104,20 +115,20 @@ class _CreateTournamentPageState extends State<CreateTournamentPage> {
|
||||
controller: _nameController,
|
||||
decoration: const InputDecoration(labelText: 'Name'),
|
||||
validator: (value) =>
|
||||
value == null || value.isEmpty ? 'Required' : null,
|
||||
value == null || value.isEmpty ? 'Pflichtfeld' : null,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
TextFormField(
|
||||
controller: _descriptionController,
|
||||
decoration: const InputDecoration(labelText: 'Description'),
|
||||
decoration: const InputDecoration(labelText: 'Beschreibung'),
|
||||
maxLines: 3,
|
||||
validator: (value) =>
|
||||
value == null || value.isEmpty ? 'Required' : null,
|
||||
value == null || value.isEmpty ? 'Pflichtfeld' : null,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
DropdownButtonFormField<int>(
|
||||
initialValue: _maxTeamAmount,
|
||||
decoration: const InputDecoration(labelText: 'Max Teams'),
|
||||
decoration: const InputDecoration(labelText: 'Maximale Teams'),
|
||||
items: [2, 4, 8].map((int value) {
|
||||
return DropdownMenuItem<int>(
|
||||
value: value,
|
||||
@@ -140,7 +151,7 @@ class _CreateTournamentPageState extends State<CreateTournamentPage> {
|
||||
onPressed: () => _selectDate(context, true),
|
||||
child: Text(
|
||||
_startDate == null
|
||||
? 'Select Start Date'
|
||||
? 'Startdatum wählen'
|
||||
: 'Start: ${_dateFormat.format(_startDate!)}',
|
||||
),
|
||||
),
|
||||
@@ -151,8 +162,8 @@ class _CreateTournamentPageState extends State<CreateTournamentPage> {
|
||||
onPressed: () => _selectDate(context, false),
|
||||
child: Text(
|
||||
_endDate == null
|
||||
? 'Select End Date'
|
||||
: 'End: ${_dateFormat.format(_endDate!)}',
|
||||
? 'Enddatum wählen'
|
||||
: 'Ende: ${_dateFormat.format(_endDate!)}',
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -163,7 +174,7 @@ class _CreateTournamentPageState extends State<CreateTournamentPage> {
|
||||
onPressed: _isLoading ? null : _submitForm,
|
||||
child: _isLoading
|
||||
? const CircularProgressIndicator()
|
||||
: const Text('Create Tournament'),
|
||||
: const Text('Turnier erstellen'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -42,7 +42,7 @@ class _HomePageState extends State<HomePage>
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(_selectedIndex == 0 ? "Tournaments" : "Teams"),
|
||||
title: Text(_selectedIndex == 0 ? 'Turniere' : 'Teams'),
|
||||
bottom: _selectedIndex == 1
|
||||
? TabBar(
|
||||
controller: _tabController,
|
||||
@@ -54,8 +54,8 @@ class _HomePageState extends State<HomePage>
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
tabs: const [
|
||||
Tab(text: 'All Teams'),
|
||||
Tab(text: 'My Teams'),
|
||||
Tab(text: 'Alle Teams'),
|
||||
Tab(text: 'Meine Teams'),
|
||||
],
|
||||
)
|
||||
: null,
|
||||
@@ -81,7 +81,7 @@ class _HomePageState extends State<HomePage>
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
'Failed to refresh ${_selectedIndex == 0 ? "tournaments" : "teams"}',
|
||||
'Aktualisierung der ${_selectedIndex == 0 ? "Turniere" : "Teams"} fehlgeschlagen',
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -95,7 +95,9 @@ class _HomePageState extends State<HomePage>
|
||||
},
|
||||
offset: const Offset(0, 48),
|
||||
itemBuilder: (context) {
|
||||
return [const PopupMenuItem(value: 1, child: Text("Settings"))];
|
||||
return [
|
||||
const PopupMenuItem(value: 1, child: Text('Einstellungen')),
|
||||
];
|
||||
},
|
||||
),
|
||||
],
|
||||
@@ -127,7 +129,7 @@ class _HomePageState extends State<HomePage>
|
||||
items: const [
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.emoji_events),
|
||||
label: 'Tournaments',
|
||||
label: 'Turniere',
|
||||
),
|
||||
BottomNavigationBarItem(icon: Icon(Icons.groups), label: 'Teams'),
|
||||
],
|
||||
|
||||
@@ -66,13 +66,13 @@ class _LoginPageState extends State<LoginPage> {
|
||||
TextFormField(
|
||||
controller: _usernameController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Username',
|
||||
labelText: 'Benutzername',
|
||||
prefixIcon: Icon(Icons.person),
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value == null || value.trim().isEmpty) {
|
||||
return 'Please enter a username';
|
||||
return 'Bitte gib einen Benutzernamen ein';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -82,16 +82,16 @@ class _LoginPageState extends State<LoginPage> {
|
||||
controller: _passwordController,
|
||||
obscureText: true,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Password',
|
||||
labelText: 'Passwort',
|
||||
prefixIcon: Icon(Icons.lock),
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value == null || value.trim().isEmpty) {
|
||||
return 'Please enter a password';
|
||||
return 'Bitte gib ein Passwort ein';
|
||||
}
|
||||
if (_isRegistering && value.trim().length < 4) {
|
||||
return 'Password must be at least 6 characters';
|
||||
return 'Das Passwort muss mindestens 4 Zeichen lang sein';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -124,9 +124,13 @@ class _LoginPageState extends State<LoginPage> {
|
||||
? const SizedBox(
|
||||
height: 20,
|
||||
width: 20,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
),
|
||||
)
|
||||
: Text(_isRegistering ? 'Register' : 'Login'),
|
||||
: Text(
|
||||
_isRegistering ? 'Registrieren' : 'Anmelden',
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
@@ -141,8 +145,8 @@ class _LoginPageState extends State<LoginPage> {
|
||||
},
|
||||
child: Text(
|
||||
_isRegistering
|
||||
? 'Already have an account? Login'
|
||||
: 'Don\'t have an account? Register',
|
||||
? 'Bereits ein Konto? Anmelden'
|
||||
: 'Noch kein Konto? Registrieren',
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -154,4 +158,3 @@ class _LoginPageState extends State<LoginPage> {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,11 +17,11 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: Text("Splatournament")),
|
||||
appBar: AppBar(title: const Text('Einstellungen')),
|
||||
body: Column(
|
||||
children: [
|
||||
SizedBox(height: 24),
|
||||
ProfileWidget(),
|
||||
const SizedBox(height: 24),
|
||||
const ProfileWidget(),
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
@@ -29,7 +29,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
ListTile(
|
||||
leading: const Icon(Icons.logout, color: Colors.red),
|
||||
title: const Text(
|
||||
'Sign Out',
|
||||
'Abmelden',
|
||||
style: TextStyle(color: Colors.red),
|
||||
),
|
||||
onTap: () {
|
||||
|
||||
@@ -35,13 +35,19 @@ class _TournamentBracketPageState extends State<TournamentBracketPage> {
|
||||
if (mounted) {
|
||||
setState(() {});
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Bracket initialized successfully')),
|
||||
const SnackBar(
|
||||
content: Text('Turnierbaum erfolgreich initialisiert'),
|
||||
),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Failed to initialize bracket: $e')),
|
||||
SnackBar(
|
||||
content: Text(
|
||||
'Initialisierung des Turnierbaums fehlgeschlagen: ${e.toString().replaceFirst('Exception: ', '')}',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -51,7 +57,7 @@ class _TournamentBracketPageState extends State<TournamentBracketPage> {
|
||||
final result = await showDialog<int>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('Select Winner'),
|
||||
title: const Text('Sieger auswählen'),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
@@ -69,11 +75,11 @@ class _TournamentBracketPageState extends State<TournamentBracketPage> {
|
||||
if (match.hasWinner)
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, -1), // Reset signal
|
||||
child: const Text('Reset'),
|
||||
child: const Text('Zurücksetzen'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: const Text('Cancel'),
|
||||
child: const Text('Abbrechen'),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -91,14 +97,22 @@ class _TournamentBracketPageState extends State<TournamentBracketPage> {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(result == -1 ? 'Match reset' : 'Winner set successfully'),
|
||||
content: Text(
|
||||
result == -1
|
||||
? 'Match zurückgesetzt'
|
||||
: 'Sieger erfolgreich festgelegt',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Error: $e')),
|
||||
SnackBar(
|
||||
content: Text(
|
||||
'Fehler: ${e.toString().replaceFirst('Exception: ', '')}',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -122,7 +136,11 @@ class _TournamentBracketPageState extends State<TournamentBracketPage> {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
if (snapshot.hasError) {
|
||||
return Center(child: Text('Error: ${snapshot.error}'));
|
||||
return Center(
|
||||
child: Text(
|
||||
'Fehler: ${snapshot.error.toString().replaceFirst('Exception: ', '')}',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
final teams = snapshot.data![0] as List<Team>;
|
||||
@@ -135,19 +153,19 @@ class _TournamentBracketPageState extends State<TournamentBracketPage> {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Text(
|
||||
'Bracket not initialized yet',
|
||||
'Der Turnierbaum wurde noch nicht initialisiert',
|
||||
style: TextStyle(fontSize: 18),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton(
|
||||
onPressed: teams.length >= 2 ? _initializeBracket : null,
|
||||
child: const Text('Initialize Bracket'),
|
||||
child: const Text('Turnierbaum initialisieren'),
|
||||
),
|
||||
if (teams.length < 2)
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(top: 8),
|
||||
child: Text(
|
||||
'Need at least 2 teams',
|
||||
'Mindestens 2 Teams erforderlich',
|
||||
style: TextStyle(color: Colors.red),
|
||||
),
|
||||
),
|
||||
@@ -208,11 +226,11 @@ class _BracketBoard extends StatelessWidget {
|
||||
});
|
||||
|
||||
String _roundLabel(int round) {
|
||||
if (round == roundCount - 1) return 'Winner';
|
||||
if (round == roundCount - 1) return 'Sieger';
|
||||
final teamsInRound = bracketSize ~/ (1 << round);
|
||||
if (teamsInRound == 2) return 'Final';
|
||||
if (teamsInRound == 4) return 'Semi-finals';
|
||||
return 'Quarter-finals';
|
||||
if (teamsInRound == 2) return 'Finale';
|
||||
if (teamsInRound == 4) return 'Halbfinale';
|
||||
return 'Viertelfinale';
|
||||
}
|
||||
|
||||
double _cardTop(int round, int index) {
|
||||
@@ -273,7 +291,7 @@ class _BracketBoard extends StatelessWidget {
|
||||
// Match cards
|
||||
for (int i = 0; i < cardsInRound; i++) {
|
||||
final match = _findMatch(round, i);
|
||||
|
||||
|
||||
children.add(
|
||||
Positioned(
|
||||
left: left,
|
||||
@@ -292,14 +310,14 @@ class _BracketBoard extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
: match != null && match.hasWinner
|
||||
? () {
|
||||
final team1 = teamMap[match.team1Id];
|
||||
final team2 = teamMap[match.team2Id];
|
||||
if (team1 != null && team2 != null) {
|
||||
onMatchTap(match, team1, team2);
|
||||
}
|
||||
}
|
||||
: null,
|
||||
? () {
|
||||
final team1 = teamMap[match.team1Id];
|
||||
final team2 = teamMap[match.team2Id];
|
||||
if (team1 != null && team2 != null) {
|
||||
onMatchTap(match, team1, team2);
|
||||
}
|
||||
}
|
||||
: null,
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -376,11 +394,7 @@ class _MatchCard extends StatelessWidget {
|
||||
final Map<int, Team> teamMap;
|
||||
final VoidCallback? onTap;
|
||||
|
||||
const _MatchCard({
|
||||
this.match,
|
||||
required this.teamMap,
|
||||
this.onTap,
|
||||
});
|
||||
const _MatchCard({this.match, required this.teamMap, this.onTap});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -430,7 +444,7 @@ class _MatchCard extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'vs',
|
||||
'vs.',
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
color: colorScheme.onSurface.withValues(alpha: 0.6),
|
||||
|
||||
@@ -3,8 +3,15 @@ import 'package:frontend_splatournament_manager/models/team.dart';
|
||||
import 'package:frontend_splatournament_manager/models/tournament.dart';
|
||||
import 'package:frontend_splatournament_manager/pages/tournament_bracket_page.dart';
|
||||
import 'package:frontend_splatournament_manager/providers/team_provider.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
final DateFormat _tournamentDateFormat = DateFormat('dd.MM.yyyy', 'de_DE');
|
||||
|
||||
String _formatTournamentDate(String value) {
|
||||
return _tournamentDateFormat.format(DateTime.parse(value));
|
||||
}
|
||||
|
||||
class TournamentDetailPage extends StatefulWidget {
|
||||
final Tournament tournament;
|
||||
|
||||
@@ -29,7 +36,7 @@ class _TournamentDetailPageState extends State<TournamentDetailPage> {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text(
|
||||
'You are not a member of any team. Join or create a team first!',
|
||||
'Du bist in keinem Team. Tritt zuerst einem Team bei oder erstelle eines.',
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -40,7 +47,7 @@ class _TournamentDetailPageState extends State<TournamentDetailPage> {
|
||||
context: context,
|
||||
builder: (BuildContext dialogContext) {
|
||||
return AlertDialog(
|
||||
title: const Text('Select Your Team'),
|
||||
title: const Text('Team auswählen'),
|
||||
content: SizedBox(
|
||||
width: double.maxFinite,
|
||||
child: ListView.builder(
|
||||
@@ -62,7 +69,7 @@ class _TournamentDetailPageState extends State<TournamentDetailPage> {
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(dialogContext),
|
||||
child: const Text('Cancel'),
|
||||
child: const Text('Abbrechen'),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -80,7 +87,9 @@ class _TournamentDetailPageState extends State<TournamentDetailPage> {
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('${selectedTeam.name} joined the tournament!'),
|
||||
content: Text(
|
||||
'${selectedTeam.name} wurde für das Turnier angemeldet.',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -93,7 +102,7 @@ class _TournamentDetailPageState extends State<TournamentDetailPage> {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
'Failed to join: ${e.toString().replaceAll('Exception: ', '')}',
|
||||
'Anmeldung fehlgeschlagen: ${e.toString().replaceAll('Exception: ', '')}',
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -101,9 +110,13 @@ class _TournamentDetailPageState extends State<TournamentDetailPage> {
|
||||
}
|
||||
} catch (e) {
|
||||
if (!context.mounted) return;
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text('Failed to load your teams: $e')));
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
'Deine Teams konnten nicht geladen werden: ${e.toString().replaceFirst('Exception: ', '')}',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,10 +174,10 @@ class _TournamentDetailPageState extends State<TournamentDetailPage> {
|
||||
: null,
|
||||
child: Text(
|
||||
widget.tournament.isRegistrationFuture
|
||||
? "Registration not open yet"
|
||||
? 'Anmeldung noch nicht geöffnet'
|
||||
: widget.tournament.isRegistrationPast
|
||||
? "Registration closed"
|
||||
: "Join with Team",
|
||||
? 'Anmeldung geschlossen'
|
||||
: 'Mit Team anmelden',
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -205,7 +218,7 @@ class _TournamentTeamsWidgetState extends State<TournamentTeamsWidget> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 12, 16, 4),
|
||||
child: Text(
|
||||
'Registered Teams',
|
||||
'Angemeldete Teams',
|
||||
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 17),
|
||||
),
|
||||
),
|
||||
@@ -217,11 +230,17 @@ class _TournamentTeamsWidgetState extends State<TournamentTeamsWidget> {
|
||||
return Center(child: CircularProgressIndicator());
|
||||
}
|
||||
if (snapshot.hasError) {
|
||||
return Center(child: Text('Error: ${snapshot.error}'));
|
||||
return Center(
|
||||
child: Text(
|
||||
'Fehler: ${snapshot.error.toString().replaceFirst('Exception: ', '')}',
|
||||
),
|
||||
);
|
||||
}
|
||||
final teams = snapshot.data ?? [];
|
||||
if (teams.isEmpty) {
|
||||
return Center(child: Text('No teams registered yet.'));
|
||||
return const Center(
|
||||
child: Text('Noch keine Teams angemeldet.'),
|
||||
);
|
||||
}
|
||||
return ListView.builder(
|
||||
itemCount: teams.length,
|
||||
@@ -257,7 +276,9 @@ class _TournamentTeamsWidgetState extends State<TournamentTeamsWidget> {
|
||||
if (!context.mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Failed to remove team: $e'),
|
||||
content: Text(
|
||||
'Team konnte nicht entfernt werden: ${e.toString().replaceFirst('Exception: ', '')}',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -282,6 +303,9 @@ class TournamentContentWidget extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final registrationPeriod =
|
||||
'${_formatTournamentDate(tournament.registrationStartDate)} - ${_formatTournamentDate(tournament.registrationEndDate)}';
|
||||
|
||||
return Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -300,24 +324,22 @@ class TournamentContentWidget extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Registration Period",
|
||||
'Anmeldezeitraum',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 17,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"${tournament.registrationStartDate} - ${tournament.registrationEndDate}",
|
||||
),
|
||||
Text(registrationPeriod),
|
||||
SizedBox(height: 24),
|
||||
Text(
|
||||
"Format",
|
||||
'Format',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 17,
|
||||
),
|
||||
),
|
||||
Text("Single Elimination"),
|
||||
const Text('Einfaches K.-o.-System'),
|
||||
Spacer(),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
@@ -331,7 +353,7 @@ class TournamentContentWidget extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Text("View ongoing"),
|
||||
child: const Text('Turnierbaum ansehen'),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -382,7 +404,7 @@ class DetailHeader extends StatelessWidget {
|
||||
InputChip(
|
||||
onPressed: () => onTeamsChipClicked(),
|
||||
label: Text(
|
||||
"${tournament.currentTeamAmount} out of ${tournament.maxTeamAmount} Teams",
|
||||
'${tournament.currentTeamAmount} von ${tournament.maxTeamAmount} Teams',
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user