-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Description
Starting from 1.20.2, WebView stopped working. What I meant by stopped working is that it doesn't handle any gesture such as tapping, or swiping to scroll. Other flutter widgets in the same screen handle gestures so I can go back to a previous screen by tapping a back button. However, when I tried to swipe to go back to a previous screen, it stucks in the middle of swiping. Unfortunately, I tried to create a minimal demo that can reproduce this but I couldn't reproduce it with a simple WebView at the moment.
One thing I noticed is that if I display the problematic WebView screen as an initial screen, it works as expected. Changing a code to add an WebView and hot-reload also works. This only happens on a physical device in a dev and release mode. The webview screen is an agreement screen showing a privacy and terms, etc so it doesn't make sense to put it as a home screen. I am not sure which patch made this issue starting from 1.20.2.
@cyanglaz commented that my issue isn't related to the issue(#53490) so I am submitting a new issue.
This bug started to appear 1.20.2 and I have tested the same code on 1.20.3, 1.20.4, and the latest beta as well regardless of any iOS Versions( 11.4.1, 13.5, 13.6, 13.7, 14.0).

Above is a demo showing that a WebView screen got stuck while I was swiping. I actually scrolled the WebView vertically but it doesn't show any touch pointer.
import UIKit
import Flutter
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
self.window!.tintColor = UIColor.systemPink /// This line causes this WebView bug
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}AppDelegate.swift
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
void main() async {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.light(),
home: SplashScreen(),
);
}
}
class SplashScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
floatingActionButton: FloatingActionButton(
child: Icon(Icons.web),
onPressed: () {
Navigator.of(context)
.push(MaterialPageRoute(builder: (_) => WebViewScreen()));
},
),
);
}
}
class WebViewScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Web'),
),
body: WebView(
initialUrl: 'https://www.flutter.dev'
),
);
}
}main.dart
Above is a minimal code that you can reproduce this bug. The WebView in WebViewScreen doesn't receive any gesture.
Logs
[✓] Flutter (Channel stable, 1.20.4, on Mac OS X 10.15.3 19D76, locale en-KR)
• Flutter version 1.20.4 at /Users/captainpark/Library/Flutter/sdk
• Framework revision fba99f6cf9 (3 days ago), 2020-09-14 15:32:52 -0700
• Engine revision d1bc06f032
• Dart version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/captainpark/Library/Android/sdk
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = /Users/captainpark/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.7)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.7, Build version 11E801a
• CocoaPods version 1.8.4
[✓] Android Studio (version 4.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 49.0.2
• Dart plugin version 193.7547
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.2)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin version 49.0.4-dev.1
• Dart plugin version 202.6397.47
[✓] Connected device (3 available)
• SM G965N (mobile) • 21bd4fb43b037ece • android-arm64 • Android 9 (API 28)
• SM G981N (mobile) • R3CN40AGS3T • android-arm64 • Android 10 (API 29)
• Taehyun’s iPhone (mobile) • 00008020-000570D82284002E • ios • iOS 13.7