mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2025-12-23 11:29:30 +00:00
feat: Add settings to control play button visibility on home shelves (#81)
Some checks failed
Some checks failed
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This commit is contained in:
parent
25c3346941
commit
5c7be5cbe4
10 changed files with 481 additions and 7 deletions
103
lib/settings/view/home_page_settings_page.dart
Normal file
103
lib/settings/view/home_page_settings_page.dart
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:flutter_settings_ui/flutter_settings_ui.dart';
|
||||
import 'package:vaani/settings/app_settings_provider.dart';
|
||||
import 'package:vaani/settings/view/simple_settings_page.dart'
|
||||
show SimpleSettingsPage;
|
||||
|
||||
class HomePageSettingsPage extends HookConsumerWidget {
|
||||
const HomePageSettingsPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final appSettings = ref.watch(appSettingsProvider);
|
||||
final appSettingsNotifier = ref.read(appSettingsProvider.notifier);
|
||||
|
||||
return SimpleSettingsPage(
|
||||
title: Text('Home Page Settings'),
|
||||
sections: [
|
||||
SettingsSection(
|
||||
title: const Text('Quick Play'),
|
||||
margin: const EdgeInsetsDirectional.symmetric(
|
||||
horizontal: 16.0,
|
||||
vertical: 8.0,
|
||||
),
|
||||
tiles: [
|
||||
SettingsTile.switchTile(
|
||||
initialValue: appSettings
|
||||
.homePageSettings.showPlayButtonOnContinueListeningShelf,
|
||||
title: const Text('Continue Listening'),
|
||||
leading: const Icon(Icons.play_arrow),
|
||||
description: const Text(
|
||||
'Show play button for books in currently listening shelf',
|
||||
),
|
||||
onToggle: (value) {
|
||||
appSettingsNotifier.update(
|
||||
appSettings.copyWith(
|
||||
homePageSettings: appSettings.homePageSettings.copyWith(
|
||||
showPlayButtonOnContinueListeningShelf: value,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
SettingsTile.switchTile(
|
||||
title: const Text('Continue Series'),
|
||||
leading: const Icon(Icons.play_arrow),
|
||||
description: const Text(
|
||||
'Show play button for books in continue series shelf',
|
||||
),
|
||||
initialValue: appSettings
|
||||
.homePageSettings.showPlayButtonOnContinueSeriesShelf,
|
||||
onToggle: (value) {
|
||||
appSettingsNotifier.update(
|
||||
appSettings.copyWith(
|
||||
homePageSettings: appSettings.homePageSettings.copyWith(
|
||||
showPlayButtonOnContinueSeriesShelf: value,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
SettingsTile.switchTile(
|
||||
title: const Text('Other shelves'),
|
||||
leading: const Icon(Icons.all_inclusive),
|
||||
description: const Text(
|
||||
'Show play button for all books in all remaining shelves',
|
||||
),
|
||||
initialValue: appSettings
|
||||
.homePageSettings.showPlayButtonOnAllRemainingShelves,
|
||||
onToggle: (value) {
|
||||
appSettingsNotifier.update(
|
||||
appSettings.copyWith(
|
||||
homePageSettings: appSettings.homePageSettings.copyWith(
|
||||
showPlayButtonOnAllRemainingShelves: value,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
SettingsTile.switchTile(
|
||||
title: const Text('Listen Again'),
|
||||
leading: const Icon(Icons.replay),
|
||||
description: const Text(
|
||||
'Show play button for all books in listen again shelf',
|
||||
),
|
||||
initialValue:
|
||||
appSettings.homePageSettings.showPlayButtonOnListenAgainShelf,
|
||||
onToggle: (value) {
|
||||
appSettingsNotifier.update(
|
||||
appSettings.copyWith(
|
||||
homePageSettings: appSettings.homePageSettings.copyWith(
|
||||
showPlayButtonOnListenAgainShelf: value,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue