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;  
          },  
        );
复制代码
相关推荐
水银嘻嘻5 小时前
12 web 自动化之基于关键字+数据驱动-反射自动化框架搭建
运维·前端·自动化
小嘟嚷ovo5 小时前
h5,原生html,echarts关系网实现
前端·html·echarts
十一吖i6 小时前
Vue3项目使用ElDrawer后select方法不生效
前端
只可远观6 小时前
Flutter目录结构介绍、入口、Widget、Center组件、Text组件、MaterialApp组件、Scaffold组件
前端·flutter
周胡杰6 小时前
组件导航 (HMRouter)+flutter项目搭建-混合开发+分栏效果
前端·flutter·华为·harmonyos·鸿蒙·鸿蒙系统
敲代码的小吉米6 小时前
前端上传el-upload、原生input本地文件pdf格式(纯前端预览本地文件不走后端接口)
前端·javascript·pdf·状态模式
是千千千熠啊6 小时前
vue使用Fabric和pdfjs完成合同签章及批注
前端·vue.js
肥肥呀呀呀7 小时前
flutter Stream 有哪两种订阅模式。
flutter
九月TTS7 小时前
TTS-Web-Vue系列:组件逻辑分离与模块化重构
前端·vue.js·重构
我是大头鸟7 小时前
SpringMVC 内容协商处理
前端