Skip to main content

Visibility

Stac Visibility allows you to build the Flutter Visibility widget using JSON. To know more about the Visibility widget in Flutter, refer to the official documentation.


Properties​

PropertyTypeDescription
childMap<String, dynamic>The widget to be displayed when visible is true.
replacementMap<String, dynamic>?The widget to display when visible is false. Defaults to an empty widget (SizedBox.shrink).
visibleboolWhether the child is visible. Defaults to true.
maintainStateboolWhether to maintain the state of the widget when it is hidden. Defaults to false.
maintainAnimationboolWhether to maintain the animation of the widget when it is hidden. Defaults to false.
maintainSizeboolWhether to maintain the size of the widget when it is hidden. Defaults to false.
maintainSemanticsboolWhether to maintain the semantics of the widget when it is hidden. Defaults to false.
maintainInteractivityboolWhether to maintain the interactivity of the widget when it is hidden. Defaults to false.

Example JSON​

Example 1: Basic Visibility​

{
"type": "visibility",
"child": {
"type": "text",
"data": "I am visible!"
},
"visible": true
}

Example 2: Hidden with Replacement​

{
"type": "visibility",
"child": {
"type": "text",
"data": "I am hidden!"
},
"replacement": {
"type": "container",
"color": "#FF5733",
"width": 50,
"height": 50
},
"visible": false
}