mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-02 00:58:19 +08:00
opt SpringDescription
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -5,7 +5,9 @@ Widget videoTabBarView({
|
|||||||
required List<Widget> children,
|
required List<Widget> children,
|
||||||
TabController? controller,
|
TabController? controller,
|
||||||
}) => TabBarView(
|
}) => TabBarView(
|
||||||
physics: const CustomTabBarViewClampingScrollPhysics(),
|
physics: const CustomTabBarViewScrollPhysics(
|
||||||
|
parent: ClampingScrollPhysics(),
|
||||||
|
),
|
||||||
controller: controller,
|
controller: controller,
|
||||||
children: children,
|
children: children,
|
||||||
);
|
);
|
||||||
@@ -19,6 +21,15 @@ Widget tabBarView({
|
|||||||
children: children,
|
children: children,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
SpringDescription _customSpringDescription() {
|
||||||
|
final List<double> springDescription = Pref.springDescription;
|
||||||
|
return SpringDescription(
|
||||||
|
mass: springDescription[0],
|
||||||
|
stiffness: springDescription[1],
|
||||||
|
damping: springDescription[2],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
class CustomTabBarViewScrollPhysics extends ScrollPhysics {
|
class CustomTabBarViewScrollPhysics extends ScrollPhysics {
|
||||||
const CustomTabBarViewScrollPhysics({super.parent});
|
const CustomTabBarViewScrollPhysics({super.parent});
|
||||||
|
|
||||||
@@ -27,20 +38,10 @@ class CustomTabBarViewScrollPhysics extends ScrollPhysics {
|
|||||||
return CustomTabBarViewScrollPhysics(parent: buildParent(ancestor));
|
return CustomTabBarViewScrollPhysics(parent: buildParent(ancestor));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
static final _springDescription = _customSpringDescription();
|
||||||
SpringDescription get spring => CustomSpringDescription();
|
|
||||||
}
|
|
||||||
|
|
||||||
class CustomTabBarViewClampingScrollPhysics extends ClampingScrollPhysics {
|
|
||||||
const CustomTabBarViewClampingScrollPhysics({super.parent});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
CustomTabBarViewClampingScrollPhysics applyTo(ScrollPhysics? ancestor) {
|
SpringDescription get spring => _springDescription;
|
||||||
return CustomTabBarViewClampingScrollPhysics(parent: buildParent(ancestor));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
SpringDescription get spring => CustomSpringDescription();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mixin ReloadMixin {
|
mixin ReloadMixin {
|
||||||
@@ -79,30 +80,3 @@ class ReloadScrollPhysics extends AlwaysScrollableScrollPhysics {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class CustomSpringDescription implements SpringDescription {
|
|
||||||
static final List<double> springDescription = Pref.springDescription;
|
|
||||||
|
|
||||||
@override
|
|
||||||
final mass = springDescription[0];
|
|
||||||
|
|
||||||
@override
|
|
||||||
final stiffness = springDescription[1];
|
|
||||||
|
|
||||||
@override
|
|
||||||
final damping = springDescription[2];
|
|
||||||
|
|
||||||
CustomSpringDescription._();
|
|
||||||
|
|
||||||
static final _instance = CustomSpringDescription._();
|
|
||||||
|
|
||||||
factory CustomSpringDescription() => _instance;
|
|
||||||
|
|
||||||
/// Defaults to 0.
|
|
||||||
@override
|
|
||||||
double bounce = 0.0;
|
|
||||||
|
|
||||||
/// Defaults to 0.5 seconds.
|
|
||||||
@override
|
|
||||||
Duration duration = const Duration(milliseconds: 500);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -316,7 +316,10 @@ abstract final class MemberHttp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Future memberStat({int? mid}) async {
|
static Future memberStat({int? mid}) async {
|
||||||
final res = await Request().get(Api.userStat, queryParameters: {'vmid': mid});
|
final res = await Request().get(
|
||||||
|
Api.userStat,
|
||||||
|
queryParameters: {'vmid': mid},
|
||||||
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {'status': true, 'data': res.data['data']};
|
return {'status': true, 'data': res.data['data']};
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -22,7 +22,10 @@ import 'package:dio/dio.dart';
|
|||||||
|
|
||||||
abstract final class UserHttp {
|
abstract final class UserHttp {
|
||||||
static Future<dynamic> userStat({required int mid}) async {
|
static Future<dynamic> userStat({required int mid}) async {
|
||||||
final res = await Request().get(Api.userStat, queryParameters: {'vmid': mid});
|
final res = await Request().get(
|
||||||
|
Api.userStat,
|
||||||
|
queryParameters: {'vmid': mid},
|
||||||
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {'status': true, 'data': res.data['data']};
|
return {'status': true, 'data': res.data['data']};
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -718,7 +718,9 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
|||||||
? PageView(
|
? PageView(
|
||||||
key: pageKey,
|
key: pageKey,
|
||||||
controller: _liveRoomController.pageController,
|
controller: _liveRoomController.pageController,
|
||||||
physics: const CustomTabBarViewClampingScrollPhysics(),
|
physics: const CustomTabBarViewScrollPhysics(
|
||||||
|
parent: ClampingScrollPhysics(),
|
||||||
|
),
|
||||||
onPageChanged: (value) =>
|
onPageChanged: (value) =>
|
||||||
_liveRoomController.pageIndex.value = value,
|
_liveRoomController.pageIndex.value = value,
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import 'package:PiliPlus/common/widgets/color_palette.dart';
|
|||||||
import 'package:PiliPlus/common/widgets/custom_toast.dart';
|
import 'package:PiliPlus/common/widgets/custom_toast.dart';
|
||||||
import 'package:PiliPlus/common/widgets/dialog/dialog.dart';
|
import 'package:PiliPlus/common/widgets/dialog/dialog.dart';
|
||||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||||
import 'package:PiliPlus/common/widgets/scroll_physics.dart';
|
|
||||||
import 'package:PiliPlus/main.dart';
|
import 'package:PiliPlus/main.dart';
|
||||||
import 'package:PiliPlus/models/common/dynamic/dynamic_badge_mode.dart';
|
import 'package:PiliPlus/models/common/dynamic/dynamic_badge_mode.dart';
|
||||||
import 'package:PiliPlus/models/common/dynamic/up_panel_position.dart';
|
import 'package:PiliPlus/models/common/dynamic/up_panel_position.dart';
|
||||||
@@ -623,7 +622,7 @@ List<SettingsModel> get styleSettings => [
|
|||||||
title: '滑动动画弹簧参数',
|
title: '滑动动画弹簧参数',
|
||||||
leading: const Icon(Icons.chrome_reader_mode_outlined),
|
leading: const Icon(Icons.chrome_reader_mode_outlined),
|
||||||
onTap: (context, setState) {
|
onTap: (context, setState) {
|
||||||
List<String> springDescription = CustomSpringDescription.springDescription
|
final List<String> springDescription = Pref.springDescription
|
||||||
.map((i) => i.toString())
|
.map((i) => i.toString())
|
||||||
.toList();
|
.toList();
|
||||||
showDialog(
|
showDialog(
|
||||||
@@ -641,9 +640,7 @@ List<SettingsModel> get styleSettings => [
|
|||||||
keyboardType: const TextInputType.numberWithOptions(
|
keyboardType: const TextInputType.numberWithOptions(
|
||||||
decimal: true,
|
decimal: true,
|
||||||
),
|
),
|
||||||
onChanged: (value) {
|
onChanged: (value) => springDescription[index] = value,
|
||||||
springDescription[index] = value;
|
|
||||||
},
|
|
||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
FilteringTextInputFormatter.allow(RegExp(r'[\d\.]+')),
|
FilteringTextInputFormatter.allow(RegExp(r'[\d\.]+')),
|
||||||
],
|
],
|
||||||
@@ -654,6 +651,14 @@ List<SettingsModel> get styleSettings => [
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
GStorage.setting.delete(SettingBoxKey.springDescription);
|
||||||
|
SmartDialog.showToast('重置成功,重启生效');
|
||||||
|
},
|
||||||
|
child: const Text('重置'),
|
||||||
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: Get.back,
|
onPressed: Get.back,
|
||||||
child: Text(
|
child: Text(
|
||||||
@@ -664,19 +669,15 @@ List<SettingsModel> get styleSettings => [
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () async {
|
onPressed: () {
|
||||||
|
try {
|
||||||
|
final res = springDescription.map(double.parse).toList();
|
||||||
Get.back();
|
Get.back();
|
||||||
await GStorage.setting.put(
|
GStorage.setting.put(SettingBoxKey.springDescription, res);
|
||||||
SettingBoxKey.springDescription,
|
|
||||||
List<double>.generate(
|
|
||||||
3,
|
|
||||||
(i) =>
|
|
||||||
double.tryParse(springDescription[i]) ??
|
|
||||||
CustomSpringDescription.springDescription[i],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
SmartDialog.showToast('设置成功,重启生效');
|
SmartDialog.showToast('设置成功,重启生效');
|
||||||
setState();
|
} catch (e) {
|
||||||
|
SmartDialog.showToast(e.toString());
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: const Text('确定'),
|
child: const Text('确定'),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -376,7 +376,8 @@ List<SettingsModel> get videoSettings => [
|
|||||||
title: '硬解模式',
|
title: '硬解模式',
|
||||||
initValues: Pref.hardwareDecoding.split(','),
|
initValues: Pref.hardwareDecoding.split(','),
|
||||||
values: {
|
values: {
|
||||||
for (final e in HwDecType.values) e.hwdec: '${e.hwdec}\n${e.desc}',
|
for (final e in HwDecType.values)
|
||||||
|
e.hwdec: '${e.hwdec}\n${e.desc}',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -218,7 +218,9 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
return MultiSelectDialog<LoginAccount>(
|
return MultiSelectDialog<LoginAccount>(
|
||||||
title: '选择要登出的账号uid',
|
title: '选择要登出的账号uid',
|
||||||
initValues: const Iterable.empty(),
|
initValues: const Iterable.empty(),
|
||||||
values: {for (final i in Accounts.account.values) i: i.mid.toString()},
|
values: {
|
||||||
|
for (final i in Accounts.account.values) i: i.mid.toString(),
|
||||||
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user