Use the Fintoc widget within your Flutter application as a View.
Install using flutter
flutter pub add fintoc
Install using dart
dart pub add fintoc
This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):
dependencies:
fintoc: ^1.0.0
Fintoc Flutter
exports a component called FintocWidgetView
. This is a Flutter component that creates the same WebView from the native WebView documentation. To use the Fintoc Flutter
, use the following snippet:
import 'package:fintoc/fintoc.dart';
After retrieving the FintocWidgetView
component, you are ready to instantiate the widget:
final options = { ... };
final handlers = { ... };
void onSuccess(String data) {
debugPrint('onSucess from FintocWidgetView: $data');
}
void onExit(String data) {
debugPrint('onExit from FintocWidgetView: $data');
}
void onError(dynamic error) {
debugPrint('onError from FintocWidgetView: $error');
}
void onEvent(String eventName) {
debugPrint('onEvent from FintocWidgetView: $eventName');
// Event Name: opened, payment_error, closed ...etc.
}
return Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: FintocWidgetView(
options: options,
handlers: handlers,
),
),
],
);
Here, options
corresponds to an object with the parameters received by the widget (you can read more about these parameters here), and onSuccess
, onEvent
and onExit
correspond to the WebView redirections detailed here.
This implementation was written based on the input and experience of @marialuisaclaro integrating the WebView using React Native, which served as a good starting point for the general idea of this library.