首页 > 其他 > 详细

Flutter loading

时间:2020-04-28 23:12:22      阅读:84      评论:0      收藏:0      [点我收藏+]

如何和原生APP系统自带的一样实现一个通用的loading?


有多种实现方式,这里举例两种:

第一:用Overlay

 1 Directionality(
 2     child: Overlay(
 3       initialEntries: [
 4         OverlayEntry(
 5           builder: (BuildContext _context) {
 6             return 自定义widget;
 7           },
 8         ),
 9       ],
10     ),
11     textDirection: TextDirection.ltr,
12 );

 

第二:用Dialog

WillPopScope(
	onWillPop: () async => _loadingDismissible,
	child: Center(
	  child: SizedBox(
	    width: 166,
	    height: 166,
	    child: Dialog(
	        backgroundColor: Colors.transparent,
	        insetAnimationDuration: Duration(milliseconds: 100),
	        child: 自定义widget),
	  ),
	),
);

  

效果图:

 

技术分享图片

 

完整代码,jd_loading

 

Flutter loading

原文:https://www.cnblogs.com/spring87/p/12797585.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!