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

@@ -423,8 +423,7 @@ class _ListSheetContentState extends State<ListSheetContent>
child: _isList
? Material(
color: Colors.transparent,
child: TabBarView(
physics: customTabBarViewScrollPhysics,
child: tabBarView(
controller: _ctr,
children: List.generate(
widget.season.sections.length,

View File

@@ -1,5 +1,15 @@
import 'package:flutter/cupertino.dart';
import 'package:PiliPlus/utils/storage.dart';
import 'package:flutter/material.dart';
Widget tabBarView({
required List<Widget> children,
TabController? controller,
}) =>
TabBarView(
physics: customTabBarViewScrollPhysics,
controller: controller,
children: children,
);
class CustomTabBarViewScrollPhysics extends ScrollPhysics {
CustomTabBarViewScrollPhysics({super.parent});
@@ -9,12 +19,14 @@ class CustomTabBarViewScrollPhysics extends ScrollPhysics {
return CustomTabBarViewScrollPhysics(parent: buildParent(ancestor)!);
}
final springDescription = GStorage.springDescription;
@override
SpringDescription spring = SpringDescription(
mass: GStorage.springDescription[0],
stiffness: GStorage.springDescription[1],
damping: GStorage.springDescription[2]
);
SpringDescription get spring => SpringDescription(
mass: springDescription[0],
stiffness: springDescription[1],
damping: springDescription[2],
);
}
final customTabBarViewScrollPhysics = CustomTabBarViewScrollPhysics();
final customTabBarViewScrollPhysics = CustomTabBarViewScrollPhysics();