mirror of
https://github.com/stonega/tsacdop
synced 2025-02-12 17:40:45 +01:00
Option to hide podcast discovery
This commit is contained in:
parent
36a23f2de5
commit
b3e59bc2c7
@ -3,12 +3,12 @@ import 'package:flutter/services.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../local_storage/key_value_storage.dart';
|
||||
import '../service/search_api.dart';
|
||||
import '../state/audio_state.dart';
|
||||
import '../util/custom_dropdown.dart';
|
||||
import '../util/custom_widget.dart';
|
||||
import '../util/episodegrid.dart';
|
||||
import '../util/extension_helper.dart';
|
||||
import '../service/search_api.dart';
|
||||
import 'popup_menu.dart';
|
||||
|
||||
class LayoutSetting extends StatefulWidget {
|
||||
@ -49,7 +49,7 @@ class _LayoutSettingState extends State<LayoutSetting> {
|
||||
|
||||
Future<SearchEngine> _getSearchEngine() async {
|
||||
final storage = KeyValueStorage(searchEngineKey);
|
||||
final index = await storage.getInt(defaultValue: 1);
|
||||
final index = await storage.getInt(defaultValue: 0);
|
||||
return SearchEngine.values[index];
|
||||
}
|
||||
|
||||
@ -266,7 +266,7 @@ class _LayoutSettingState extends State<LayoutSetting> {
|
||||
height: 30.0,
|
||||
padding: EdgeInsets.symmetric(horizontal: 70),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text('Podcast search',
|
||||
child: Text(s.search,
|
||||
style: context.textTheme.bodyText1
|
||||
.copyWith(color: context.accentColor)),
|
||||
),
|
||||
@ -276,8 +276,8 @@ class _LayoutSettingState extends State<LayoutSetting> {
|
||||
builder: (context, snapshot) => ListTile(
|
||||
contentPadding: EdgeInsets.fromLTRB(70, 10, 10, 10),
|
||||
onTap: () => _saveHideDiscovery(!snapshot.data),
|
||||
title: Text('Hide podcast discovery'),
|
||||
subtitle: Text('Hide podcast discovery in search page'),
|
||||
title: Text(s.hidePodcastDiscovery),
|
||||
subtitle: Text(s.hidePodcastDiscoveryDes),
|
||||
trailing: Transform.scale(
|
||||
scale: 0.9,
|
||||
child: Switch(
|
||||
@ -290,20 +290,20 @@ class _LayoutSettingState extends State<LayoutSetting> {
|
||||
initialData: SearchEngine.listenNotes,
|
||||
builder: (context, snapshot) => ListTile(
|
||||
contentPadding: EdgeInsets.fromLTRB(70, 10, 10, 10),
|
||||
title: Text('Default search engine'),
|
||||
subtitle: Text('Choose default search engine'),
|
||||
title: Text(s.defaultSearchEngine),
|
||||
subtitle: Text(s.defaultSearchEngineDes),
|
||||
trailing: MyDropdownButton(
|
||||
hint: Text(''),
|
||||
underline: Center(),
|
||||
elevation: 1,
|
||||
value: snapshot.data,
|
||||
items: [
|
||||
DropdownMenuItem<SearchEngine>(
|
||||
value: SearchEngine.podcastIndex,
|
||||
child: Text('Podcastindex')),
|
||||
DropdownMenuItem<SearchEngine>(
|
||||
value: SearchEngine.listenNotes,
|
||||
child: Text('ListenNotes')),
|
||||
DropdownMenuItem<SearchEngine>(
|
||||
value: SearchEngine.podcastIndex,
|
||||
child: Text('PodcastIndex')),
|
||||
],
|
||||
onChanged: (value) => _saveSearchEngine(value)),
|
||||
),
|
||||
|
@ -494,6 +494,8 @@ class SettingState extends ChangeNotifier {
|
||||
await KeyValueStorage(notificationLayoutKey).getInt(defaultValue: 0);
|
||||
var showNotesFont = await showNotesFontStorage.getInt(defaultValue: 1);
|
||||
var speedList = await KeyValueStorage(speedListKey).getStringList();
|
||||
var hidePodcastDiscovery = await KeyValueStorage(hidePodcastDiscoveryKey)
|
||||
.getBool(defaultValue: false);
|
||||
|
||||
return SettingsBackup(
|
||||
theme: theme,
|
||||
@ -524,7 +526,8 @@ class SettingState extends ChangeNotifier {
|
||||
hideListened: hideListened,
|
||||
notificationLayout: notificationLayout,
|
||||
showNotesFont: showNotesFont,
|
||||
speedList: speedList);
|
||||
speedList: speedList,
|
||||
hidePodcastDiscovery: hidePodcastDiscovery);
|
||||
}
|
||||
|
||||
Future<void> restore(SettingsBackup backup) async {
|
||||
|
@ -28,6 +28,8 @@ class SettingsBackup {
|
||||
final int notificationLayout;
|
||||
final int showNotesFont;
|
||||
final List<String> speedList;
|
||||
final bool hidePodcastDiscovery;
|
||||
|
||||
SettingsBackup(
|
||||
{this.theme,
|
||||
this.accentColor,
|
||||
@ -57,7 +59,8 @@ class SettingsBackup {
|
||||
this.hideListened,
|
||||
this.notificationLayout,
|
||||
this.showNotesFont,
|
||||
this.speedList});
|
||||
this.speedList,
|
||||
this.hidePodcastDiscovery});
|
||||
|
||||
Map<String, Object> toJson() {
|
||||
return {
|
||||
@ -88,7 +91,8 @@ class SettingsBackup {
|
||||
'hideListened': hideListened,
|
||||
'notificationLayout': notificationLayout,
|
||||
'showNotesFont': showNotesFont,
|
||||
'speedList': speedList
|
||||
'speedList': speedList,
|
||||
'hidePodcastDiscovery': hidePodcastDiscovery
|
||||
};
|
||||
}
|
||||
|
||||
@ -123,6 +127,7 @@ class SettingsBackup {
|
||||
hideListened: json['hideListened'] as bool,
|
||||
notificationLayout: json['notificationLayout'] as int,
|
||||
showNotesFont: json['showNotesFont'] as int,
|
||||
speedList: speedList);
|
||||
speedList: speedList,
|
||||
hidePodcastDiscovery: json['hidePodcastDiscovery'] as bool);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user