Open hamidrezabstn opened 5 years ago
BTW it is my code sample:
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: CustomScrollView(
slivers: <Widget>[
SliverList(
delegate: SliverChildListDelegate([
Container(
height: 300,
color: Colors.greenAccent,
child: Text('box1')),
Container(height: 200, color: Colors.red, child: Text('box2')),
]),
),
SliverList(
delegate: SliverChildListDelegate([
WebView(
initialUrl: "http://www.wikipedia.com",
onPageFinished: (url) {},
),
]),
)
],
));
if i put webview inside a container with fix height more than 3000.0 then android webview will crash!
https://github.com/peeto/scrollable_flutter_web_view_example
when heightPercent too large, it crashed
ResponsiveContainer(
widthPercent: 100,
heightPercent: 1500,
alignment: Alignment(0, 0),
margin: EdgeInsets.all(0),
padding: EdgeInsets.all(0),
child: WebView(
initialUrl: 'http://news.xjtu.edu.cn/info/1004/117731.htm',
javascriptMode: JavascriptMode.unrestricted,
)
),
Running on
Flutter 1.12.13+hotfix.8 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 0b8abb4724 (3 weeks ago) • 2020-02-11 11:44:36 -0800
Engine • revision e1e6ced81d
Tools • Dart 2.7.0
Issue persists on latest dev channel (1.20.0-0.0.pre)
with latest webview_flutter
version.
Anyone found a solution yet? I'm experiencing this error too.
i've got same problem, anybody can help me ?
Enabling hybrid composition solved this Android issue for me.
@override
void initState() {
super.initState();
// Enable hybrid composition.
if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView();
}
Enabling hybrid composition solved this Android issue for me.
@override void initState() { super.initState(); // Enable hybrid composition. if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView(); }
Thank You that worked for me!
Using the original code and updating it per latest stable version changes, the reported exception persists.
It will work like that without enabling hybrid composition because of Android and TextureView limitation. If you want to set height to it you need to enable hybrid composition. You can read about it here https://docs.flutter.dev/platform-integration/android/platform-views
and I guess issue can be closed
when using webview_flutter widget inside another scroll view it will throw exception:
i have tried many solutions even customscrollview with slivers but it does not help