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;  
          },  
        );
复制代码
相关推荐
踩着两条虫2 分钟前
从一行代码到一个生态:VTJ.PRO的创作之路
前端·低代码·ai编程
独特的螺狮粉24 分钟前
开源鸿蒙跨平台Flutter开发:量子态波函数坍缩系统-波动力学与概率云渲染架构
开发语言·flutter·华为·架构·开源·harmonyos
幼儿园技术家26 分钟前
嵌套 H5 的跨端通信:iOS / Android / 小程序 / 浏览器
前端·js or ts
浮芷.29 分钟前
Flutter 框架跨平台鸿蒙开发 - 思维录音机应用
flutter·华为·harmonyos
浮芷.36 分钟前
Flutter 框架跨平台鸿蒙开发 - 数字遗嘱应用
flutter·华为·harmonyos
一只小阿乐37 分钟前
TypeScript中的React开发
前端·javascript·typescript·react
用户97141718142740 分钟前
vite项目开发环境启动白屏
前端
Highcharts.js41 分钟前
Highcharts客户端导出使用文档说明|图表导出模块讲解
前端·javascript·pdf·highcharts·图表导出
2501_9219308342 分钟前
Flutter for OpenHarmony三方库适配实战:file_selector文件选择详解
flutter·openharmony
上山打牛1 小时前
cornerstone3D 通过二进制渲染影像
前端