flutter - 如何在颤动中显示圆形进度指示器和底片?
问题描述
我在我的代码中使用底页,因为当 isLoading 为真时它没有显示我的循环进度指示器,但三元运算符的其他部分工作正常。有没有其他方法可以做到这一点。或者我在代码中做错了什么?
(isLoading==true) ? Center(
child: Container(
height: 24,
width: 24,
child: CircularProgressIndicator(
backgroundColor: CommonColors.primaryColor,
strokeWidth: 1,
),
),
)
:
Column(
children: <Widget>[
Expanded(
child: ListView.separated(
itemCount: clist.cartlist.length,
itemBuilder: (BuildContext context, int index) {
return _buildCartProduct(index);
},
separatorBuilder: (context, index) {
return Divider(
color: Colors.grey[300],
);
},
),
),
SizedBox(
height: 80,
)
],
),
bottomSheet: isLoading?Container():Container(
height: 80.0,
color: CommonColors.secondaryBackgroundColor,
child: Column(crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Container(margin: EdgeInsets.symmetric(horizontal: 16),child:
Text('Total: \$${clist.getSubTotal()}',
style: TextStyle(fontWeight: FontWeight.bold,fontSize: 16),)),
Expanded(
child: FlatButton(onPressed: (){},
color: CommonColors.primaryColor,
child: Row(mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'PLACE',
style: TextStyle(
color: CommonColors.secondaryBackgroundColor,
fontSize: 20.0,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
],
),
),
解决方案
在这部分中,如果加载,您将显示一个空容器
bottomSheet: isLoading?Container():Container(
所以把它改成你的 CircularProgressIndicator
bottomSheet: isLoading ? CircularProgressIndicator():Container(
推荐阅读
- javascript - Facebook 分享检测到 og:image 但忽略图像
- android - Android React Native 的嵌套堆栈导航和抽屉导航器的问题
- azure - 如何在 Azure 应用服务中检索内存缓存
- xcode - 创建表时 iOS 中的 Firebase/Messaging 出错
- python - 如何设置django项目可以从多个url进入admin管理登录页面
- jquery - 使用 php 将 iframe(谷歌地图)添加到 jquery
- angular - 'HttpErrorResponse' 类型的参数不可分配给类型参数
- python - 如何过滤 pyspark 数据框中的日期
- r - 在 R 数据框中创建一个新类
- python - 如何获取存储在列表中的实例的值