import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import '../provider/shuffle_settings_provider.dart'; class ShuffleSettingsScreen extends ConsumerWidget { const ShuffleSettingsScreen({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { final settings = ref.watch(shuffleSettingsProvider); return Scaffold( appBar: AppBar( title: const Text('Shuffle-Einstellungen'), centerTitle: true, ), body: ListView( padding: const EdgeInsets.all(16), children: [ const Text( 'Shuffle-Modus', style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), ), const SizedBox(height: 8), RadioListTile( title: const Text('Random'), subtitle: const Text('Einfach zufällig mischen'), value: ShuffleMode.random, groupValue: settings.mode, onChanged: (val) => ref.read(shuffleSettingsProvider.notifier).update(mode: val), ), RadioListTile( title: const Text('Ausgewogen'), subtitle: const Text('Gute Balance von Geschlecht und Level'), value: ShuffleMode.balanced, groupValue: settings.mode, onChanged: (val) => ref.read(shuffleSettingsProvider.notifier).update(mode: val), ), RadioListTile( title: const Text('Aggressiv ausgewogen'), subtitle: const Text('Strenge Regeln – perfekte Teams oder gar nicht'), value: ShuffleMode.aggressive, groupValue: settings.mode, onChanged: (val) => ref.read(shuffleSettingsProvider.notifier).update(mode: val), ), RadioListTile( title: const Text('Positionsbasiert'), subtitle: const Text('Versucht ideale Aufstellung: 1 Zuspieler, 2 Außen, etc.'), value: ShuffleMode.positionBased, groupValue: settings.mode, onChanged: (val) => ref.read(shuffleSettingsProvider.notifier).update(mode: val), ), const Divider(height: 40), const Text( 'Zusätzliche Optionen', style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), ), const SizedBox(height: 8), SwitchListTile( title: const Text('Geschlechterbalance priorisieren'), subtitle: const Text('Versucht 3M/3F pro Team'), value: settings.prioritizeGenderBalance, onChanged: (val) => ref.read(shuffleSettingsProvider.notifier).update(prioritizeGenderBalance: val), ), SwitchListTile( title: const Text('Level-Balance priorisieren'), subtitle: const Text('Ähnliche Spielstärke pro Team'), value: settings.prioritizeLevelBalance, onChanged: (val) => ref.read(shuffleSettingsProvider.notifier).update(prioritizeLevelBalance: val), ), SwitchListTile( title: const Text('Positionsbesetzung beachten'), subtitle: const Text('Ideale Aufstellung pro Team versuchen'), value: settings.usePositions, onChanged: (val) => ref.read(shuffleSettingsProvider.notifier).update(usePositions: val), ), ], ), ); } }