mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: custom refresh dragPercent/displacement
related #139 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -10,7 +10,7 @@ Widget refreshIndicator({
|
|||||||
required Widget child,
|
required Widget child,
|
||||||
}) {
|
}) {
|
||||||
return RefreshIndicator(
|
return RefreshIndicator(
|
||||||
displacement: 10,
|
displacement: displacement,
|
||||||
onRefresh: onRefresh,
|
onRefresh: onRefresh,
|
||||||
child: child,
|
child: child,
|
||||||
);
|
);
|
||||||
@@ -22,7 +22,9 @@ Widget refreshIndicator({
|
|||||||
|
|
||||||
// The over-scroll distance that moves the indicator to its maximum
|
// The over-scroll distance that moves the indicator to its maximum
|
||||||
// displacement, as a percentage of the scrollable's container extent.
|
// displacement, as a percentage of the scrollable's container extent.
|
||||||
const double _kDragContainerExtentPercentage = 0.15;
|
|
||||||
|
double displacement = 40;
|
||||||
|
double kDragContainerExtentPercentage = 0.25;
|
||||||
|
|
||||||
// How much the scroll's drag gesture can overshoot the RefreshIndicator's
|
// How much the scroll's drag gesture can overshoot the RefreshIndicator's
|
||||||
// displacement; max displacement = _kDragSizeFactorLimit * displacement.
|
// displacement; max displacement = _kDragSizeFactorLimit * displacement.
|
||||||
@@ -471,7 +473,7 @@ class RefreshIndicatorState extends State<RefreshIndicator>
|
|||||||
assert(_mode == _RefreshIndicatorMode.drag ||
|
assert(_mode == _RefreshIndicatorMode.drag ||
|
||||||
_mode == _RefreshIndicatorMode.armed);
|
_mode == _RefreshIndicatorMode.armed);
|
||||||
double newValue =
|
double newValue =
|
||||||
_dragOffset! / (containerExtent * _kDragContainerExtentPercentage);
|
_dragOffset! / (containerExtent * kDragContainerExtentPercentage);
|
||||||
if (_mode == _RefreshIndicatorMode.armed) {
|
if (_mode == _RefreshIndicatorMode.armed) {
|
||||||
newValue = math.max(newValue, 1.0 / _kDragSizeFactorLimit);
|
newValue = math.max(newValue, 1.0 / _kDragSizeFactorLimit);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
|
import 'package:PiliPlus/common/widgets/refresh_indicator.dart'
|
||||||
|
show kDragContainerExtentPercentage, displacement;
|
||||||
import 'package:PiliPlus/http/interceptor_anonymity.dart';
|
import 'package:PiliPlus/http/interceptor_anonymity.dart';
|
||||||
import 'package:PiliPlus/models/common/dynamic_badge_mode.dart';
|
import 'package:PiliPlus/models/common/dynamic_badge_mode.dart';
|
||||||
import 'package:PiliPlus/models/common/dynamics_type.dart';
|
import 'package:PiliPlus/models/common/dynamics_type.dart';
|
||||||
@@ -161,7 +163,7 @@ List<SettingsModel> get styleSettings => [
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
GStorage.setting.put(SettingBoxKey.maxRowWidth, result);
|
await GStorage.setting.put(SettingBoxKey.maxRowWidth, result);
|
||||||
SmartDialog.showToast('重启生效');
|
SmartDialog.showToast('重启生效');
|
||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
@@ -208,7 +210,8 @@ List<SettingsModel> get styleSettings => [
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
GStorage.setting.put(SettingBoxKey.upPanelPosition, result.index);
|
await GStorage.setting
|
||||||
|
.put(SettingBoxKey.upPanelPosition, result.index);
|
||||||
SmartDialog.showToast('重启生效');
|
SmartDialog.showToast('重启生效');
|
||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
@@ -238,13 +241,14 @@ List<SettingsModel> get styleSettings => [
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
GStorage.setting.put(SettingBoxKey.dynamicBadgeMode, result.index);
|
|
||||||
MainController mainController = Get.put(MainController());
|
MainController mainController = Get.put(MainController());
|
||||||
mainController.dynamicBadgeMode =
|
mainController.dynamicBadgeMode =
|
||||||
DynamicBadgeMode.values[result.index];
|
DynamicBadgeMode.values[result.index];
|
||||||
if (mainController.dynamicBadgeMode != DynamicBadgeMode.hidden) {
|
if (mainController.dynamicBadgeMode != DynamicBadgeMode.hidden) {
|
||||||
mainController.getUnreadDynamic();
|
mainController.getUnreadDynamic();
|
||||||
}
|
}
|
||||||
|
await GStorage.setting
|
||||||
|
.put(SettingBoxKey.dynamicBadgeMode, result.index);
|
||||||
SmartDialog.showToast('设置成功');
|
SmartDialog.showToast('设置成功');
|
||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
@@ -269,7 +273,6 @@ List<SettingsModel> get styleSettings => [
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
GStorage.setting.put(SettingBoxKey.msgBadgeMode, result.index);
|
|
||||||
MainController mainController = Get.put(MainController());
|
MainController mainController = Get.put(MainController());
|
||||||
mainController.msgBadgeMode = DynamicBadgeMode.values[result.index];
|
mainController.msgBadgeMode = DynamicBadgeMode.values[result.index];
|
||||||
if (mainController.msgBadgeMode != DynamicBadgeMode.hidden) {
|
if (mainController.msgBadgeMode != DynamicBadgeMode.hidden) {
|
||||||
@@ -277,6 +280,8 @@ List<SettingsModel> get styleSettings => [
|
|||||||
} else {
|
} else {
|
||||||
mainController.msgUnReadCount.value = '';
|
mainController.msgUnReadCount.value = '';
|
||||||
}
|
}
|
||||||
|
await GStorage.setting
|
||||||
|
.put(SettingBoxKey.msgBadgeMode, result.index);
|
||||||
SmartDialog.showToast('设置成功');
|
SmartDialog.showToast('设置成功');
|
||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
@@ -301,13 +306,13 @@ List<SettingsModel> get styleSettings => [
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
GStorage.setting.put(SettingBoxKey.msgUnReadTypeV2,
|
|
||||||
result.map((item) => item.index).toList()..sort());
|
|
||||||
MainController mainController = Get.put(MainController());
|
MainController mainController = Get.put(MainController());
|
||||||
mainController.msgUnReadTypes = result;
|
mainController.msgUnReadTypes = result;
|
||||||
if (mainController.msgBadgeMode != DynamicBadgeMode.hidden) {
|
if (mainController.msgBadgeMode != DynamicBadgeMode.hidden) {
|
||||||
mainController.queryUnreadMsg();
|
mainController.queryUnreadMsg();
|
||||||
}
|
}
|
||||||
|
await GStorage.setting.put(SettingBoxKey.msgUnReadTypeV2,
|
||||||
|
result.map((item) => item.index).toList()..sort());
|
||||||
SmartDialog.showToast('设置成功');
|
SmartDialog.showToast('设置成功');
|
||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
@@ -342,9 +347,10 @@ List<SettingsModel> get styleSettings => [
|
|||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
title: '图片质量',
|
title: '图片质量',
|
||||||
initValue: GStorage.picQuality,
|
initValue: GStorage.picQuality,
|
||||||
callback: (picQuality) {
|
callback: (picQuality) async {
|
||||||
GStorage.setting.put(SettingBoxKey.defaultPicQa, picQuality);
|
|
||||||
GlobalData().imgQuality = picQuality;
|
GlobalData().imgQuality = picQuality;
|
||||||
|
await GStorage.setting
|
||||||
|
.put(SettingBoxKey.defaultPicQa, picQuality);
|
||||||
setState();
|
setState();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -368,8 +374,9 @@ List<SettingsModel> get styleSettings => [
|
|||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
title: '查看大图质量',
|
title: '查看大图质量',
|
||||||
initValue: GStorage.previewQ,
|
initValue: GStorage.previewQ,
|
||||||
callback: (picQuality) {
|
callback: (picQuality) async {
|
||||||
GStorage.setting.put(SettingBoxKey.previewQuality, picQuality);
|
await GStorage.setting
|
||||||
|
.put(SettingBoxKey.previewQuality, picQuality);
|
||||||
setState();
|
setState();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -401,8 +408,8 @@ List<SettingsModel> get styleSettings => [
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
|
await GStorage.setting.put(SettingBoxKey.defaultToastOp, result);
|
||||||
SmartDialog.showToast('设置成功');
|
SmartDialog.showToast('设置成功');
|
||||||
GStorage.setting.put(SettingBoxKey.defaultToastOp, result);
|
|
||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -467,7 +474,7 @@ List<SettingsModel> get styleSettings => [
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
GStorage.setting.put(SettingBoxKey.defaultHomePage, result);
|
await GStorage.setting.put(SettingBoxKey.defaultHomePage, result);
|
||||||
SmartDialog.showToast('设置成功,重启生效');
|
SmartDialog.showToast('设置成功,重启生效');
|
||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
@@ -619,7 +626,8 @@ List<SettingsModel> get playSettings => [
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
GStorage.setting.put(SettingBoxKey.subtitlePreference, result);
|
await GStorage.setting
|
||||||
|
.put(SettingBoxKey.subtitlePreference, result);
|
||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -730,7 +738,7 @@ List<SettingsModel> get playSettings => [
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
GStorage.setting.put(SettingBoxKey.fullScreenMode, result);
|
await GStorage.setting.put(SettingBoxKey.fullScreenMode, result);
|
||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -754,7 +762,8 @@ List<SettingsModel> get playSettings => [
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
GStorage.setting.put(SettingBoxKey.btmProgressBehavior, result);
|
await GStorage.setting
|
||||||
|
.put(SettingBoxKey.btmProgressBehavior, result);
|
||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -826,7 +835,7 @@ List<SettingsModel> get videoSettings => [
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
GStorage.setting.put(SettingBoxKey.CDNService, result);
|
await GStorage.setting.put(SettingBoxKey.CDNService, result);
|
||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -867,7 +876,7 @@ List<SettingsModel> get videoSettings => [
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
GStorage.setting.put(SettingBoxKey.defaultVideoQa, result);
|
await GStorage.setting.put(SettingBoxKey.defaultVideoQa, result);
|
||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -892,7 +901,8 @@ List<SettingsModel> get videoSettings => [
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
GStorage.setting.put(SettingBoxKey.defaultVideoQaCellular, result);
|
await GStorage.setting
|
||||||
|
.put(SettingBoxKey.defaultVideoQaCellular, result);
|
||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -917,7 +927,7 @@ List<SettingsModel> get videoSettings => [
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
GStorage.setting.put(SettingBoxKey.defaultAudioQa, result);
|
await GStorage.setting.put(SettingBoxKey.defaultAudioQa, result);
|
||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -942,7 +952,8 @@ List<SettingsModel> get videoSettings => [
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
GStorage.setting.put(SettingBoxKey.defaultAudioQaCellular, result);
|
await GStorage.setting
|
||||||
|
.put(SettingBoxKey.defaultAudioQaCellular, result);
|
||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -966,7 +977,7 @@ List<SettingsModel> get videoSettings => [
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
GStorage.setting.put(SettingBoxKey.defaultDecode, result);
|
await GStorage.setting.put(SettingBoxKey.defaultDecode, result);
|
||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -990,7 +1001,7 @@ List<SettingsModel> get videoSettings => [
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
GStorage.setting.put(SettingBoxKey.secondDecode, result);
|
await GStorage.setting.put(SettingBoxKey.secondDecode, result);
|
||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -1042,7 +1053,7 @@ List<SettingsModel> get videoSettings => [
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
GStorage.setting.put(SettingBoxKey.videoSync, result);
|
await GStorage.setting.put(SettingBoxKey.videoSync, result);
|
||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -1066,7 +1077,7 @@ List<SettingsModel> get videoSettings => [
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
GStorage.setting.put(SettingBoxKey.hardwareDecoding, result);
|
await GStorage.setting.put(SettingBoxKey.hardwareDecoding, result);
|
||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -1098,7 +1109,7 @@ List<SettingsModel> get recommendSettings => [
|
|||||||
SmartDialog.showToast('尚未登录,无法收到个性化推荐');
|
SmartDialog.showToast('尚未登录,无法收到个性化推荐');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GStorage.setting.put(SettingBoxKey.defaultRcmdType, result);
|
await GStorage.setting.put(SettingBoxKey.defaultRcmdType, result);
|
||||||
SmartDialog.showToast('下次启动时生效');
|
SmartDialog.showToast('下次启动时生效');
|
||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
@@ -1168,7 +1179,7 @@ List<SettingsModel> get recommendSettings => [
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
GStorage.setting
|
await GStorage.setting
|
||||||
.put(SettingBoxKey.minLikeRatioForRecommend, result);
|
.put(SettingBoxKey.minLikeRatioForRecommend, result);
|
||||||
RecommendFilter.update();
|
RecommendFilter.update();
|
||||||
setState();
|
setState();
|
||||||
@@ -1215,8 +1226,9 @@ List<SettingsModel> get recommendSettings => [
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
void updateDuration(int value) {
|
void updateDuration(int value) async {
|
||||||
GStorage.setting.put(SettingBoxKey.minDurationForRcmd, value);
|
await GStorage.setting
|
||||||
|
.put(SettingBoxKey.minDurationForRcmd, value);
|
||||||
RecommendFilter.update();
|
RecommendFilter.update();
|
||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
@@ -1652,6 +1664,63 @@ List<SettingsModel> get extraSettings => [
|
|||||||
setKey: SettingBoxKey.openInBrowser,
|
setKey: SettingBoxKey.openInBrowser,
|
||||||
defaultVal: false,
|
defaultVal: false,
|
||||||
),
|
),
|
||||||
|
SettingsModel(
|
||||||
|
settingsType: SettingsType.normal,
|
||||||
|
title: '刷新滑动距离',
|
||||||
|
leading: Icon(Icons.refresh),
|
||||||
|
setKey: SettingBoxKey.refreshDragPercentage,
|
||||||
|
getSubtitle: () => '当前滑动距离: ${GStorage.refreshDragPercentage}x',
|
||||||
|
onTap: (setState) async {
|
||||||
|
double? result = await showDialog(
|
||||||
|
context: Get.context!,
|
||||||
|
builder: (context) {
|
||||||
|
return SlideDialog<double>(
|
||||||
|
title: '刷新滑动距离',
|
||||||
|
min: 0.1,
|
||||||
|
max: 0.5,
|
||||||
|
divisions: 8,
|
||||||
|
precise: 2,
|
||||||
|
value: GStorage.refreshDragPercentage,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (result != null) {
|
||||||
|
kDragContainerExtentPercentage = result;
|
||||||
|
await GStorage.setting
|
||||||
|
.put(SettingBoxKey.refreshDragPercentage, result);
|
||||||
|
Get.forceAppUpdate();
|
||||||
|
setState();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SettingsModel(
|
||||||
|
settingsType: SettingsType.normal,
|
||||||
|
title: '刷新指示器高度',
|
||||||
|
leading: Icon(Icons.height),
|
||||||
|
setKey: SettingBoxKey.refreshDisplacement,
|
||||||
|
getSubtitle: () => '当前指示器高度: ${GStorage.refreshDisplacement}',
|
||||||
|
onTap: (setState) async {
|
||||||
|
double? result = await showDialog(
|
||||||
|
context: Get.context!,
|
||||||
|
builder: (context) {
|
||||||
|
return SlideDialog<double>(
|
||||||
|
title: '刷新指示器高度',
|
||||||
|
min: 10.0,
|
||||||
|
max: 100.0,
|
||||||
|
divisions: 9,
|
||||||
|
value: GStorage.refreshDisplacement,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (result != null) {
|
||||||
|
displacement = result;
|
||||||
|
await GStorage.setting
|
||||||
|
.put(SettingBoxKey.refreshDisplacement, result);
|
||||||
|
Get.forceAppUpdate();
|
||||||
|
setState();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
SettingsModel(
|
SettingsModel(
|
||||||
settingsType: SettingsType.sw1tch,
|
settingsType: SettingsType.sw1tch,
|
||||||
enableFeedback: true,
|
enableFeedback: true,
|
||||||
@@ -1743,7 +1812,7 @@ List<SettingsModel> get extraSettings => [
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
GStorage.setting.put(SettingBoxKey.replySortType, result);
|
await GStorage.setting.put(SettingBoxKey.replySortType, result);
|
||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -1768,7 +1837,8 @@ List<SettingsModel> get extraSettings => [
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
GStorage.setting.put(SettingBoxKey.defaultDynamicType, result);
|
await GStorage.setting
|
||||||
|
.put(SettingBoxKey.defaultDynamicType, result);
|
||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -1792,7 +1862,7 @@ List<SettingsModel> get extraSettings => [
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
GStorage.setting.put(SettingBoxKey.memberTab, result.index);
|
await GStorage.setting.put(SettingBoxKey.memberTab, result.index);
|
||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -1950,10 +2020,7 @@ SettingsModel getBanwordModel({
|
|||||||
child: const Text('保存'),
|
child: const Text('保存'),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
Get.back();
|
Get.back();
|
||||||
await GStorage.setting.put(
|
await GStorage.setting.put(key, banWord);
|
||||||
key,
|
|
||||||
banWord,
|
|
||||||
);
|
|
||||||
setState();
|
setState();
|
||||||
SmartDialog.showToast('已保存');
|
SmartDialog.showToast('已保存');
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
// import 'package:PiliPlus/models/common/theme_type.dart';
|
import 'package:get/get_utils/get_utils.dart';
|
||||||
|
|
||||||
class SlideDialog<T extends num> extends StatefulWidget {
|
class SlideDialog<T extends num> extends StatefulWidget {
|
||||||
final T value;
|
final T value;
|
||||||
@@ -8,6 +8,7 @@ class SlideDialog<T extends num> extends StatefulWidget {
|
|||||||
final double max;
|
final double max;
|
||||||
final int? divisions;
|
final int? divisions;
|
||||||
final String? suffix;
|
final String? suffix;
|
||||||
|
final int precise;
|
||||||
|
|
||||||
const SlideDialog({
|
const SlideDialog({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -17,6 +18,7 @@ class SlideDialog<T extends num> extends StatefulWidget {
|
|||||||
required this.max,
|
required this.max,
|
||||||
this.divisions,
|
this.divisions,
|
||||||
this.suffix,
|
this.suffix,
|
||||||
|
this.precise = 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -47,11 +49,11 @@ class _SlideDialogState<T extends num> extends State<SlideDialog<T>> {
|
|||||||
value: _tempValue,
|
value: _tempValue,
|
||||||
min: widget.min,
|
min: widget.min,
|
||||||
max: widget.max,
|
max: widget.max,
|
||||||
divisions: widget.divisions ?? 10,
|
divisions: widget.divisions,
|
||||||
label: '$_tempValue${widget.suffix ?? ''}',
|
label: '$_tempValue${widget.suffix ?? ''}',
|
||||||
onChanged: (double value) {
|
onChanged: (double value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_tempValue = value;
|
_tempValue = value.toPrecision(widget.precise);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:PiliPlus/common/widgets/pair.dart';
|
import 'package:PiliPlus/common/widgets/pair.dart';
|
||||||
|
import 'package:PiliPlus/common/widgets/refresh_indicator.dart'
|
||||||
|
show kDragContainerExtentPercentage, displacement;
|
||||||
import 'package:PiliPlus/http/constants.dart';
|
import 'package:PiliPlus/http/constants.dart';
|
||||||
import 'package:PiliPlus/models/common/dynamic_badge_mode.dart';
|
import 'package:PiliPlus/models/common/dynamic_badge_mode.dart';
|
||||||
import 'package:PiliPlus/models/common/tab_type.dart';
|
import 'package:PiliPlus/models/common/tab_type.dart';
|
||||||
@@ -212,6 +214,12 @@ class GStorage {
|
|||||||
static double get blockLimit =>
|
static double get blockLimit =>
|
||||||
setting.get(SettingBoxKey.blockLimit, defaultValue: 0.0);
|
setting.get(SettingBoxKey.blockLimit, defaultValue: 0.0);
|
||||||
|
|
||||||
|
static double get refreshDragPercentage =>
|
||||||
|
setting.get(SettingBoxKey.refreshDragPercentage, defaultValue: 0.25);
|
||||||
|
|
||||||
|
static double get refreshDisplacement =>
|
||||||
|
setting.get(SettingBoxKey.refreshDisplacement, defaultValue: 40.0);
|
||||||
|
|
||||||
static String get blockUserID {
|
static String get blockUserID {
|
||||||
String blockUserID =
|
String blockUserID =
|
||||||
setting.get(SettingBoxKey.blockUserID, defaultValue: '');
|
setting.get(SettingBoxKey.blockUserID, defaultValue: '');
|
||||||
@@ -390,6 +398,8 @@ class GStorage {
|
|||||||
);
|
);
|
||||||
// 视频设置
|
// 视频设置
|
||||||
video = await Hive.openBox('video');
|
video = await Hive.openBox('video');
|
||||||
|
displacement = GStorage.refreshDisplacement;
|
||||||
|
kDragContainerExtentPercentage = GStorage.refreshDragPercentage;
|
||||||
// 设置全局变量
|
// 设置全局变量
|
||||||
GlobalData()
|
GlobalData()
|
||||||
..imgQuality = defaultPicQa
|
..imgQuality = defaultPicQa
|
||||||
@@ -538,6 +548,8 @@ class SettingBoxKey {
|
|||||||
banWordForZone = 'banWordForZone',
|
banWordForZone = 'banWordForZone',
|
||||||
savedRcmdTip = 'savedRcmdTip',
|
savedRcmdTip = 'savedRcmdTip',
|
||||||
openInBrowser = 'openInBrowser',
|
openInBrowser = 'openInBrowser',
|
||||||
|
refreshDragPercentage = 'refreshDragPercentage',
|
||||||
|
refreshDisplacement = 'refreshDisplacement',
|
||||||
|
|
||||||
// Sponsor Block
|
// Sponsor Block
|
||||||
enableSponsorBlock = 'enableSponsorBlock',
|
enableSponsorBlock = 'enableSponsorBlock',
|
||||||
|
|||||||
Reference in New Issue
Block a user