diff --git a/fastlane/metadata/android/en-US/changelogs/65.txt b/fastlane/metadata/android/en-US/changelogs/65.txt new file mode 100644 index 0000000000000000000000000000000000000000..32ed6eeabc096d0bf9648887a8525fd6364bb098 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/65.txt @@ -0,0 +1 @@ +Use ApplicationSettings widgets from flutter_custom_toolbox. diff --git a/fastlane/metadata/android/fr-FR/changelogs/65.txt b/fastlane/metadata/android/fr-FR/changelogs/65.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d5f7c8162c433e10549ee49e010d90c58ffdbc3 --- /dev/null +++ b/fastlane/metadata/android/fr-FR/changelogs/65.txt @@ -0,0 +1 @@ +Utilisation des widgets ApplicationSettings depuis flutter_custom_toolbox. diff --git a/lib/cubit/theme_cubit.dart b/lib/cubit/theme_cubit.dart deleted file mode 100644 index 1ecab6014c67a0393eabbf704b8b85c9e988705e..0000000000000000000000000000000000000000 --- a/lib/cubit/theme_cubit.dart +++ /dev/null @@ -1,30 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; - -part 'theme_state.dart'; - -class ThemeCubit extends HydratedCubit<ThemeModeState> { - ThemeCubit() : super(const ThemeModeState()); - - void getTheme(ThemeModeState state) { - emit(state); - } - - @override - ThemeModeState? fromJson(Map<String, dynamic> json) { - switch (json['themeMode']) { - case 'ThemeMode.dark': - return const ThemeModeState(themeMode: ThemeMode.dark); - case 'ThemeMode.light': - return const ThemeModeState(themeMode: ThemeMode.light); - case 'ThemeMode.system': - default: - return const ThemeModeState(themeMode: ThemeMode.system); - } - } - - @override - Map<String, String>? toJson(ThemeModeState state) { - return <String, String>{'themeMode': state.themeMode.toString()}; - } -} diff --git a/lib/cubit/theme_state.dart b/lib/cubit/theme_state.dart deleted file mode 100644 index e479a50f12fe72a35a1fd1722ff72afbb692a136..0000000000000000000000000000000000000000 --- a/lib/cubit/theme_state.dart +++ /dev/null @@ -1,15 +0,0 @@ -part of 'theme_cubit.dart'; - -@immutable -class ThemeModeState extends Equatable { - const ThemeModeState({ - this.themeMode, - }); - - final ThemeMode? themeMode; - - @override - List<Object?> get props => <Object?>[ - themeMode, - ]; -} diff --git a/lib/main.dart b/lib/main.dart index 4b23560f2e4dc8e9f9b8cd606fa3308e50154a08..3dbb8d6dde3d31a12430ba9aa7d2764fb97fd369 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -17,7 +17,6 @@ import 'package:scrobbles/cubit/data_statistics_recent_cubit.dart'; import 'package:scrobbles/cubit/data_timeline_cubit.dart'; import 'package:scrobbles/cubit/data_top_artists_cubit.dart'; import 'package:scrobbles/cubit/settings_global_cubit.dart'; -import 'package:scrobbles/cubit/theme_cubit.dart'; import 'package:scrobbles/ui/skeleton.dart'; void main() async { @@ -52,7 +51,8 @@ class MyApp extends StatelessWidget { providers: [ BlocProvider<NavCubitPage>(create: (context) => NavCubitPage()), BlocProvider<NavCubitScreen>(create: (context) => NavCubitScreen()), - BlocProvider<ThemeCubit>(create: (context) => ThemeCubit()), + BlocProvider<ApplicationThemeModeCubit>( + create: (context) => ApplicationThemeModeCubit()), BlocProvider<GlobalSettingsCubit>(create: (context) => GlobalSettingsCubit()), BlocProvider<DataCountsByDayCubit>(create: (context) => DataCountsByDayCubit()), BlocProvider<DataCountsByHourCubit>(create: (context) => DataCountsByHourCubit()), @@ -67,8 +67,8 @@ class MyApp extends StatelessWidget { BlocProvider<DataTimelineCubit>(create: (context) => DataTimelineCubit()), BlocProvider<DataTopArtistsCubit>(create: (context) => DataTopArtistsCubit()), ], - child: BlocBuilder<ThemeCubit, ThemeModeState>( - builder: (BuildContext context, ThemeModeState state) { + child: BlocBuilder<ApplicationThemeModeCubit, ApplicationThemeModeState>( + builder: (BuildContext context, ApplicationThemeModeState state) { return MaterialApp( title: 'Scrobbles', home: const SkeletonScreen(), diff --git a/lib/ui/settings/settings_form.dart b/lib/ui/settings/settings_form.dart index 1ef9da0ac55faa5721dccb6347d01e19a5811638..97372a095871a07f26baa2b570c337e5b60152fc 100644 --- a/lib/ui/settings/settings_form.dart +++ b/lib/ui/settings/settings_form.dart @@ -3,7 +3,6 @@ import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; import 'package:scrobbles/config/default_global_settings.dart'; import 'package:scrobbles/cubit/settings_global_cubit.dart'; -import 'package:scrobbles/ui/settings/theme_card.dart'; class SettingsForm extends StatefulWidget { const SettingsForm({super.key}); @@ -110,15 +109,15 @@ class _SettingsFormState extends State<SettingsForm> { mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.center, children: [ - ThemeCard( + ApplicationSettingsThemeModeCard( mode: ThemeMode.system, icon: UniconsLine.cog, ), - ThemeCard( + ApplicationSettingsThemeModeCard( mode: ThemeMode.light, icon: UniconsLine.sun, ), - ThemeCard( + ApplicationSettingsThemeModeCard( mode: ThemeMode.dark, icon: UniconsLine.moon, ) diff --git a/lib/ui/settings/theme_card.dart b/lib/ui/settings/theme_card.dart deleted file mode 100644 index 20d56d4481f2713b2052c5d1e93852954f033954..0000000000000000000000000000000000000000 --- a/lib/ui/settings/theme_card.dart +++ /dev/null @@ -1,45 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; - -import 'package:scrobbles/cubit/theme_cubit.dart'; - -class ThemeCard extends StatelessWidget { - const ThemeCard({ - super.key, - required this.mode, - required this.icon, - }); - - final IconData icon; - final ThemeMode mode; - - @override - Widget build(BuildContext context) { - return BlocBuilder<ThemeCubit, ThemeModeState>( - builder: (BuildContext context, ThemeModeState state) { - return Card( - elevation: 2, - shadowColor: Theme.of(context).colorScheme.shadow, - color: state.themeMode == mode - ? Theme.of(context).colorScheme.primary - : Theme.of(context).colorScheme.surface, - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(12)), - ), - margin: const EdgeInsets.all(5), - child: InkWell( - onTap: () => BlocProvider.of<ThemeCubit>(context).getTheme( - ThemeModeState(themeMode: mode), - ), - borderRadius: const BorderRadius.all(Radius.circular(12)), - child: Icon( - icon, - size: 32, - color: - state.themeMode != mode ? Theme.of(context).colorScheme.primary : Colors.white, - ), - ), - ); - }); - } -} diff --git a/pubspec.lock b/pubspec.lock index d78deabe4bdf57e3d5d957d9d5ea456cb5859f93..abad950f9c2c4719e55bdf3aa796d3e77fa1b54c 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -130,11 +130,11 @@ packages: dependency: "direct main" description: path: "." - ref: "0.1.1" - resolved-ref: ba7137ca9edec7e503ed3dbfe7f6ede7e9cfbf4d + ref: "0.2.0" + resolved-ref: bbf0abd5457d42678882384216af9e83c38549bc url: "https://git.harrault.fr/android/flutter-toolbox.git" source: git - version: "0.1.1" + version: "0.2.0" flutter_lints: dependency: "direct dev" description: diff --git a/pubspec.yaml b/pubspec.yaml index 7122faeb188357e222f6b80bd7bc6a54a3b85af7..715fc230a2eca45710f208b1b393c8538e6de98c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: Display scrobbles data and charts publish_to: "none" -version: 0.3.0+64 +version: 0.3.1+65 environment: sdk: "^3.0.0" @@ -16,7 +16,7 @@ dependencies: flutter_custom_toolbox: git: url: https://git.harrault.fr/android/flutter-toolbox.git - ref: 0.1.1 + ref: 0.2.0 # specific fl_chart: ^0.69.0