move setting to unit

This commit is contained in:
niuhuan 2021-11-04 13:56:25 +08:00
parent fde1b0ae44
commit 0963ad1247
28 changed files with 172 additions and 189 deletions

View File

@ -8,14 +8,13 @@ import 'package:pikapi/basic/Method.dart';
import '../Common.dart';
const _propertyName = "androidDisplayMode";
List<String> modes = [];
List<String> _modes = [];
String _androidDisplayMode = "";
Future initAndroidDisplayMode() async {
if (Platform.isAndroid) {
_androidDisplayMode = await method.loadProperty(_propertyName, "");
modes = await method.loadAndroidModes();
_modes = await method.loadAndroidModes();
await _changeMode();
}
}
@ -24,14 +23,10 @@ Future _changeMode() async {
await method.setAndroidMode(_androidDisplayMode);
}
String androidDisplayModeName() {
return _androidDisplayMode;
}
Future<void> chooseAndroidDisplayMode(BuildContext context) async {
Future<void> _chooseAndroidDisplayMode(BuildContext context) async {
if (Platform.isAndroid) {
List<String> list = [""];
list.addAll(modes);
list.addAll(_modes);
String? result = await chooseListDialog<String>(context, "安卓屏幕刷新率", list);
if (result != null) {
await method.saveProperty(_propertyName, "$result");
@ -47,9 +42,9 @@ Widget androidDisplayModeSetting() {
builder: (BuildContext context, void Function(void Function()) setState) {
return ListTile(
title: Text("屏幕刷新率(安卓)"),
subtitle: Text(androidDisplayModeName()),
subtitle: Text(_androidDisplayMode),
onTap: () async {
await chooseAndroidDisplayMode(context);
await _chooseAndroidDisplayMode(context);
setState(() {});
},
);

View File

@ -7,32 +7,28 @@ import 'package:flutter/material.dart';
import '../Common.dart';
import '../Method.dart';
const propertyName = "androidSecureFlag";
const _propertyName = "androidSecureFlag";
late bool androidSecureFlag;
late bool _androidSecureFlag;
Future<void> initAndroidSecureFlag() async {
if (Platform.isAndroid) {
androidSecureFlag =
(await method.loadProperty(propertyName, "false")) == "true";
if (androidSecureFlag) {
_androidSecureFlag =
(await method.loadProperty(_propertyName, "false")) == "true";
if (_androidSecureFlag) {
await method.androidSecureFlag(true);
}
}
}
String androidSecureFlagName() {
return androidSecureFlag ? "" : "";
}
Future<void> chooseAndroidSecureFlag(BuildContext context) async {
Future<void> _chooseAndroidSecureFlag(BuildContext context) async {
String? result =
await chooseListDialog<String>(context, "禁止截图/禁止显示在任务视图", ["", ""]);
if (result != null) {
var target = result == "";
await method.saveProperty(propertyName, "$target");
androidSecureFlag = target;
await method.androidSecureFlag(androidSecureFlag);
await method.saveProperty(_propertyName, "$target");
_androidSecureFlag = target;
await method.androidSecureFlag(_androidSecureFlag);
}
}
@ -42,9 +38,9 @@ Widget androidSecureFlagSetting() {
(BuildContext context, void Function(void Function()) setState) {
return ListTile(
title: Text("禁止截图/禁止显示在任务视图(仅安卓)"),
subtitle: Text(androidSecureFlagName()),
subtitle: Text(_androidSecureFlag ? "" : ""),
onTap: () async {
await chooseAndroidSecureFlag(context);
await _chooseAndroidSecureFlag(context);
setState(() {});
});
});

View File

@ -1,9 +1,16 @@
import 'package:flutter/material.dart';
import 'package:pikapi/basic/Method.dart';
const _autoCleanMap = {
"一个月前": "${3600 * 24 * 30}",
"一周前": "${3600 * 24 * 7}",
"一天前": "${3600 * 24 * 1}",
"不自动清理": "${0}",
};
late String _autoCleanSec;
Future<dynamic> autoClean() async {
Future<dynamic> initAutoClean() async {
_autoCleanSec =
await method.loadProperty("autoCleanSec", "${3600 * 24 * 30}");
if ("0" != _autoCleanSec) {
@ -11,14 +18,7 @@ Future<dynamic> autoClean() async {
}
}
var _autoCleanMap = {
"一个月前": "${3600 * 24 * 30}",
"一周前": "${3600 * 24 * 7}",
"一天前": "${3600 * 24 * 1}",
"不自动清理": "${0}",
};
String currentAutoCleanSec() {
String _currentAutoCleanSec() {
for (var value in _autoCleanMap.entries) {
if (value.value == _autoCleanSec) {
return value.key;
@ -27,7 +27,7 @@ String currentAutoCleanSec() {
return "";
}
Future<void> chooseAutoCleanSec(BuildContext context) async {
Future<void> _chooseAutoCleanSec(BuildContext context) async {
String? choose = await showDialog<String>(
context: context,
builder: (BuildContext context) {
@ -58,9 +58,9 @@ Widget autoCleanSecSetting() {
builder: (BuildContext context, void Function(void Function()) setState) {
return ListTile(
title: Text("自动清理缓存"),
subtitle: Text(currentAutoCleanSec()),
subtitle: Text(_currentAutoCleanSec()),
onTap: () async {
await chooseAutoCleanSec(context);
await _chooseAutoCleanSec(context);
setState(() {});
},
);

View File

@ -5,24 +5,19 @@ import 'package:flutter/material.dart';
import '../Common.dart';
import '../Method.dart';
late bool _autoFullScreen;
bool currentAutoFullScreen() {
return _autoFullScreen;
}
const _propertyName = "autoFullScreen";
late bool _autoFullScreen;
Future<void> initAutoFullScreen() async {
_autoFullScreen =
(await method.loadProperty(_propertyName, "false")) == "true";
}
String autoFullScreenName() {
return _autoFullScreen ? "" : "";
bool currentAutoFullScreen() {
return _autoFullScreen;
}
Future<void> chooseAutoFullScreen(BuildContext context) async {
Future<void> _chooseAutoFullScreen(BuildContext context) async {
String? result =
await chooseListDialog<String>(context, "进入阅读器自动全屏", ["", ""]);
if (result != null) {
@ -37,9 +32,9 @@ Widget autoFullScreenSetting() {
builder: (BuildContext context, void Function(void Function()) setState) {
return ListTile(
title: Text("进入阅读器自动全屏"),
subtitle: Text(autoFullScreenName()),
subtitle: Text(_autoFullScreen ? "" : ""),
onTap: () async {
await chooseAutoFullScreen(context);
await _chooseAutoFullScreen(context);
setState(() {});
},
);

View File

@ -10,7 +10,7 @@ import '../Method.dart';
const _propertyName = "chooserRoot";
late String _chooserRoot;
Future<String?> initChooserRoot() async {
Future<dynamic> initChooserRoot() async {
_chooserRoot = await method.loadProperty(_propertyName, "");
}
@ -34,7 +34,7 @@ String currentChooserRoot() {
return _chooserRoot;
}
Future<dynamic> inputChooserRoot(BuildContext context) async {
Future<dynamic> _inputChooserRoot(BuildContext context) async {
String? input = await displayTextInputDialog(
context,
'文件夹选择器根路径',
@ -55,7 +55,7 @@ Widget chooserRootSetting() {
title: Text("文件夹选择器默认路径"),
subtitle: Text(currentChooserRoot()),
onTap: () async {
await inputChooserRoot(context);
await _inputChooserRoot(context);
setState(() {});
},
);

View File

@ -10,9 +10,8 @@ enum ContentFailedReloadAction {
TOUCH_LOADER,
}
late ContentFailedReloadAction contentFailedReloadAction;
const _propertyName = "contentFailedReloadAction";
late ContentFailedReloadAction contentFailedReloadAction;
Future<void> initContentFailedReloadAction() async {
contentFailedReloadAction =
@ -31,13 +30,13 @@ ContentFailedReloadAction _contentFailedReloadActionFromString(String string) {
return ContentFailedReloadAction.PULL_DOWN;
}
Map<String, ContentFailedReloadAction> contentFailedReloadActionMap = {
Map<String, ContentFailedReloadAction> _contentFailedReloadActionMap = {
"下拉刷新": ContentFailedReloadAction.PULL_DOWN,
"点击屏幕刷新": ContentFailedReloadAction.TOUCH_LOADER,
};
String currentContentFailedReloadActionName() {
for (var e in contentFailedReloadActionMap.entries) {
String _currentContentFailedReloadActionName() {
for (var e in _contentFailedReloadActionMap.entries) {
if (e.value == contentFailedReloadAction) {
return e.key;
}
@ -45,25 +44,27 @@ String currentContentFailedReloadActionName() {
return '';
}
Future<void> chooseContentFailedReloadAction(BuildContext context) async {
Future<void> _chooseContentFailedReloadAction(BuildContext context) async {
ContentFailedReloadAction? result =
await chooseMapDialog<ContentFailedReloadAction>(
context, contentFailedReloadActionMap, "选择页面加载失败刷新的方式");
context, _contentFailedReloadActionMap, "选择页面加载失败刷新的方式");
if (result != null) {
await method.saveProperty(_propertyName, result.toString());
contentFailedReloadAction = result;
}
}
Widget contentFailedReloadActionSetting(){
return StatefulBuilder(builder: (BuildContext context, void Function(void Function()) setState) {
return ListTile(
title: Text("加载失败时"),
subtitle: Text(currentContentFailedReloadActionName()),
onTap: () async {
await chooseContentFailedReloadAction(context);
setState(() {});
},
);
},);
}
Widget contentFailedReloadActionSetting() {
return StatefulBuilder(
builder: (BuildContext context, void Function(void Function()) setState) {
return ListTile(
title: Text("加载失败时"),
subtitle: Text(_currentContentFailedReloadActionName()),
onTap: () async {
await _chooseContentFailedReloadAction(context);
setState(() {});
},
);
},
);
}

View File

@ -1,3 +1,5 @@
///
import 'dart:io';
import 'package:flutter/cupertino.dart';

View File

@ -1,3 +1,5 @@
/// 线
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:pikapi/basic/Common.dart';

View File

@ -10,17 +10,25 @@ enum FullScreenAction {
TOUCH_ONCE,
}
late FullScreenAction fullScreenAction;
Map<String, FullScreenAction> _fullScreenActionMap = {
"使用控制器": FullScreenAction.CONTROLLER,
"点击屏幕一次": FullScreenAction.TOUCH_ONCE,
};
const _propertyName = "fullScreenAction";
late FullScreenAction _fullScreenAction;
Future<void> initFullScreenAction() async {
fullScreenAction = _fullScreenActionFromString(await method.loadProperty(
_fullScreenAction = _fullScreenActionFromString(await method.loadProperty(
_propertyName,
FullScreenAction.CONTROLLER.toString(),
));
}
FullScreenAction currentFullScreenAction() {
return _fullScreenAction;
}
FullScreenAction _fullScreenActionFromString(String string) {
for (var value in FullScreenAction.values) {
if (string == value.toString()) {
@ -30,26 +38,21 @@ FullScreenAction _fullScreenActionFromString(String string) {
return FullScreenAction.CONTROLLER;
}
Map<String, FullScreenAction> fullScreenActionMap = {
"使用控制器": FullScreenAction.CONTROLLER,
"点击屏幕一次": FullScreenAction.TOUCH_ONCE,
};
String currentFullScreenActionName() {
for (var e in fullScreenActionMap.entries) {
if (e.value == fullScreenAction) {
String _currentFullScreenActionName() {
for (var e in _fullScreenActionMap.entries) {
if (e.value == _fullScreenAction) {
return e.key;
}
}
return '';
}
Future<void> chooseFullScreenAction(BuildContext context) async {
Future<void> _chooseFullScreenAction(BuildContext context) async {
FullScreenAction? result = await chooseMapDialog<FullScreenAction>(
context, fullScreenActionMap, "选择进入全屏的方式");
context, _fullScreenActionMap, "选择进入全屏的方式");
if (result != null) {
await method.saveProperty(_propertyName, result.toString());
fullScreenAction = result;
_fullScreenAction = result;
}
}
@ -58,9 +61,9 @@ Widget fullScreenActionSetting() {
builder: (BuildContext context, void Function(void Function()) setState) {
return ListTile(
title: Text("进入全屏的方式"),
subtitle: Text(currentFullScreenActionName()),
subtitle: Text(_currentFullScreenActionName()),
onTap: () async {
await chooseFullScreenAction(context);
await _chooseFullScreenAction(context);
setState(() {});
},
);

View File

@ -12,9 +12,9 @@ enum FullScreenUI {
ALL,
}
const _propertyName = "fullScreenUI";
late FullScreenUI fullScreenUI;
const _propertyName = "fullScreenUI";
Future<void> initFullScreenUI() async {
fullScreenUI = _fullScreenUIFromString(await method.loadProperty(

View File

@ -16,11 +16,7 @@ Future<void> initKeyboardController() async {
(await method.loadProperty(_propertyName, "false")) == "true";
}
String keyboardControllerName() {
return keyboardController ? "" : "";
}
Future<void> chooseKeyboardController(BuildContext context) async {
Future<void> _chooseKeyboardController(BuildContext context) async {
String? result =
await chooseListDialog<String>(context, "键盘控制翻页", ["", ""]);
if (result != null) {
@ -36,9 +32,9 @@ Widget keyboardControllerSetting() {
builder: (BuildContext context, void Function(void Function()) setState) {
return ListTile(
title: Text("阅读器键盘翻页(仅PC)"),
subtitle: Text(keyboardControllerName()),
subtitle: Text(keyboardController ? "" : ""),
onTap: () async {
await chooseKeyboardController(context);
await _chooseKeyboardController(context);
setState(() {});
},
);

View File

@ -11,8 +11,17 @@ enum ListLayout {
COVER_AND_TITLE,
}
const Map<String, ListLayout> _listLayoutMap = {
'详情': ListLayout.INFO_CARD,
'封面': ListLayout.ONLY_IMAGE,
'封面+标题': ListLayout.COVER_AND_TITLE,
};
const _propertyName = "listLayout";
late ListLayout currentLayout;
var listLayoutEvent = Event<EventArgs>();
Future<void> initListLayout() async {
currentLayout = _listLayoutFromString(await method.loadProperty(
_propertyName,
@ -20,16 +29,6 @@ Future<void> initListLayout() async {
));
}
const _propertyName = "listLayout";
var listLayoutEvent = Event<EventArgs>();
const Map<String, ListLayout> _listLayoutMap = {
'详情': ListLayout.INFO_CARD,
'封面': ListLayout.ONLY_IMAGE,
'封面+标题': ListLayout.COVER_AND_TITLE,
};
ListLayout _listLayoutFromString(String layoutString) {
for (var value in ListLayout.values) {
if (layoutString == value.toString()) {
@ -39,7 +38,7 @@ ListLayout _listLayoutFromString(String layoutString) {
return ListLayout.INFO_CARD;
}
void chooseListLayout(BuildContext context) async {
void _chooseListLayout(BuildContext context) async {
ListLayout? layout = await chooseMapDialog(context, _listLayoutMap, '请选择布局');
if (layout != null) {
await method.saveProperty(_propertyName, layout.toString());
@ -48,10 +47,9 @@ void chooseListLayout(BuildContext context) async {
}
}
IconButton chooseLayoutAction(BuildContext context) => IconButton(
IconButton chooseLayoutActionButton(BuildContext context) => IconButton(
onPressed: () {
chooseListLayout(context);
_chooseListLayout(context);
},
icon: Icon(Icons.view_quilt),
);

View File

@ -10,15 +10,23 @@ enum PagerAction {
STREAM,
}
late PagerAction currentPagerAction;
Map<String, PagerAction> _pagerActionMap = {
"使用按钮": PagerAction.CONTROLLER,
"瀑布流": PagerAction.STREAM,
};
const _propertyName = "pagerAction";
late PagerAction _pagerAction;
Future<void> initPagerAction() async {
currentPagerAction = _pagerActionFromString(await method.loadProperty(
_pagerAction = _pagerActionFromString(await method.loadProperty(
_propertyName, PagerAction.CONTROLLER.toString()));
}
PagerAction currentPagerAction() {
return _pagerAction;
}
PagerAction _pagerActionFromString(String string) {
for (var value in PagerAction.values) {
if (string == value.toString()) {
@ -28,26 +36,21 @@ PagerAction _pagerActionFromString(String string) {
return PagerAction.CONTROLLER;
}
Map<String, PagerAction> _pagerActionMap = {
"使用按钮": PagerAction.CONTROLLER,
"瀑布流": PagerAction.STREAM,
};
String currentPagerActionName() {
String _currentPagerActionName() {
for (var e in _pagerActionMap.entries) {
if (e.value == currentPagerAction) {
if (e.value == _pagerAction) {
return e.key;
}
}
return '';
}
Future<void> choosePagerAction(BuildContext context) async {
Future<void> _choosePagerAction(BuildContext context) async {
PagerAction? result =
await chooseMapDialog<PagerAction>(context, _pagerActionMap, "选择列表页加载方式");
if (result != null) {
await method.saveProperty(_propertyName, result.toString());
currentPagerAction = result;
_pagerAction = result;
}
}
@ -56,9 +59,9 @@ Widget pagerActionSetting() {
builder: (BuildContext context, void Function(void Function()) setState) {
return ListTile(
title: Text("列表页加载方式"),
subtitle: Text(currentPagerActionName()),
subtitle: Text(_currentPagerActionName()),
onTap: () async {
await choosePagerAction(context);
await _choosePagerAction(context);
setState(() {});
},
);

View File

@ -20,7 +20,13 @@ var _qualities = {
_LabelHigh: ImageQualityHigh,
};
const _propertyName = "quality";
late String _currentQualityCode;
const _defaultValue = _ImageQualityOriginal;
Future<void> initQuality() async {
_currentQualityCode = await method.loadProperty(_propertyName, _defaultValue);
}
String currentQualityCode() {
return _currentQualityCode;
@ -35,14 +41,7 @@ String _currentQualityName() {
return '';
}
const _propertyName = "quality";
const _defaultValue = _ImageQualityOriginal;
Future<void> initQuality() async {
_currentQualityCode = await method.loadProperty(_propertyName, _defaultValue);
}
Future<void> chooseQuality(BuildContext context) async {
Future<void> _chooseQuality(BuildContext context) async {
String? code = await showDialog<String>(
context: context,
builder: (BuildContext context) {
@ -74,7 +73,7 @@ Widget qualitySetting() {
title: Text("浏览时的图片质量"),
subtitle: Text(_currentQualityName()),
onTap: () async {
await chooseQuality(context);
await _chooseQuality(context);
setState(() {});
},
);

View File

@ -9,21 +9,20 @@ enum ReaderDirection {
RIGHT_TO_LEFT,
}
late ReaderDirection gReaderDirection;
const _types = {
'从上到下': ReaderDirection.TOP_TO_BOTTOM,
'从左到右': ReaderDirection.LEFT_TO_RIGHT,
'从右到左': ReaderDirection.RIGHT_TO_LEFT,
};
const _propertyName = "readerDirection";
late ReaderDirection gReaderDirection;
Future<void> initReaderDirection() async {
gReaderDirection = _pagerDirectionFromString(await method.loadProperty(
_propertyName, ReaderDirection.TOP_TO_BOTTOM.toString()));
}
var _types = {
'从上到下': ReaderDirection.TOP_TO_BOTTOM,
'从左到右': ReaderDirection.LEFT_TO_RIGHT,
'从右到左': ReaderDirection.RIGHT_TO_LEFT,
};
ReaderDirection _pagerDirectionFromString(String pagerDirectionString) {
for (var value in ReaderDirection.values) {
if (pagerDirectionString == value.toString()) {
@ -33,7 +32,7 @@ ReaderDirection _pagerDirectionFromString(String pagerDirectionString) {
return ReaderDirection.TOP_TO_BOTTOM;
}
String currentReaderDirectionName() {
String _currentReaderDirectionName() {
for (var e in _types.entries) {
if (e.value == gReaderDirection) {
return e.key;
@ -42,6 +41,7 @@ String currentReaderDirectionName() {
return '';
}
/// ?? to ActionButton And Event ??
Future<void> choosePagerDirection(BuildContext buildContext) async {
ReaderDirection? choose = await showDialog<ReaderDirection>(
context: buildContext,
@ -70,7 +70,7 @@ Widget readerDirectionSetting() {
builder: (BuildContext context, void Function(void Function()) setState) {
return ListTile(
title: Text("阅读器方向"),
subtitle: Text(currentReaderDirectionName()),
subtitle: Text(_currentReaderDirectionName()),
onTap: () async {
await choosePagerDirection(context);
setState(() {});

View File

@ -1,30 +1,32 @@
///
import 'package:flutter/material.dart';
import '../Method.dart';
late ReaderType gReaderType;
const _propertyName = "readerType";
Future<dynamic> initReaderType() async {
gReaderType = _readerTypeFromString(
await method.loadProperty(_propertyName, ReaderType.WEB_TOON.toString()));
}
enum ReaderType {
WEB_TOON,
WEB_TOON_ZOOM,
GALLERY,
}
var _types = {
const _types = {
'WebToon (默认)': ReaderType.WEB_TOON,
'WebToon + 双击放大': ReaderType.WEB_TOON_ZOOM,
'相册': ReaderType.GALLERY,
};
const _propertyName = "readerType";
late ReaderType _readerType;
Future<dynamic> initReaderType() async {
_readerType = _readerTypeFromString(
await method.loadProperty(_propertyName, ReaderType.WEB_TOON.toString()));
}
ReaderType currentReaderType() {
return _readerType;
}
ReaderType _readerTypeFromString(String pagerTypeString) {
for (var value in ReaderType.values) {
if (pagerTypeString == value.toString()) {
@ -36,7 +38,7 @@ ReaderType _readerTypeFromString(String pagerTypeString) {
String currentReaderTypeName() {
for (var e in _types.entries) {
if (e.value == gReaderType) {
if (e.value == _readerType) {
return e.key;
}
}
@ -62,7 +64,7 @@ Future<void> choosePagerType(BuildContext buildContext) async {
);
if (t != null) {
await method.saveProperty(_propertyName, t.toString());
gReaderType = t;
_readerType = t;
}
}

View File

@ -10,12 +10,10 @@ import 'package:multi_select_flutter/multi_select_flutter.dart';
import '../Method.dart';
import '../store/Categories.dart';
late List<String> shadowCategories;
var shadowCategoriesEvent = Event<EventArgs>();
// mapper
const _propertyName = "shadowCategories";
late List<String> shadowCategories;
var shadowCategoriesEvent = Event<EventArgs>();
///
Future<List<String>> _loadShadowCategories() async {

View File

@ -5,19 +5,18 @@ import 'package:flutter/material.dart';
import '../Common.dart';
import '../Method.dart';
int _timeOffsetHour = 8;
int currentTimeOffsetHour() {
return _timeOffsetHour;
}
const _propertyName = "timeOffsetHour";
int _timeOffsetHour = 8;
Future<void> initTimeZone() async {
_timeOffsetHour = int.parse(await method.loadProperty(_propertyName, "8"));
}
Future<void> chooseTimeZone(BuildContext context) async {
int currentTimeOffsetHour() {
return _timeOffsetHour;
}
Future<void> _chooseTimeZone(BuildContext context) async {
List<String> timeZones = [];
for (var i = -12; i <= 12; i++) {
var str = i.toString();
@ -47,7 +46,7 @@ Widget timeZoneSetting() {
title: Text("时区"),
subtitle: Text(c),
onTap: () async {
await chooseTimeZone(context);
await _chooseTimeZone(context);
setState(() {});
},
);

View File

@ -7,25 +7,20 @@ import 'package:flutter/material.dart';
import '../Common.dart';
import '../Method.dart';
const propertyName = "volumeController";
const _propertyName = "volumeController";
late bool volumeController;
Future<void> initVolumeController() async {
volumeController =
(await method.loadProperty(propertyName, "false")) == "true";
(await method.loadProperty(_propertyName, "false")) == "true";
}
String volumeControllerName() {
return volumeController ? "" : "";
}
Future<void> chooseVolumeController(BuildContext context) async {
Future<void> _chooseVolumeController(BuildContext context) async {
String? result =
await chooseListDialog<String>(context, "音量键控制翻页", ["", ""]);
if (result != null) {
var target = result == "";
await method.saveProperty(propertyName, "$target");
await method.saveProperty(_propertyName, "$target");
volumeController = target;
}
}
@ -36,9 +31,9 @@ Widget volumeControllerSetting() {
(BuildContext context, void Function(void Function()) setState) {
return ListTile(
title: Text("阅读器音量键翻页(仅安卓)"),
subtitle: Text(volumeControllerName()),
subtitle: Text(volumeController ? "" : ""),
onTap: () async {
await chooseVolumeController(context);
await _chooseVolumeController(context);
setState(() {});
});
});

View File

@ -18,7 +18,7 @@ class ComicReaderScreen extends StatefulWidget {
final List<Ep> epList;
final currentEpOrder;
final int? initPictureRank;
final ReaderType pagerType = gReaderType;
final ReaderType pagerType = currentReaderType();
final ReaderDirection pagerDirection = gReaderDirection;
late final bool autoFullScreen;
@ -149,7 +149,7 @@ class _ComicReaderScreenState extends State<ComicReaderScreen> {
IconButton(
onPressed: () async {
await choosePagerType(context);
if (widget.pagerType != gReaderType) {
if (widget.pagerType != currentReaderType()) {
_reloadReader();
}
},

View File

@ -51,7 +51,7 @@ class _ComicsScreenState extends State<ComicsScreen> {
title: new Text(categoryTitle(widget.category)),
actions: [
shadowCategoriesActionButton(context),
chooseLayoutAction(context),
chooseLayoutActionButton(context),
_chooseCategoryAction(),
_categorySearchBar.getSearchAction(context),
],
@ -125,7 +125,7 @@ class _ComicsScreenState extends State<ComicsScreen> {
title: Text(title),
actions: [
shadowCategoriesActionButton(context),
chooseLayoutAction(context),
chooseLayoutActionButton(context),
_chooseCategoryAction(),
],
);

View File

@ -17,7 +17,7 @@ class DownloadReaderScreen extends StatefulWidget {
final List<DownloadEp> epList;
final int currentEpOrder;
final int? initPictureRank;
final ReaderType pagerType = gReaderType;
final ReaderType pagerType = currentReaderType();
final ReaderDirection pagerDirection = gReaderDirection;
late final bool autoFullScreen;
@ -118,7 +118,6 @@ class _DownloadReaderScreenState extends State<DownloadReaderScreen> {
super.dispose();
}
@override
Widget build(BuildContext context) {
return readerKeyboardHolder(_build(context));
@ -143,7 +142,7 @@ class _DownloadReaderScreenState extends State<DownloadReaderScreen> {
IconButton(
onPressed: () async {
await choosePagerType(context);
if (widget.pagerType != gReaderType) {
if (widget.pagerType != currentReaderType()) {
_reloadReader();
}
},

View File

@ -43,7 +43,7 @@ class _InitScreenState extends State<InitScreen> {
Future<dynamic> _init() async {
//
await initPlatform(); // ,
await autoClean();
await initAutoClean();
await initAddress();
await initProxy();
await initQuality();

View File

@ -28,7 +28,7 @@ class _RandomComicsScreenState extends State<RandomComicsScreen> {
title: Text('随机本子'),
actions: [
shadowCategoriesActionButton(context),
chooseLayoutAction(context),
chooseLayoutActionButton(context),
],
),
body: ComicListBuilder(_future, _reload),

View File

@ -17,7 +17,7 @@ class RankingsScreen extends StatelessWidget {
title: Text('排行榜'),
actions: [
shadowCategoriesActionButton(context),
chooseLayoutAction(context),
chooseLayoutActionButton(context),
],
),
body: DefaultTabController(

View File

@ -49,7 +49,7 @@ class _SearchScreenState extends State<SearchScreen> {
title: Text("${categoryTitle(widget.category)} ${widget.keyword}"),
actions: [
shadowCategoriesActionButton(context),
chooseLayoutAction(context),
chooseLayoutActionButton(context),
_chooseCategoryAction(),
_searchBar.getSearchAction(context),
],

View File

@ -41,7 +41,7 @@ class _ComicPagerState extends State<ComicPager> {
@override
Widget build(BuildContext context) {
switch (currentPagerAction) {
switch (currentPagerAction()) {
case PagerAction.CONTROLLER:
return ControllerComicPager(fetchPage: widget.fetchPage);
case PagerAction.STREAM:

View File

@ -148,7 +148,7 @@ class ImageReader extends StatelessWidget {
reader = Container();
break;
}
switch (fullScreenAction) {
switch (currentFullScreenAction()) {
case FullScreenAction.CONTROLLER:
reader = Stack(
children: [