实现方式
import 'package:oktoast/oktoast.dart';
在屏幕中间展示加载标签
_showLoading() {
showToastWidget(
Container(
width: 150,
height: 100,
color: Colors.black54,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
CircularProgressIndicator(
backgroundColor: Colors.grey[200],
valueColor: AlwaysStoppedAnimation(Colors.blue),
),
Container(
margin: EdgeInsets.only(top: 10),
child: Text('loading...'),
)
],
),
),
),
dismissOtherToast: true,
);
}
}
本文介绍如何使用Flutter中的OkToast库实现在屏幕中央显示加载提示。通过具体代码示例,展示了如何自定义加载提示的样式,包括背景颜色、进度指示器的颜色及加载文本。

952

被折叠的 条评论
为什么被折叠?



