dont override text in find in page
This commit is contained in:
@@ -598,7 +598,7 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
if (tabId == null) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return FindInPageWidget(tabId: tabId);
|
||||
return FindInPageWidget(key: ValueKey(tabId), tabId: tabId);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
+5
-14
@@ -31,7 +31,11 @@ class FindInPageWidget extends HookConsumerWidget {
|
||||
/// The height of the find-in-page widget.
|
||||
static const findInPageHeight = 56.0;
|
||||
|
||||
const FindInPageWidget({required this.tabId, this.padding = EdgeInsets.zero});
|
||||
const FindInPageWidget({
|
||||
required this.tabId,
|
||||
this.padding = EdgeInsets.zero,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@@ -45,19 +49,6 @@ class FindInPageWidget extends HookConsumerWidget {
|
||||
text: searchResult?.lastSearchText ?? findInPageState.lastSearchText,
|
||||
);
|
||||
|
||||
// Update controller text when search result changes from external sources
|
||||
// (e.g., when navigating between matches)
|
||||
useEffect(() {
|
||||
final currentText = textController.text;
|
||||
final newText =
|
||||
searchResult?.lastSearchText ?? findInPageState.lastSearchText ?? '';
|
||||
|
||||
if (currentText != newText) {
|
||||
textController.text = newText;
|
||||
}
|
||||
return null;
|
||||
}, [searchResult?.lastSearchText, findInPageState.lastSearchText]);
|
||||
|
||||
// Create debouncer with automatic disposal
|
||||
final debouncer = useDebouncer(const Duration(milliseconds: 300));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user