mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: scroll spring in history & fav (#645)
This commit is contained in:
committed by
GitHub
parent
a7eebcc209
commit
d3cbc95235
@@ -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(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:PiliPlus/common/widgets/http_error.dart';
|
||||
import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
|
||||
import 'package:PiliPlus/common/widgets/scroll_physics.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/pages/fav_search/view.dart' show SearchType;
|
||||
import 'package:PiliPlus/pages/history/base_controller.dart';
|
||||
@@ -227,7 +228,7 @@ class _HistoryPageState extends State<HistoryPage>
|
||||
child: TabBarView(
|
||||
physics: enableMultiSelect
|
||||
? const NeverScrollableScrollPhysics()
|
||||
: null,
|
||||
: const CustomTabBarViewScrollPhysics(),
|
||||
controller: _historyController.tabController,
|
||||
children: [
|
||||
_buildPage,
|
||||
|
||||
@@ -2583,7 +2583,7 @@ SettingsModel _getVideoFilterSelectModel({
|
||||
value = result!;
|
||||
await GStorage.setting.put(key, result);
|
||||
setState();
|
||||
RecommendFilter.update();
|
||||
if (isFilter) RecommendFilter.update();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user