diff --git a/fastlane/metadata/android/en-US/changelogs/13.txt b/fastlane/metadata/android/en-US/changelogs/13.txt new file mode 100644 index 0000000000000000000000000000000000000000..32ed6eeabc096d0bf9648887a8525fd6364bb098 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/13.txt @@ -0,0 +1 @@ +Use ApplicationSettings widgets from flutter_custom_toolbox. diff --git a/fastlane/metadata/android/fr-FR/changelogs/13.txt b/fastlane/metadata/android/fr-FR/changelogs/13.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d5f7c8162c433e10549ee49e010d90c58ffdbc3 --- /dev/null +++ b/fastlane/metadata/android/fr-FR/changelogs/13.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 9fc0cd34c4392a5379546eb6bd6b9929cc915fc8..65fa661ae5ebcd8c5410791efd8d0dffcd2da599 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -9,7 +9,6 @@ import 'package:stopmotion/cubit/nav_cubit_pages.dart'; import 'package:stopmotion/cubit/nav_cubit_screens.dart'; import 'package:stopmotion/cubit/settings_global_cubit.dart'; import 'package:stopmotion/cubit/settings_activity_cubit.dart'; -import 'package:stopmotion/cubit/theme_cubit.dart'; import 'package:stopmotion/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: 'Stop Motion', home: const SkeletonScreen(), diff --git a/lib/ui/screens/settings.dart b/lib/ui/screens/settings.dart index 9a40e2651ffec997c80a19883382c41aa16fc979..19ab068c447eadddb87b90c14a50c007799a0344 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:stopmotion/ui/settings/settings_form.dart'; class ScreenSettings extends StatelessWidget { const ScreenSettings({super.key}); @@ -19,7 +17,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 72ad95de89da95dfe46cf343b8994737e25a1b13..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:stopmotion/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 e448c10c6b111888874f3522fe01544f02e8a57f..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:stopmotion/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 fb693120baa3beb5c9a5fd50e3c38bd251000119..4285c0c588b1f2300411e858fee26392785fbc07 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -170,11 +170,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 3ab06a72d8899b4c076b38c60c092eee9b0c3945..07b129f3ceaa1d57420dbbf09d3ba23be4872b95 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: stop motion assistant publish_to: "none" -version: 0.2.0+12 +version: 0.2.1+13 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 camera: ^0.11.0+1