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;  
          },  
        );
复制代码
相关推荐
人道领域11 分钟前
JavaWeb从入门到进阶(前端工程化)
前端
IT陈图图16 分钟前
Flutter × OpenHarmony 实战:构建智能汇率转换金额输入框
flutter·开源·鸿蒙·openharmony
shughui20 分钟前
APP、Web、H5、iOS与Android的区别及关系
android·前端·ios
南村群童欺我老无力.23 分钟前
Flutter 框架跨平台鸿蒙开发 - 打造经典连连看游戏
flutter·游戏·华为·harmonyos
Amumu1213825 分钟前
React Router 6介绍
前端·react.js·前端框架
南村群童欺我老无力.31 分钟前
Flutter 框架跨平台鸿蒙开发 - 打造表情包制作器应用
开发语言·javascript·flutter·华为·harmonyos
山峰哥35 分钟前
SQL调优实战:让查询效率飙升10倍的降本密码
服务器·前端·数据库·sql·编辑器·深度优先
IT陈图图37 分钟前
漫游记:基于 Flutter × OpenHarmony 的旅行记录应用首页实现
flutter·华为·鸿蒙·openharmony
余生H1 小时前
2026 年时间记录软件对比研究:时间线与「时光流」设计的产品分化
前端·软件工程·时间管理·时间记录
风叶悠然1 小时前
vue3中数据的pinia的使用
前端·javascript·数据库