diff --git a/fastlane/metadata/android/en-US/changelogs/15.txt b/fastlane/metadata/android/en-US/changelogs/15.txt new file mode 100644 index 0000000000000000000000000000000000000000..32ed6eeabc096d0bf9648887a8525fd6364bb098 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/15.txt @@ -0,0 +1 @@ +Use ApplicationSettings widgets from flutter_custom_toolbox. diff --git a/fastlane/metadata/android/fr-FR/changelogs/15.txt b/fastlane/metadata/android/fr-FR/changelogs/15.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d5f7c8162c433e10549ee49e010d90c58ffdbc3 --- /dev/null +++ b/fastlane/metadata/android/fr-FR/changelogs/15.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 986bf7ceee679f4bec3fa2e5877df265f4210dca..2e12d5d3910758fbef6a4bf4d9d6c74dd524ffe1 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -9,7 +9,6 @@ import 'package:midisynth/cubit/settings_activity_cubit.dart'; import 'package:midisynth/cubit/nav_cubit_pages.dart'; import 'package:midisynth/cubit/nav_cubit_screens.dart'; import 'package:midisynth/cubit/settings_global_cubit.dart'; -import 'package:midisynth/cubit/theme_cubit.dart'; import 'package:midisynth/ui/skeleton.dart'; void main() async { @@ -44,13 +43,14 @@ 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<ActivityCubit>(create: (context) => ActivityCubit()), BlocProvider<GlobalSettingsCubit>(create: (context) => GlobalSettingsCubit()), BlocProvider<ActivitySettingsCubit>(create: (context) => ActivitySettingsCubit()), ], - child: BlocBuilder<ThemeCubit, ThemeModeState>( - builder: (BuildContext context, ThemeModeState state) { + child: BlocBuilder<ApplicationThemeModeCubit, ApplicationThemeModeState>( + builder: (BuildContext context, ApplicationThemeModeState state) { return MaterialApp( title: 'MIDI Synth', home: const SkeletonScreen(), diff --git a/lib/ui/screens/settings.dart b/lib/ui/screens/settings.dart index a68f23748f7351734169c57699a2ea83e3da4e4f..7981b1c6becc4f5b925c3058b05423750d80f62e 100644 --- a/lib/ui/screens/settings.dart +++ b/lib/ui/screens/settings.dart @@ -1,8 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; -import 'package:midisynth/ui/settings/settings_form.dart'; - class ScreenSettings extends StatelessWidget { const ScreenSettings({super.key}); @@ -18,7 +16,7 @@ class ScreenSettings extends StatelessWidget { SizedBox(height: 8), AppTitle(text: 'settings_title'), SizedBox(height: 8), - SettingsForm(), + ApplicationSettingsForm(), ], ), ); diff --git a/lib/ui/settings/settings_form.dart b/lib/ui/settings/settings_form.dart deleted file mode 100644 index 06c7432fd151e26b1b3761a09ca2ab7482b56510..0000000000000000000000000000000000000000 --- a/lib/ui/settings/settings_form.dart +++ /dev/null @@ -1,62 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; - -import 'package:midisynth/ui/settings/theme_card.dart'; - -class SettingsForm extends StatefulWidget { - const SettingsForm({super.key}); - - @override - State<SettingsForm> createState() => _SettingsFormState(); -} - -class _SettingsFormState extends State<SettingsForm> { - @override - void dispose() { - super.dispose(); - } - - @override - void didChangeDependencies() { - super.didChangeDependencies(); - } - - @override - Widget build(BuildContext context) { - return Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: <Widget>[ - // Light/dark theme - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: <Widget>[ - const Text('settings_label_theme').tr(), - const Row( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - ThemeCard( - mode: ThemeMode.system, - icon: UniconsLine.cog, - ), - ThemeCard( - mode: ThemeMode.light, - icon: UniconsLine.sun, - ), - ThemeCard( - mode: ThemeMode.dark, - icon: UniconsLine.moon, - ) - ], - ), - ], - ), - - const SizedBox(height: 16), - ], - ); - } -} diff --git a/lib/ui/settings/theme_card.dart b/lib/ui/settings/theme_card.dart deleted file mode 100644 index 711da9269bd51ccb07fcde405dc9895e97234212..0000000000000000000000000000000000000000 --- a/lib/ui/settings/theme_card.dart +++ /dev/null @@ -1,47 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; - -import 'package:midisynth/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 add98fbfa6f448021ae70f955575f581ab0753d9..011ee2e27741f0e29cbc4b4aac803190885ffbae 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -122,11 +122,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 e5a5bbee4eb61d4f0759c3bce397e87e1bbf844a..ca48c3799a47cd4f71c0477545ec85e567e5d89d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: MIDI Synth publish_to: "none" -version: 0.2.0+14 +version: 0.2.1+15 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 # (none)