Cirilla Documentations

  1. Home
  2. Docs
  3. Cirilla Documentations
  4. How to
  5. How to enable Geolocation, Upload file in Flutter Webview v4 ?

How to enable Geolocation, Upload file in Flutter Webview v4 ?

This doc for Android only, the iOS app default enable

Steps 1:

Import package in: cirilla/pubspec.yaml

  flutter_webview_plus:
    path: ./packages/flutter_webview_plus

Steps 2:

Open file: cirilla/lib/widgets/cirilla_webview.dart

Add import:

import 'package:flutter_webview_plus/flutter_webview_plus.dart';

Add mixin:

FlutterWebViewPlusMixin

Example:

File Upload

Add source code:

      // Support upload file on Webview for Android
      (controller.platform as AndroidWebViewController).setOnShowFileSelector(
        (params) async {
          return await androidFilePicker(context);
        },
      );

Example:

Ask for geolocation permission

Add source code:

 // Support geolocation on Webview for Android
 (controller.platform as AndroidWebViewController).setGeolocationPermissionsPromptCallbacks(
   onShowPrompt: (request) {
       return geolocationPermissionsResponse();
   },
 );

Example:

Video guide

Was this article helpful to you? Yes No

How can we help?