hisaichi5518 / native_webview

A Flutter plugin that allows you to add an inline WebView.
https://pub.dev/packages/native_webview
Other
51 stars 18 forks source link

Sometimes the screen flickers when using WebView #22

Closed hisaichi5518 closed 4 years ago

hisaichi5518 commented 4 years ago
 $ flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.9, on Mac OS X 10.15.4 19E287, locale ja-JP)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.1)
[✓] Android Studio (version 3.6)
[✓] IntelliJ IDEA Ultimate Edition (version 2019.3.4)
[✓] VS Code (version 1.42.0)
[✓] Connected device (2 available)

• No issues found!
hisaichi5518 commented 4 years ago

~When I used a beta channel of flutter, it doesn't reproduce it anymore.~

 $ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v1.17.0, on Mac OS X 10.15.4 19E287, locale ja-JP)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.1)
[✓] Android Studio (version 3.6)
[✓] IntelliJ IDEA Ultimate Edition (version 2019.3.4)
[✓] VS Code (version 1.42.0)
[✓] Connected device (2 available)

• No issues found!
hisaichi5518 commented 4 years ago

It seems to be a problem with the VirtualDisplay that PlatformView is using. https://github.com/flutter/flutter/issues/39797 https://github.com/flutter/flutter/issues/39797#issuecomment-598345787

hisaichi5518 commented 4 years ago

reproducible code:

import 'package:flutter/material.dart';
import 'package:native_webview/native_webview.dart';

class InitialUrlScreen extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return InitialUrlScreenState();
  }
}

class InitialUrlScreenState extends State {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Initial URL"),
      ),
      body: Column(
        children: <Widget>[
          SizedBox(
            height: 200,
            child: WebView(
              initialUrl: "https://flutter.dev",
            ),
          ),
          SizedBox(
            height: 200,
            child: WebView(
              initialUrl: "https://flutter.dev",
            ),
          ),
        ],
      ),
    );
  }
}