美文网首页
Flutter学习(二)

Flutter学习(二)

作者: sindorina | 来源:发表于2019-05-06 17:06 被阅读0次

    1.抽屉 drawer(左侧) endDrawer(右侧)
    通常在Scaffold中使用
    UserAccountsDrawerHeader用于展示用户账户信息
    CircleAvatar圆形图片控件

    Widget _createDrawerView() {
        return new Drawer(
          child: new ListView(
            children: <Widget>[
              UserAccountsDrawerHeader(
                  accountName: Text("xxx"),
                  accountEmail: Text("xxx@163.com"),
                  currentAccountPicture: new CircleAvatar(
                    backgroundImage: AssetImage("images/bg.jpeg"),
                  )
              ),
              ListTile(
                leading: CircleAvatar(
                  child: Text("A")
                ),
                title: Text("itemA"),
                onTap: (){
                  Navigator.pop(context);
                },
              ),
              ListTile(
                leading: CircleAvatar(
                    child: Icon(Icons.favorite)
                ),
                title: Text("itemB"),
                onTap: (){
                  Navigator.pop(context);
                },
              ),
              ListTile(
                leading: new CircleAvatar(
                  backgroundImage: AssetImage("images/bg.jpeg"),
                ),
                title: Text("itemC"),
                onTap: (){
                  Navigator.pop(context);
                },
              ),
            ],
          ),
        );
      }
    
    

    2.悬浮按钮

        this.child,//按钮显示的内容
        this.tooltip,//长按时显示的提示
        this.foregroundColor,//前景色,影响到文字颜色
        this.backgroundColor,//背景色
        this.heroTag = const _DefaultHeroTag(),//hero效果使用的tag,系统默认会给所有FAB使用同一个tag,方便做动画效果
        this.elevation = 6.0,//未点击时阴影值
        this.highlightElevation = 12.0,//点击下阴影值
        this.onPressed//点击事件
        this.mini = false,//FloatingActionButton有regular, mini, extended三种类型,默认为false即regular类型,true时按钮变小即mini类型,extended需要通过FloatingActionButton.extended()创建,可以定制显示内容
        this.shape = const CircleBorder(),//定义FAB的shape,设置shape时,默认的elevation将会失效,默认为CircleBorder
        this.clipBehavior = Clip.none,
        this.materialTapTargetSize,
        this.isExtended = false,//是否为”extended”类型
    

    3.AlertDialog

    showDialog(context: mContext,builder: (mContext) =>AlertDialog(title: Text("xxxxxx"),));
    

    相关文章

      网友评论

          本文标题:Flutter学习(二)

          本文链接:https://www.haomeiwen.com/subject/kxlroqtx.html