import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../../theme/theme_provider.dart'; import '../../theme/app_theme.dart'; class HomeScreen extends StatelessWidget { const HomeScreen({super.key}); String _getThemeName(ThemeType type) { switch (type) { case ThemeType.defaultTheme: return "P'titsPas"; case ThemeType.pastelTheme: return "Pastel"; case ThemeType.darkTheme: return "Sombre"; } } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Accueil'), actions: [ Consumer( builder: (context, themeProvider, child) { return Padding( padding: const EdgeInsets.symmetric(horizontal: 16.0), child: DropdownButton( value: themeProvider.currentTheme, items: ThemeType.values.map((ThemeType type) { return DropdownMenuItem( value: type, child: Text(_getThemeName(type)), ); }).toList(), onChanged: (ThemeType? newValue) { if (newValue != null) { themeProvider.setTheme(newValue); } }, ), ); }, ), ], ), body: const Center( child: Text('Bienvenue sur P\'titsPas !'), ), ); } }