zoukankan      html  css  js  c++  java
  • Offstage(每日Flutter 小部件)

    /**
     * 控制child是否显示
     *
        当offstage为true,控件隐藏; 当offstage为false,显示;
        当Offstage不可见的时候,如果child有动画等,需要手动停掉,Offstage并不会停掉动画等操作。
    
        const Offstage({ Key key, this.offstage = true, Widget child })
     */
    

      

    String showText = "hide";
      bool isOff = false;
    
    
    body: Container(
              margin: EdgeInsets.only(top: 50.0),
              child: Offstage(
                offstage: isOff,
                child: Text("Offstage组件"),
              ),
            ),
            floatingActionButton: FloatingActionButton(
              onPressed: onButtonClickListener,
              child: Text(showText),
            )
    
    
    void onButtonClickListener() {
        setState(() {
          isOff = !isOff;
        });
        if (isOff) {
          showText = "show";
        } else {
          showText = "hide";
        }
      }
    

      参考:https://www.jianshu.com/p/b877ee7b1748

  • 相关阅读:
    常用基础命令
    Vim
    Linux目录结构
    稀疏数组
    数据结构概述
    天天用的命令
    Mysql和redis的安装
    回文排列
    URL化
    在word中做复选框打对勾钩
  • 原文地址:https://www.cnblogs.com/wjw334/p/12738603.html
Copyright © 2011-2022 走看看