Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix to match FL 3.24.2 #975

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

bsz0206
Copy link

@bsz0206 bsz0206 commented Oct 3, 2024

to fix buliding for Android on flutter 3.24.>=2

@bsz0206
Copy link
Author

bsz0206 commented Dec 5, 2024

@charafau can you please apply this PR so that we can build?

@charafau
Copy link
Collaborator

@charafau can you please apply this PR so that we can build?

please migrate to official webview 🙏 https://pub.dev/packages/webview_flutter

@bsz0206
Copy link
Author

bsz0206 commented Dec 11, 2024

@charafau

the purpose of flutter_webview_plugin is different for methods that webview does not support such as the following:

import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
class FlutterWebviewWrapper {
  static void close() {
    FlutterWebviewPlugin().close();
  }

  static void onHttpErrorListen({required void Function() onData}) {
    FlutterWebviewPlugin().onHttpError.listen((data) {
      onData.call();
    });
  }
}

@charafau
Copy link
Collaborator

official webview is in the widget tree so you just do normal naviagtion to close the page ( Navigator.of(context).pop() ).

Looks like if you want to listen to http errors it's also easy. From official documentation:

controller = WebViewController()
  ..setJavaScriptMode(JavaScriptMode.unrestricted)
  ..setNavigationDelegate(
    NavigationDelegate(
      onProgress: (int progress) {
        // Update loading bar.
      },
      onPageStarted: (String url) {},
      onPageFinished: (String url) {},
      onHttpError: (HttpResponseError error) {},                               //////// THIS ONE
      onWebResourceError: (WebResourceError error) {},                //////// and this one
      onNavigationRequest: (NavigationRequest request) {
        if (request.url.startsWith('https://www.youtube.com/')) {
          return NavigationDecision.prevent;
        }
        return NavigationDecision.navigate;
      },
    ),
  )
  ..loadRequest(Uri.parse('https://flutter.dev'));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants