feat: scroll spring in history & fav (#645)

This commit is contained in:
My-Responsitories
2025-04-09 13:16:29 +08:00
committed by GitHub
parent a7eebcc209
commit d3cbc95235
4 changed files with 35 additions and 30 deletions

View File

@@ -1,3 +1,4 @@
import 'package:PiliPlus/common/widgets/scroll_physics.dart';
import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/pages/fav/article/view.dart';
import 'package:PiliPlus/pages/fav/note/view.dart';
@@ -10,7 +11,15 @@ import 'package:get/get.dart';
enum _FavType { video, bangumi, cinema, article, note }
extension _FavTypeExt on _FavType {
String get title => ['视频', '追番', '追剧', '专栏', '笔记'][index];
String get title => const ['视频', '追番', '追剧', '专栏', '笔记'][index];
Widget get page => switch (this) {
_FavType.video => const FavVideoPage(),
_FavType.bangumi => const FavPgcPage(type: 1),
_FavType.cinema => const FavPgcPage(type: 2),
_FavType.article => const FavArticlePage(),
_FavType.note => const FavNotePage(),
};
}
class FavPage extends StatefulWidget {
@@ -83,26 +92,12 @@ class _FavPageState extends State<FavPage> with SingleTickerProviderStateMixin {
],
bottom: TabBar(
controller: _tabController,
tabs: _FavType.values
.map(
(item) => Tab(text: item.title),
)
.toList(),
tabs: _FavType.values.map((item) => Tab(text: item.title)).toList(),
),
),
body: TabBarView(
body: tabBarView(
controller: _tabController,
children: _FavType.values
.map(
(item) => switch (item) {
_FavType.video => const FavVideoPage(),
_FavType.bangumi => const FavPgcPage(type: 1),
_FavType.cinema => const FavPgcPage(type: 2),
_FavType.article => const FavArticlePage(),
_FavType.note => const FavNotePage(),
},
)
.toList(),
children: _FavType.values.map((item) => item.page).toList(),
),
);
}