Show/hide widgets in Flutter programmatically

前端 未结 13 1330
轮回少年
轮回少年 2020-11-28 04:13

In Android, every single View subclass has a setVisibility() method that allows you modify the visibility of a View object

The

13条回答
  •  误落风尘
    2020-11-28 04:32

    Flutter now contains a Visibility Widget that you should use to show/hide widgets. The widget can also be used to switch between 2 widgets by changing the replacement.

    This widget can achieve any of the states visible, invisible, gone and a lot more.

        Visibility(
          visible: true //Default is true,
          child: Text('Ndini uya uya'),
          //maintainSize: bool. When true this is equivalent to invisible;
          //replacement: Widget. Defaults to Sizedbox.shrink, 0x0
        ),
    

提交回复
热议问题