Open ivanappkey opened 4 years ago
the app is force close when rendering larger html data errorr message :
Creating a virtual display of size: [1080, 33424] may result in problems(https://github.com/flutter/flutter/issues/2897).It is larger than the device screen size: [1080, 2088].
No, it shouldn't close on this, It's just a warning. Application is closing due to any other issue, can you show me how to reproduce this issue?
the app is force close when rendering larger html data errorr message :
Creating a virtual display of size: [1080, 33424] may result in problems(https://github.com/flutter/flutter/issues/2897).It is larger than the device screen size: [1080, 2088].
No, it shouldn't close on this, It's just a warning. Application is closing due to any other issue, can you show me how to reproduce this issue?
this is my code ;
body: ListView(
physics: ScrollPhysics(),
shrinkWrap: true,
children: [
Container(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 50, horizontal: 20),
child: Center(
child: Text(
loc.main.dolpin_term,
style: termsStyle,
)),
),
),
Divider(
color: Colors.grey[500],
),
FutureBuilder(
future: TermConditionServices(context).fetchTermCondition(),
builder: (context, snapshot) {
if (snapshot.hasData) {
return SizedBox(
height: _height,
child: WebViewPlus(
onWebViewCreated: (controller) {
this._controller = controller;
controller.loadUrl(Uri.dataFromString(
snapshot.data.description,
mimeType: 'text/html',
encoding: Encoding.getByName('utf-8'))
.toString());
},
onPageFinished: (url) {
_controller.getHeight().then((double height) {
print("Height: " + height.toString());
setState(() {
_height = height;
});
});
},
javascriptMode: JavascriptMode.unrestricted,
),
);
} else {
return const Center(
child: CircularProgressIndicator(),
);
}
},
)
],
),
error detail in my console
W/zygote (29855): Attempt to remove non-JNI local reference, dumping thread
I/flutter (29855): Height: 12154.0
W/PlatformViewsController(29855): Creating a virtual display of size: [1080, 33424] may result in problems(https://github.com/flutter/flutter/issues/2897).It is larger than the device screen size: [1080, 2088].
D/ (29855): HostConnection::get() New Host Connection established 0x85558ec0, tid 29868
D/EGL_emulation(29855): eglMakeCurrent: 0xa9e06bc0: ver 3 0 (tinfo 0xa9e03640)
D/ (29855): HostConnection::get() New Host Connection established 0x7e02c100, tid 30030
Lost connection to device.
Exited (sigterm)
I think the application crashes while running onPageFinished
method, the app is running well when at first value of the _height variable I set it to 200, and then when the value is change to the height of the webview the app is forse close
if you see in logs I/flutter (29855): Height: 12154.0
it's printing new height properly. there's some issue with your code which is forcing it to close after setting a new state.
Did you try with any simple example?
if you see in logs
I/flutter (29855): Height: 12154.0
it's printing new height properly. there's some issue with your code which is forcing it to close after setting a new state.Did you try with any simple example?
yes I did, could the problem because i'm using this code inside the onWebViewCreated
method ?
controller.loadUrl(Uri.dataFromString(
snapshot.data.description,
mimeType: 'text/html',
encoding: Encoding.getByName('utf-8'))
.toString());
I have try using controller.loadString(snapshot.data.description);
but it return an error like "the string is not a valid character"
I'm using japanese/katakana
sorry for bad english
Please share your data(Japanese / katakana ) to render?
Did you find a solution? I've got the same problem with this simple example:
import 'package:flutter/material.dart';
import 'package:webview_flutter_plus/webview_flutter_plus.dart';
void main() => runApp(MaterialApp(home: CrashingWebViewExample()));
class CrashingWebViewExample extends StatefulWidget {
@override
_CrashingWebViewExampleState createState() => _CrashingWebViewExampleState();
}
class _CrashingWebViewExampleState extends State<CrashingWebViewExample> {
WebViewPlusController _controller;
double _height = 1;
@override
Widget build(BuildContext context) {
return ListView(
children: [
const Text('Testtext'),
SizedBox(
height: _height,
child: WebViewPlus(
onWebViewCreated: (controller) {
_controller = controller;
controller.loadUrl('https://www.kostenlos.de/brigitte-kostenlos-lesen');
},
onPageFinished: (url) {
_controller.getHeight().then((double height) {
print("Height: " + height.toString());
setState(() {
_height = height;
});
});
},
javascriptMode: JavascriptMode.unrestricted,
),
),
const Text('Testtext'),
],
);
}
}
The app is crashing since the SizedBox is too large:
Creating a virtual display of size: [1080, 30093] may result in problems(https://github.com/flutter/flutter/issues/2897).It is larger than the device screen size: [1080, 1920].
Still reproduces on Android.
For html strings >= 2MB then a white page is displayed.
Rendering the widget the following way:
WebView( initialUrl: 'about:blank', onWebResourceError: (err) { debugPrint(err.errorCode.toString()); debugPrint(err.errorType.toString()); debugPrint(err.description); }, onWebViewCreated: (WebViewController webViewController) { webViewController.loadUrl(Uri.dataFromString( widget.html, mimeType: 'text/html', encoding: utf8, ).toString()); }, )
Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.0.0, on macOS 12.3.1 21E258 darwin-x64, locale en-DE) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) [✓] Xcode - develop for iOS and macOS (Xcode 13.4.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2021.1) [✓] VS Code (version 1.69.0) [✓] Connected device (3 available) [✓] HTTP Host Availability
• No issues found!
the app is force close when rendering larger html data errorr message :
Creating a virtual display of size: [1080, 33424] may result in problems(https://github.com/flutter/flutter/issues/2897).It is larger than the device screen size: [1080, 2088].