diff options
Diffstat (limited to 'lib/presentation/screens')
6 files changed, 23 insertions, 33 deletions
diff --git a/lib/presentation/screens/home/home.dart b/lib/presentation/screens/home/home.dart index 3d80f92..8f0d125 100644 --- a/lib/presentation/screens/home/home.dart +++ b/lib/presentation/screens/home/home.dart @@ -28,7 +28,7 @@ class HomeScreenState extends ConsumerState<HomeScreen> { BuildContext context, ) { return Consumer(builder: (context, ref, child) { - final state = ref.read(appProvider); + final appState = ref.watch(appProvider); final bool disableBkgAnimation = ref.read(appConfigProvider).disableBkgAnimation; if (disableBkgAnimation) { @@ -48,13 +48,13 @@ class HomeScreenState extends ConsumerState<HomeScreen> { repeat: true, ), FlowBuilder<AppState>( - state: ref.watch(appProvider), + state: appState, onGeneratePages: onGenerateAppViewPages, observers: [ HeroController(), ], ), - if (state != AppState.splash) + if (appState != AppState.splash) Positioned( top: 0, bottom: 0, @@ -66,7 +66,7 @@ class HomeScreenState extends ConsumerState<HomeScreen> { ], ), bottomNavigationBar: - state == AppState.splash ? null : const CustomBottomBar(), + appState == AppState.splash ? null : const CustomBottomBar(), ); }); } diff --git a/lib/presentation/screens/media/play_list_table.dart b/lib/presentation/screens/media/play_list_table.dart index 71d2fc9..28cb970 100644 --- a/lib/presentation/screens/media/play_list_table.dart +++ b/lib/presentation/screens/media/play_list_table.dart @@ -61,6 +61,9 @@ class _PlayListTableState extends ConsumerState<PlayListTable> { onTap: () { setState(() { isAudioSettingsEnabled = !isAudioSettingsEnabled; + ref + .read(appProvider.notifier) + .update(AppState.audioSettings); }); }, child: Padding( diff --git a/lib/presentation/screens/media/radio_preset_table.dart b/lib/presentation/screens/media/radio_preset_table.dart index 97affb8..fcf8e2b 100644 --- a/lib/presentation/screens/media/radio_preset_table.dart +++ b/lib/presentation/screens/media/radio_preset_table.dart @@ -64,6 +64,9 @@ class _RadioPresetTableState extends ConsumerState<RadioPresetTable> { onTap: () { setState(() { isAudioSettingsEnabled = !isAudioSettingsEnabled; + ref + .read(appProvider.notifier) + .update(AppState.audioSettings); }); }, child: Padding( diff --git a/lib/presentation/screens/settings/settings_screens/audio_settings/audio_settings_screen.dart b/lib/presentation/screens/settings/settings_screens/audio_settings/audio_settings_screen.dart index 3c3508e..2b14b7f 100644 --- a/lib/presentation/screens/settings/settings_screens/audio_settings/audio_settings_screen.dart +++ b/lib/presentation/screens/settings/settings_screens/audio_settings/audio_settings_screen.dart @@ -2,7 +2,6 @@ import 'package:flutter_ics_homescreen/export.dart'; import 'widget/audio_content.dart'; - class AudioSettingsPage extends ConsumerWidget { const AudioSettingsPage({super.key}); @@ -17,14 +16,12 @@ class AudioSettingsPage extends ConsumerWidget { title: 'Audio Settings', hasBackButton: true, onPressed: () { - context.flow<AppState>().update((state) => AppState.settings); + ref.read(appProvider.notifier).back(); }, ), - const Expanded( - child: AudioContent()), + const Expanded(child: AudioContent()), ], ), ); } } - diff --git a/lib/presentation/screens/settings/widgets/settings_content.dart b/lib/presentation/screens/settings/widgets/settings_content.dart index f73bf6d..6d0df50 100644 --- a/lib/presentation/screens/settings/widgets/settings_content.dart +++ b/lib/presentation/screens/settings/widgets/settings_content.dart @@ -2,13 +2,13 @@ import 'package:flutter_ics_homescreen/export.dart'; import '../../../custom_icons/custom_icons.dart'; -class Settings extends StatelessWidget { +class Settings extends ConsumerWidget { const Settings({ super.key, }); @override - Widget build(BuildContext context) { + Widget build(BuildContext context, WidgetRef ref) { return Column( mainAxisAlignment: MainAxisAlignment.start, //crossAxisAlignment: CrossAxisAlignment.center, @@ -25,66 +25,56 @@ class Settings extends StatelessWidget { title: 'Date & Time', hasSwich: false, voidCallback: () async { - context - .flow<AppState>() - .update((next) => AppState.dateTime); + ref.read(appProvider.notifier).update(AppState.dateTime); }), SettingsTile( icon: Icons.bluetooth, title: 'Bluetooth', hasSwich: true, voidCallback: () { - context - .flow<AppState>() - .update((next) => AppState.bluetooth); + ref.read(appProvider.notifier).update(AppState.bluetooth); }), SettingsTile( icon: Icons.wifi, title: 'Wifi', hasSwich: true, voidCallback: () { - context.flow<AppState>().update((next) => AppState.wifi); + ref.read(appProvider.notifier).update(AppState.wifi); }), SettingsTile( icon: CustomIcons.wiredicon, title: 'Wired', hasSwich: false, voidCallback: () { - context.flow<AppState>().update((next) => AppState.wired); + ref.read(appProvider.notifier).update(AppState.wired); }), SettingsTile( icon: Icons.tune, title: 'Audio Settings', hasSwich: false, voidCallback: () { - context - .flow<AppState>() - .update((next) => AppState.audioSettings); + ref.read(appProvider.notifier).update(AppState.audioSettings); }), SettingsTile( icon: Icons.person_2_outlined, title: 'Profiles', hasSwich: false, voidCallback: () { - context - .flow<AppState>() - .update((next) => AppState.profiles); + ref.read(appProvider.notifier).update(AppState.profiles); }), SettingsTile( icon: Icons.straighten, title: 'Units', hasSwich: false, voidCallback: () { - context.flow<AppState>().update((next) => AppState.units); + ref.read(appProvider.notifier).update(AppState.units); }), SettingsTile( icon: Icons.help_sharp, title: 'Version Info', hasSwich: false, voidCallback: () { - context - .flow<AppState>() - .update((next) => AppState.versionInfo); + ref.read(appProvider.notifier).update(AppState.versionInfo); }), ], ), diff --git a/lib/presentation/screens/splash/widget/splash_content.dart b/lib/presentation/screens/splash/widget/splash_content.dart index 51ee71f..6051dcf 100644 --- a/lib/presentation/screens/splash/widget/splash_content.dart +++ b/lib/presentation/screens/splash/widget/splash_content.dart @@ -131,10 +131,7 @@ class SplashContentState extends ConsumerState<SplashContent> width: 452, text: 'Continue', onTap: () { - // ref.read(vehicleProvider.notifier).setInitialState(); - ref - .read(appProvider.notifier) - .update((state) => state = AppState.dashboard); + ref.read(appProvider.notifier).update(AppState.dashboard); }, ), const SizedBox( |