import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../providers/battle_provider.dart'; import 'main_menu_screen.dart'; class SettingsScreen extends StatelessWidget { const SettingsScreen({super.key}); @override Widget build(BuildContext context) { return Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ const Text( 'Settings', style: TextStyle( fontSize: 24, fontWeight: FontWeight.bold, color: Colors.white, ), ), const SizedBox(height: 40), // Placeholder for future settings const Text( 'Effect Intensity: Normal', style: TextStyle(color: Colors.white70), ), const SizedBox(height: 20), const Text( 'Volume: 100%', style: TextStyle(color: Colors.white70), ), const SizedBox(height: 40), // Restart Button ElevatedButton( style: ElevatedButton.styleFrom( backgroundColor: Colors.orange, padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 12), ), onPressed: () { _showConfirmationDialog( context, title: 'Restart Game?', content: 'All progress will be lost. Are you sure?', onConfirm: () { context.read().initializeBattle(); ScaffoldMessenger.of(context).showSnackBar( const SnackBar(content: Text('Game Restarted!')), ); // Optionally switch tab back to Battle (index 0) // But MainWrapper controls the index. // We can't easily switch tab from here without a callback or Provider. // For now, just restart logic is enough. }, ); }, child: const Text('Restart Game'), ), const SizedBox(height: 20), // Return to Main Menu Button ElevatedButton( style: ElevatedButton.styleFrom( backgroundColor: Colors.red, padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 12), ), onPressed: () { _showConfirmationDialog( context, title: 'Return to Main Menu?', content: 'Unsaved progress may be lost. (Progress is saved automatically after each stage)', onConfirm: () { Navigator.of(context).pushAndRemoveUntil( MaterialPageRoute(builder: (context) => const MainMenuScreen()), (route) => false, ); }, ); }, child: const Text('Return to Main Menu'), ), ], ), ); } void _showConfirmationDialog(BuildContext context, {required String title, required String content, required VoidCallback onConfirm}) { showDialog( context: context, builder: (context) => AlertDialog( title: Text(title), content: Text(content), actions: [ TextButton( onPressed: () => Navigator.pop(context), child: const Text('Cancel'), ), TextButton( onPressed: () { Navigator.pop(context); onConfirm(); }, child: const Text('Confirm', style: TextStyle(color: Colors.red)), ), ], ), ); } }