implemented find in page

This commit is contained in:
Fabian Freund
2024-08-14 11:43:41 +02:00
parent 1dd37f44b6
commit 60ad009bb0
6 changed files with 153 additions and 2 deletions
@@ -125,3 +125,15 @@ class ActiveChatModel extends _$ActiveChatModel {
return ChatModel.gpt4o;
}
}
@Riverpod(keepAlive: true)
class ShowFindInPage extends _$ShowFindInPage {
void update(bool show) {
state = show;
}
@override
bool build() {
return false;
}
}
@@ -396,5 +396,20 @@ final activeChatModelProvider =
);
typedef _$ActiveChatModel = Notifier<ChatModel>;
String _$showFindInPageHash() => r'7ee5703f7d0c7e8a8dd6b0849d7b1e0a41fe24d9';
/// See also [ShowFindInPage].
@ProviderFor(ShowFindInPage)
final showFindInPageProvider = NotifierProvider<ShowFindInPage, bool>.internal(
ShowFindInPage.new,
name: r'showFindInPageProvider',
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$showFindInPageHash,
dependencies: null,
allTransitiveDependencies: null,
);
typedef _$ShowFindInPage = Notifier<bool>;
// ignore_for_file: type=lint
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member
@@ -434,6 +434,14 @@ class KagiScreen extends HookConsumerWidget {
child: const Text('Share'),
),
const Divider(),
MenuItemButton(
onPressed: () async {
ref.read(showFindInPageProvider.notifier).update(true);
},
leadingIcon: const Icon(Icons.search),
child: const Text('Find in page'),
),
const Divider(),
MenuItemButton(
onPressed: () async {
await activeWebView?.currentController?.reload();