Files
venera/lib/pages/settings/reader.dart
2024-11-11 22:40:46 +08:00

91 lines
2.9 KiB
Dart

part of 'settings_page.dart';
class ReaderSettings extends StatefulWidget {
const ReaderSettings({super.key, this.onChanged});
final void Function(String key)? onChanged;
@override
State<ReaderSettings> createState() => _ReaderSettingsState();
}
class _ReaderSettingsState extends State<ReaderSettings> {
@override
Widget build(BuildContext context) {
return SmoothCustomScrollView(
slivers: [
SliverAppbar(title: Text("Reading".tl)),
_SwitchSetting(
title: "Tap to turn Pages".tl,
settingKey: "enableTapToTurnPages",
onChanged: () {
widget.onChanged?.call("enableTapToTurnPages");
},
).toSliver(),
_SwitchSetting(
title: "Page animation".tl,
settingKey: "enablePageAnimation",
onChanged: () {
widget.onChanged?.call("enablePageAnimation");
},
).toSliver(),
SelectSetting(
title: "Reading mode".tl,
settingKey: "readerMode",
optionTranslation: {
"galleryLeftToRight": "Gallery (Left to Right)".tl,
"galleryRightToLeft": "Gallery (Right to Left)".tl,
"galleryTopToBottom": "Gallery (Top to Bottom)".tl,
"continuousLeftToRight": "Continuous (Left to Right)".tl,
"continuousRightToLeft": "Continuous (Right to Left)".tl,
"continuousTopToBottom": "Continuous (Top to Bottom)".tl,
},
onChanged: () {
widget.onChanged?.call("readerMode");
},
).toSliver(),
_SliderSetting(
title: "Auto page turning interval".tl,
settingsIndex: "autoPageTurningInterval",
interval: 1,
min: 1,
max: 20,
onChanged: () {
widget.onChanged?.call("autoPageTurningInterval");
},
).toSliver(),
_SwitchSetting(
title: 'Long press to zoom'.tl,
settingKey: 'enableLongPressToZoom',
onChanged: () {
widget.onChanged?.call('enableLongPressToZoom');
},
).toSliver(),
_SwitchSetting(
title: 'Limit image width'.tl,
subtitle: 'When using Continuous(Top to Bottom) mode'.tl,
settingKey: 'limitImageWidth',
onChanged: () {
widget.onChanged?.call('limitImageWidth');
},
).toSliver(),
if(App.isAndroid)
_SwitchSetting(
title: 'Turn page by volume key'.tl,
settingKey: 'enableTurnPageByVolumeKey',
onChanged: () {
widget.onChanged?.call('enableTurnPageByVolumeKey');
},
).toSliver(),
_SwitchSetting(
title: "Display time & battery info in reader".tl,
settingKey: "enableClockAndBatteryInfoInReader",
onChanged: () {
widget.onChanged?.call("enableClockAndBatteryInfoInReader");
},
).toSliver(),
],
);
}
}