feat: 统一首页与推荐搜索入口
This commit is contained in:
1 parent
933333b0fe
commit
9aa797504b
18 files changed
+325
-107
No files matched your search
@@ -56,14 +56,10 @@ class DiscoverPage extends StatefulWidget {
|
||||
const DiscoverPage({
|
||||
super.key,
|
||||
this.active = true,
|
||||
this.searchRequest = 0,
|
||||
this.focusSearch = false,
|
||||
this.callbacks = const DiscoverPageCallbacks(),
|
||||
});
|
||||
|
||||
final bool active;
|
||||
final int searchRequest;
|
||||
final bool focusSearch;
|
||||
final DiscoverPageCallbacks callbacks;
|
||||
|
||||
@override
|
||||
@@ -89,7 +85,6 @@ class _DiscoverPageState extends State<DiscoverPage> {
|
||||
logic.scroll.addListener(_onScroll);
|
||||
theater.addListener(_onTheaterChanged);
|
||||
unawaited(theater.select(null));
|
||||
if (widget.focusSearch) _focusOnFirstFrame();
|
||||
}
|
||||
|
||||
void _onScroll() {
|
||||
@@ -106,23 +101,6 @@ class _DiscoverPageState extends State<DiscoverPage> {
|
||||
if (mounted) setState(() {});
|
||||
}
|
||||
|
||||
void _focusOnFirstFrame() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted && widget.active) logic.openSearch();
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant DiscoverPage oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
logic.syncSearch(
|
||||
active: widget.active,
|
||||
request: widget.searchRequest,
|
||||
previousRequest: oldWidget.searchRequest,
|
||||
isActive: () => mounted && widget.active,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
logic.scroll.removeListener(_onScroll);
|
||||
|
||||
Reference in new issue
Block a user