fix(recommend): 修正进度拖动与底栏联动

This commit is contained in:
Zhou Weidong committed 2026-10-22 20:15:07 +08:00
1 parent afe7a49ef0
commit 2765343340
9 files changed
+79 -107

No files matched your search

+2 -21
View File
@@ -28,14 +28,12 @@ class RecommendPage extends StatefulWidget {
required this.active,
required this.onSearch,
required this.onOpenFilter,
required this.onScrubVisibilityChanged,
});
final HomeFeedController feedController;
final bool active;
final VoidCallback onSearch;
final VoidCallback onOpenFilter;
final ValueChanged<bool> onScrubVisibilityChanged;
@override
State<RecommendPage> createState() => _RecommendPageState();
@@ -43,7 +41,6 @@ class RecommendPage extends StatefulWidget {
class _RecommendPageState extends State<RecommendPage> {
RecommendInnerTab _tab = RecommendInnerTab.feed;
bool _scrubbing = false;
int _scrubCancelRequest = 0;
@override
@@ -159,38 +156,22 @@ class _RecommendPageState extends State<RecommendPage> {
_openDrama(drama, episodeId: episode.id),
onRefreshFeed: widget.feedController.refreshCurrent,
onLoadMore: widget.feedController.loadMore,
onScrubVisibilityChanged: _setScrubbing,
scrubCancelRequest: _scrubCancelRequest,
);
}
void _selectTab(RecommendInnerTab tab) {
final wasScrubbing = _scrubbing;
setState(() {
_tab = tab;
if (wasScrubbing) _scrubCancelRequest++;
_scrubbing = false;
_scrubCancelRequest++;
});
if (wasScrubbing) widget.onScrubVisibilityChanged(false);
}
void _handleSearch() {
if (_scrubbing) {
setState(() {
_scrubbing = false;
_scrubCancelRequest++;
});
widget.onScrubVisibilityChanged(false);
}
setState(() => _scrubCancelRequest++);
widget.onSearch();
}
void _setScrubbing(bool value) {
if (_scrubbing == value) return;
setState(() => _scrubbing = value);
widget.onScrubVisibilityChanged(value);
}
Widget _withTopNavSpace(Widget child) {
return SafeArea(
bottom: false,