flutter 提示框2 Dialog

flutter 提示框 写在点击的方法体中

child里放自己喜欢的

dart 复制代码
        showDialog(  
          context: context,  
          builder: (BuildContext context) {  
            final Dialog alertDialog = Dialog(  
              backgroundColor: Colors.transparent,
              shadowColor:Colors.transparent,

              child: Container(
                  height: mediawidth*0.25,
                  width: mediawidth*0.5,
                  decoration: BoxDecoration(
                    // color: Colors.transparent,
                          image: DecorationImage(  
                            image: AssetImage('assets/images/choosed.png'),
                            fit: BoxFit.contain, 
                          ),
                        ),
                ),
            
            );  
  
            // 使用Future.delayed来在1秒后自动关闭对话框  
            Future.delayed(Duration(milliseconds: 700), () {  
              Navigator.of(context).pop();  
            });  
  
            return alertDialog;  
          },  
        );
复制代码
相关推荐
德莱厄斯几秒前
GIS 开发要变天?看看高德空间智能给我们带来了什么!
前端·gis·agent
JarvanMo3 分钟前
Flutter.Dart的主构造函数(primary constructor)可能马上就要来了
前端
用户658681803384030 分钟前
一个前端CLAUDE.md
前端
前端那点事31 分钟前
彻底解决KeepAlive缓存乱象!Vue3精细化按需缓存+路径重置终极方案
前端·vue.js
前端那点事31 分钟前
Vue 的 template 标签不能用 v-show?底层机制+踩坑复盘+生产级解决方案
前端·vue.js
前端那点事35 分钟前
从零落地前端性能优化:全链路避坑+实战调优方案
前端·vue.js
沸点小助手1 小时前
「妈,我真不是修电脑的」获奖名单公示|本周互动话题上新🎊
前端·人工智能
兵麒麟1 小时前
JavaScript Promise 完全掌握:从外卖订单到优雅异步
前端
转转技术团队1 小时前
不写一行代码,用 Xmind 思维导图跑通多端自动化回归
前端
铁皮饭盒1 小时前
同样是算力巨头,为什么华为死磕英伟达,AMD 却 "躺平看戏"?
前端·后端