zoukankan      html  css  js  c++  java
  • flutter 交互提示方式

    交互提示方式dialog和snackbar

    首先看看dialog的方式

     new PopupMenuButton(
                        icon: new Icon(Icons.phone_iphone, color: Colors.blue,),
                       onSelected: (v){
                         showDialog<Null>(
                           context: context,
                           builder:(_){
                             return new AlertDialog(
                                        content: new Text(v),
                                        actions: <Widget>[
                                          new FlatButton(
                                            onPressed: () {
                                              Navigator.of(_).pop();
                                            },
                                            child: new Text('确定')
                                          )
                                        ]
                                      );
                                      }
                                    );
                                },
                      
                        itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
                          new PopupMenuItem<String>(
                              value: '选项一的值',
                              child: new Text('屏蔽这个问题')
                          ),
                          new PopupMenuItem<String>(
                              value: '选项二的值',
                              child: new Text('取消关注')
                          ),
                          new PopupMenuItem<String>(
                              value: '选项二的值',
                              child: new Text("举报")
                          )
                        ]
                      
                      ),
           

    snackbar

     new PopupMenuButton(
                        icon: new Icon(Icons.phone_iphone, color: Colors.blue,),
                       //child: ImageIcon(AssetImage('images/wxzf.png'), size:20.0, color: Colors.blue,),
                       onSelected: (v){
            final snackBar = new SnackBar(
              content: new ListTile(leading: Icon(Icons.warning,color: Colors.red,),title: new Text(v),),
              backgroundColor: Colors.blue,
              duration: Duration(milliseconds: 2000),
              );
    
    Scaffold.of(context).showSnackBar(snackBar);             
     },
                      
                        itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
                          new PopupMenuItem<String>(
                              value: '选项一的值',
                              child: new Text('屏蔽这个问题')
                          ),
                          new PopupMenuItem<String>(
                              value: '选项二的值',
                              child: new Text('取消关')
                          ),
                          new PopupMenuItem<String>(
                              value: '选项二的值',
                              child: new Text("举报")
                          )
                        ]
                      
                      ),
          
  • 相关阅读:
    Quartz.net
    Perfview 分析进程性能
    windbg 分析cpu异常
    ansible-vault 教程
    ansible 自动化运维(2)
    简单生成随机测试数据
    基于 RabbitMQ-EasyNetQ 实现.NET与Go的消息调度交互
    自绘 TreeDataView 控件
    C# 创建音频WAVE文件头信息(*.wav)
    C# GOF 23种设计模式 学习Log【更新中】
  • 原文地址:https://www.cnblogs.com/njcxwz/p/10064389.html
Copyright © 2011-2022 走看看