iosWebViewFix/flutter_inappwebview/lib/src/find_interaction/find_interaction_controller...

69 lines
3.6 KiB
Dart
Raw Normal View History

2023-11-17 22:28:11 +00:00
import 'package:flutter_inappwebview_platform_interface/flutter_inappwebview_platform_interface.dart';
2022-10-08 12:19:35 +00:00
2023-11-24 16:56:57 +00:00
///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController}
2023-11-17 22:28:11 +00:00
class FindInteractionController {
2023-11-24 16:56:57 +00:00
///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController}
2023-11-17 22:28:11 +00:00
FindInteractionController(
{void Function(PlatformFindInteractionController controller,
int activeMatchOrdinal, int numberOfMatches, bool isDoneCounting)?
onFindResultReceived})
: this.fromPlatformCreationParams(
params: PlatformFindInteractionControllerCreationParams(
onFindResultReceived: onFindResultReceived));
/// Constructs a [FindInteractionController].
2022-10-08 12:19:35 +00:00
///
2023-11-17 22:28:11 +00:00
/// See [FindInteractionController.fromPlatformCreationParams] for setting parameters for
/// a specific platform.
FindInteractionController.fromPlatformCreationParams({
required PlatformFindInteractionControllerCreationParams params,
}) : this.fromPlatform(platform: PlatformFindInteractionController(params));
/// Constructs a [FindInteractionController] from a specific platform implementation.
FindInteractionController.fromPlatform({required this.platform});
/// Implementation of [PlatformFindInteractionController] for the current platform.
final PlatformFindInteractionController platform;
///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.onFindResultReceived}
void Function(PlatformFindInteractionController controller,
int activeMatchOrdinal, int numberOfMatches, bool isDoneCounting)?
get onFindResultReceived => platform.onFindResultReceived;
2022-10-08 12:19:35 +00:00
2023-11-24 16:56:57 +00:00
///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.findAll}
2023-11-17 22:28:11 +00:00
Future<void> findAll({String? find}) => platform.findAll(find: find);
2022-10-08 12:19:35 +00:00
2023-11-24 16:56:57 +00:00
///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.findNext}
2023-11-17 22:28:11 +00:00
Future<void> findNext({bool forward = true}) =>
platform.findNext(forward: forward);
2022-10-08 12:19:35 +00:00
2023-11-24 16:56:57 +00:00
///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.clearMatches}
2023-11-17 22:28:11 +00:00
Future<void> clearMatches() => platform.clearMatches();
2022-10-08 12:19:35 +00:00
2023-11-24 16:56:57 +00:00
///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.setSearchText}
2023-11-17 22:28:11 +00:00
Future<void> setSearchText(String? searchText) =>
platform.setSearchText(searchText);
2022-10-08 12:19:35 +00:00
2023-11-24 16:56:57 +00:00
///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.getSearchText}
2023-11-17 22:28:11 +00:00
Future<String?> getSearchText() => platform.getSearchText();
2022-10-08 12:19:35 +00:00
2023-11-24 16:56:57 +00:00
///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.isFindNavigatorVisible}
2023-11-17 22:28:11 +00:00
Future<bool?> isFindNavigatorVisible() => platform.isFindNavigatorVisible();
2022-10-08 12:19:35 +00:00
2023-11-24 16:56:57 +00:00
///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.updateResultCount}
2023-11-17 22:28:11 +00:00
Future<void> updateResultCount() => platform.updateResultCount();
2022-10-08 12:19:35 +00:00
2023-11-24 16:56:57 +00:00
///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.presentFindNavigator}
2023-11-17 22:28:11 +00:00
Future<void> presentFindNavigator() => platform.presentFindNavigator();
2022-10-08 12:19:35 +00:00
2023-11-24 16:56:57 +00:00
///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.dismissFindNavigator}
2023-11-17 22:28:11 +00:00
Future<void> dismissFindNavigator() => platform.dismissFindNavigator();
2022-10-08 12:19:35 +00:00
2023-11-24 16:56:57 +00:00
///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.getActiveFindSession}
2023-11-17 22:28:11 +00:00
Future<FindSession?> getActiveFindSession() =>
platform.getActiveFindSession();
2023-11-24 16:56:57 +00:00
///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.dispose}
2023-11-17 22:28:11 +00:00
void dispose({bool isKeepAlive = false}) => platform.dispose();
}