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;  
          },  
        );
复制代码
相关推荐
我不吃饼干9 天前
鸽了六年的某大厂面试题:你会手写一个模板引擎吗?
前端·javascript·面试
涵信9 天前
第一节 布局与盒模型-Flex与Grid布局对比
前端·css
我不吃饼干9 天前
鸽了六年的某大厂面试题:手写 Vue 模板编译(解析篇)
前端·javascript·面试
Georgewu9 天前
【HarmonyOS 5】鸿蒙跨平台开发方案详解(一)
flutter·harmonyos
前端fighter9 天前
为什么需要dependencies 与 devDependencies
前端·javascript·面试
veminhe9 天前
HTML5 浏览器支持
前端·html·html5
前端fighter9 天前
Vuex 与 Pinia:全面解析现代 Vue 状态管理的进化之路
前端·vue.js·面试
爱吃鱼的锅包肉9 天前
Flutter开发中记录一个非常好用的图片缓存清理的插件
flutter
snow@li9 天前
vue3-ts-qrcode :安装及使用记录 / 配置项 / 效果展示
前端·javascript·vue.js
GISer_Jing9 天前
React Next快速搭建前后端全栈项目并部署至Vercel
前端·react.js·前端框架