我试图显示循环进度中心我的webview内部堆栈,但它显示底部。我使用了扩展widget来使用webview的可用空间。
我的代码:Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
body: WillPopScope(
onWillPop: () async {
print("back pressed");
return false;
},
child: Column(
children: [
webProgress < 1
? SizedBox(
height: 5,
child: LinearProgressIndicator(
value: webProgress,
color: Colors.blue,
backgroundColor: Colors.white,
),
)
: SizedBox(),
Expanded(
child: WebviewScaffold(
url: "https://google.com",
mediaPlaybackRequiresUserGesture: false,
withLocalStorage: true,
),
),
isLoading
? Center(
child: CircularProgressIndicator(),
)
: Stack(),
],
),
),
),
);
}
}
这对我来说很有效初始进度必须为0.0
也许可以尝试用堆栈来包装你想要显示循环进度的内容,
:
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
body: WillPopScope(
onWillPop: () async {
print("back pressed");
return false;
},
child: Column(
children: [
webProgress < 1
? SizedBox(
height: 5,
child: LinearProgressIndicator(
value: webProgress,
color: Colors.blue,
backgroundColor: Colors.white,
),
)
: SizedBox(),
Stack(
children: [
Expanded(
child: WebviewScaffold(
url: "https://google.com",
mediaPlaybackRequiresUserGesture: false,
withLocalStorage: true,
),
),
isLoading
? Center(
child: CircularProgressIndicator(),
)
: Container(),
],
),
],
),
),
),
);
}