95 lines
3.3 KiB
Dart
95 lines
3.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:schleifchenturnier/features/tournament/presentation/screens/shuffle_settings_screen.dart';
|
|
import '../provider/player_provider.dart';
|
|
|
|
class SettingsScreen extends ConsumerWidget {
|
|
const SettingsScreen({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text('Einstellungen'),
|
|
centerTitle: true,
|
|
),
|
|
body: Padding(
|
|
padding: const EdgeInsets.all(16.0),
|
|
child: Column(
|
|
children: [
|
|
const SizedBox(height: 40),
|
|
|
|
// Zurücksetzen der Siege
|
|
Card(
|
|
child: ListTile(
|
|
leading: const Icon(Icons.restore, color: Colors.orange, size: 32),
|
|
title: const Text(
|
|
'Alle Siege zurücksetzen',
|
|
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
|
),
|
|
subtitle: const Text('Setzt die Schleifchen-Anzahl aller Spieler auf 0'),
|
|
trailing: const Icon(Icons.arrow_forward_ios),
|
|
onTap: () {
|
|
_showResetConfirmationDialog(context, ref);
|
|
},
|
|
),
|
|
),
|
|
Card(
|
|
child: ListTile(
|
|
leading: const Icon(Icons.shuffle, color: Colors.deepPurple, size: 32),
|
|
title: const Text('Shuffle-Einstellungen', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
|
subtitle: const Text('Modus und Balance-Optionen konfigurieren'),
|
|
trailing: const Icon(Icons.arrow_forward_ios),
|
|
onTap: () {
|
|
Navigator.of(context).push(MaterialPageRoute(builder: (_) => const ShuffleSettingsScreen()));
|
|
},
|
|
),
|
|
),
|
|
|
|
const Spacer(),
|
|
|
|
// Version oder Footer
|
|
const Text(
|
|
'Schleifchenturnier v1.0\nMade with ❤️ für die beste Volleyball-Crew',
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(color: Colors.grey, fontSize: 14),
|
|
),
|
|
const SizedBox(height: 20),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
void _showResetConfirmationDialog(BuildContext context, WidgetRef ref) {
|
|
showDialog(
|
|
context: context,
|
|
builder: (ctx) => AlertDialog(
|
|
title: const Text('Wirklich alle Siege zurücksetzen?'),
|
|
content: const Text(
|
|
'Dadurch werden alle Schleifchen (Siege) aller Spieler auf 0 gesetzt.\n\nDas kann nicht rückgängig gemacht werden!',
|
|
),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx),
|
|
child: const Text('Abbrechen'),
|
|
),
|
|
ElevatedButton(
|
|
style: ElevatedButton.styleFrom(backgroundColor: Colors.red),
|
|
onPressed: () {
|
|
ref.read(playerListProvider.notifier).resetAllWins();
|
|
Navigator.pop(ctx);
|
|
ScaffoldMessenger.of(context).showSnackBar(
|
|
const SnackBar(
|
|
content: Text('Alle Siege wurden zurückgesetzt!'),
|
|
backgroundColor: Colors.orange,
|
|
),
|
|
);
|
|
},
|
|
child: const Text('Zurücksetzen'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
} |