dart - 颤动的圆形进度指示器未显示在应用栏中
问题描述
我正在创建一个项目,我需要在 appbar 中显示进度条。代码如下
bool loader_saver=false;
return Scaffold(
appBar: new AppBar(
title: new Text("add data"),
actions: <Widget>[
loader_saver?
new CircularProgressIndicator()
:
new FlatButton(
onPressed: () {
_add_Data();
},
child: new Icon(
Icons.save,
color: Colors.white,
))
],
)
这是onpressed方法
void _add_data(){
final _formstate = _form_key.currentState;
if (_formstate.validate()) {
_form_key.currentState.save();
setState(() {
loader_saver=true;
});
}
}
解决方案
这将在 appbar 中显示您的 CircularProgressIndicator,根据您的要求进行更改
actions: <Widget>[
new Container(width: 60.0, height: 20.0, color: Colors.lightGreen,
child: new CircularProgressIndicator(),)]
推荐阅读
- android - android:如何检测放大和缩小手势检测后指针在这里是我的代码
- php - PHP:如何将数组值与动态数组的数组值合并?
- json - 如何仅在 wordpress-rest-api 中禁用 wp 根路径?
- sql - 我在 Microsoft SQL Server Management Studio 中的 ... 附近出现错误语法错误
- javascript - 有没有办法在 Javascript 中对用户输入进行冒泡排序?
- javascript - 跳跃的数字。该函数必须检查具有相邻值的值
- java - Eclipse 未在悬停时显示 javadocs,但在“在浏览器中打开附加的 javadocs”上显示它们
- android - UnityEngine.Videoplayer 不在 IOS 设备上渲染视频
- c - 奇怪的只读符号显示为 nm 中的初始化数据部分 (D)
- node.js - Discord.js:如果输入不是已知命令,我如何捕捉这种情况?