flutter

Flutter之Visibility组件

2021-03-30  本文已影响0人  习惯了_就好
/**
    Visibility 隐藏/可见;Offstate不能保存组件的状态,组件重新加载

    const Visibility({
    Key key,
    @required this.child,
    this.replacement = const SizedBox.shrink(),  不可见时显示的组件(当maintainState = false)
    this.visible = true,  子组件是否可见,默认true(可见)
    this.maintainState = false,  不可见时是否维持状态,默认为false每次加载都重新创建
    this.maintainAnimation = false, 不可见时,是否维持子组件中的动画
    this.maintainSize = false, 不可见时是否留有空间(设置为true,会报错。如果想隐藏并保留组件空间请使用Opacity)
    this.maintainSemantics = false,
    this.maintainInteractivity = false, 不可见时是否具有交互性
    })
 */
body: Visibility(
          maintainState: true,
          child: Text("Visibility组件"),
        ),
上一篇 下一篇

猜你喜欢

热点阅读