flutter_inappwebview
flutter_inappwebview copied to clipboard
UI freezes / lags / halts when when navigating to a new screen that contains a webview (iOS)
- [v] I have read the Getting Started section
- [v] I have already searched for the same problem
Environment
Technology | Version |
---|---|
Flutter version | 3.10.3 |
Plugin version | 5.7.2+3 |
Android version | x |
iOS version | 14.2 |
macOS version | 13.1 |
Xcode version | 14.2 |
Device information: all iOS simulators & real device
Description
Navigating to a new screen that contains a webview causes a weird lag/delay/freeze. The UI freezes now and then, when the webview is initialised, so animation of the screen is sometimes skipped too.
Screencast:
https://github.com/pichillilorenzo/flutter_inappwebview/assets/1286410/620a7df9-a3c9-408e-ae33-1528bba0b646
Current behavior:
A normal screen animates smooth, but a screen with the webview freezes, lags after clicking the button.
Steps to reproduce
Code example:
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('home'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
MaterialButton(
color: Colors.blue,
onPressed: () {
Navigator.push(context,
CupertinoPageRoute(builder: (_) => const MyHomePage()));
},
child: const Text('home'),
),
MaterialButton(
color: Colors.blue,
onPressed: () {
Navigator.push(context,
CupertinoPageRoute(builder: (_) => const WebViewPage()));
},
child: const Text('navigate to webview'),
)
],
),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
class WebViewPage extends StatelessWidget {
const WebViewPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('web page'),
),
body: InAppWebView(
initialUrlRequest: URLRequest(url: Uri.parse('https://flutter.dev/')),
),
);
}
}
EDIT: I also tested it with latest xcode 14.3.1 and flutter_inappwebview 6.X.X, same issue.