opt: spring

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-02-22 19:57:41 +08:00
parent b2c520bd91
commit 9ebc054c8c
15 changed files with 78 additions and 69 deletions

View File

@@ -162,8 +162,7 @@ class _BangumiPageState extends State<BangumiPage>
.map((title) => Tab(text: title))
.toList()),
Expanded(
child: TabBarView(
physics: customTabBarViewScrollPhysics,
child: tabBarView(
children: types
.map((type) =>
PgcIndexPage(indexType: type))

View File

@@ -142,8 +142,7 @@ class _DanmakuBlockPageState extends State<DanmakuBlockPage> {
'${ruleLabels[i]}(${_danmakuBlockController.ruleTypes[i]!.length})')),
]),
),
body: TabBarView(
physics: customTabBarViewScrollPhysics,
body: tabBarView(
controller: _danmakuBlockController.tabController,
children: [
for (var i = 0; i < ruleLabels.length; i++)

View File

@@ -183,8 +183,7 @@ class _DynamicsPageState extends State<DynamicsPage>
body: Row(children: [
if (upPanelPosition == UpPanelPosition.leftFixed) upPanelPart(),
Expanded(
child: TabBarView(
physics: customTabBarViewScrollPhysics,
child: tabBarView(
controller: _dynamicsController.tabController,
children: _dynamicsController.tabsPageList,
)),

View File

@@ -36,8 +36,7 @@ class _EmotePanelState extends State<EmotePanel>
? Column(
children: [
Expanded(
child: TabBarView(
physics: customTabBarViewScrollPhysics,
child: tabBarView(
controller: _emotePanelController.tabController,
children: (loadingState.response as List<Packages>).map(
(e) {

View File

@@ -83,8 +83,7 @@ class _FollowPageState extends State<FollowPage> {
]
]),
Expanded(
child: TabBarView(
physics: customTabBarViewScrollPhysics,
child: tabBarView(
controller: _followController.tabController,
children: [
for (var i = 0;

View File

@@ -73,8 +73,7 @@ class _HomePageState extends State<HomePage>
] else
const SizedBox(height: 6),
Expanded(
child: TabBarView(
physics: customTabBarViewScrollPhysics,
child: tabBarView(
controller: _homeController.tabController,
children: _homeController.tabsPageList,
),

View File

@@ -1,6 +1,7 @@
import 'dart:ui';
import 'package:PiliPlus/common/constants.dart';
import 'package:PiliPlus/common/widgets/spring_physics.dart';
import 'package:PiliPlus/utils/utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
@@ -538,8 +539,7 @@ class _LoginPageState extends State<LoginPage> {
}
return true;
},
child: TabBarView(
physics: const AlwaysScrollableScrollPhysics(),
child: tabBarView(
controller: _loginPageCtr.tabController,
children: [
tabViewOuter(loginByPassword()),

View File

@@ -151,8 +151,7 @@ class _MemberPageNewState extends State<MemberPageNew>
Widget get _buildBody => SafeArea(
top: false,
bottom: false,
child: TabBarView(
physics: customTabBarViewScrollPhysics,
child: tabBarView(
controller: _userController.tabController,
children: _userController.tab2!.map((item) {
return switch (item.param!) {

View File

@@ -69,8 +69,7 @@ class _MemberSearchPageState extends State<MemberSearchPage> {
),
),
Expanded(
child: TabBarView(
physics: customTabBarViewScrollPhysics,
child: tabBarView(
controller: _memberSearchCtr.tabController,
children: [
SearchArchive(ctr: _memberSearchCtr),

View File

@@ -119,8 +119,7 @@ class _SearchResultPageState extends State<SearchResultPage>
),
),
Expanded(
child: TabBarView(
physics: customTabBarViewScrollPhysics,
child: tabBarView(
controller: _tabController,
children: SearchType.values
.map(

View File

@@ -542,7 +542,8 @@ List<SettingsModel> get styleSettings => [
leading: const Icon(Icons.chrome_reader_mode_outlined),
onTap: (setState) {
final numberRegExp = RegExp(r'[\d\.]+');
List springDescription = GStorage.springDescription.map((i) => i.toString()).toList();
List springDescription =
GStorage.springDescription.map((i) => i.toString()).toList();
showDialog(
context: Get.context!,
builder: (context) {
@@ -550,32 +551,28 @@ List<SettingsModel> get styleSettings => [
title: const Text('弹簧参数'),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
TextFormField(
autofocus: true,
initialValue: springDescription[0],
keyboardType: TextInputType.numberWithOptions(),
onChanged: (value) { springDescription[0] = value; },
inputFormatters: [FilteringTextInputFormatter.allow(numberRegExp)],
decoration: InputDecoration(labelText: 'mass'),
children: List.generate(
3,
(index) => TextFormField(
autofocus: index == 0,
initialValue: springDescription[index],
keyboardType:
TextInputType.numberWithOptions(decimal: true),
onChanged: (value) {
springDescription[index] = value;
},
inputFormatters: [
FilteringTextInputFormatter.allow(numberRegExp)
],
decoration: InputDecoration(
labelText: const [
'mass',
'stiffness',
'damping'
][index],
),
),
TextFormField(
autofocus: true,
initialValue: springDescription[1],
keyboardType: TextInputType.numberWithOptions(),
onChanged: (value) { springDescription[1] = value; },
inputFormatters: [FilteringTextInputFormatter.allow(numberRegExp)],
decoration: InputDecoration(labelText: 'stiffness'),
),
TextFormField(
autofocus: true,
initialValue: springDescription[2],
keyboardType: TextInputType.numberWithOptions(),
onChanged: (value) { springDescription[2] = value; },
inputFormatters: [FilteringTextInputFormatter.allow(numberRegExp)],
decoration: InputDecoration(labelText: 'damping'),
)
]
),
),
actions: [
TextButton(
@@ -590,9 +587,15 @@ List<SettingsModel> get styleSettings => [
TextButton(
onPressed: () async {
Get.back();
late final spring = GStorage.springDescription;
await GStorage.setting.put(
SettingBoxKey.springDescription,
List<double>.generate(3, (i) => double.tryParse(springDescription[i]) ?? GStorage.springDescription[i]),
List<double>.generate(
3,
(i) =>
double.tryParse(springDescription[i]) ??
spring[i],
),
);
SmartDialog.showToast('设置成功,重启生效');
setState();

View File

@@ -621,8 +621,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
showReply: videoDetailController.showReply,
),
Expanded(
child: TabBarView(
physics: customTabBarViewScrollPhysics,
child: tabBarView(
controller: videoDetailController.tabCtr,
children: [
videoIntro(),
@@ -672,8 +671,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
children: [
buildTabbar(showReply: videoDetailController.showReply),
Expanded(
child: TabBarView(
physics: customTabBarViewScrollPhysics,
child: tabBarView(
controller: videoDetailController.tabCtr,
children: [
videoIntro(),
@@ -772,8 +770,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
showReply: videoDetailController.showReply,
),
Expanded(
child: TabBarView(
physics: customTabBarViewScrollPhysics,
child: tabBarView(
controller: videoDetailController.tabCtr,
children: [
if (videoDetailController.showReply)
@@ -882,8 +879,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
showReply: videoDetailController.showReply,
),
Expanded(
child: TabBarView(
physics: customTabBarViewScrollPhysics,
child: tabBarView(
controller: videoDetailController.tabCtr,
children: [
if (videoDetailController.videoType ==