-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The background color before display. #23
Comments
This is caused by the forced white background of webview in webview_flutter plugin. Now we don't have any workaround to avoid the white blink before the chart is loaded. Many people are following this issue of webview_flutter: flutter/flutter#29300 这是由于 webview_flutter 强制 webview 的背景颜色为白色(而不是透明), |
@entronad Opacity(
opacity: opacity,
child: Container(
child: Echarts(
key: chartKey,
onMessage: (emsg) {
if(emsg == 'rendered') {
if(opacity == 0) { // wait the render of chart
Future.delayed(Duration(milliseconds: 50), () {
opacity = 1;
setState({});
// or bloc.add();
});
}
}
},
extraScript: '''
chart.on('rendered', () => {
Messager.postMessage('rendered');
});
''', |
@blackredscarf |
@entronad |
Wrapping chart with opacity doesn't work for me on iOS. A workaround I found until flutter/plugins#3431 is merged is to use stack & cover the chart until is starts to render.
|
You don't need opacity. Simply show a Container on top of a chart with an "if" statement. For example,
This way you don't render an unnecessary widget with every refresh of a chart. |
Though I set the background color, background color before display is white on a tick. If my app background is no white, even is black, it will be disharmony.
尽管设置了背景颜色,但在视图显示之前,会有一瞬间的白色。如果我的APP背景颜色不是白色,甚至是黑色,将导致严重的色差冲突。
The text was updated successfully, but these errors were encountered: