Check Mobile App
Read now
Start a Project

How to hide any widget in flutter

Save

We can show or hide widgets using the Visibility widget. When designing mobile apps using flutter we may need to show or hide the widget based on a specific context. This feature is available to control whether we display or hide information.

Visibility is a useful widget to show or hide other widgets in the app. We have to wrap the widget we want to show or hide it in the widget to look like a child. This widget has a so-called visual area that controls the child’s (visible or invisible) status. Instead of hiding the baby, we can replace it with another widget. This widget gives us control over how to save widget space when not visible.

Property:
Visibility has several properties
> Type:
This property is used for widgets that show or hide depending on the visibility value. 
> MaintainAnimation:
 This property is used to determine whether to keep the child animation when it is not visible. The default is wrong. 
> Visible:
This property controls whether the child is visible. The default is true. 
> Replace:
This property is used for widgets that are displayed when the child is not visible. The default is SizedBox.shrink. 
> MaintainState:
 This property is used to maintain the child’s state when it is not visible. The default is wrong. 
> MaintainInteractivity:
 This property is used to allow the widget to be interactive when hidden. The default is wrong. 
> MaintainSemantics:
 This property is used to maintain the widget’s semantics when the widget is hidden. The default is wrong
> MaintainSize:
 Maintaining the size when the widget is not visible.

Code:

Output:

Conclusion

In this blog, we have discussed how to hide any widget in flutter in our app features.

I hope it will help you to understand and get a brief idea about it.

Thank you for reading!! 

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

css.php

Great Product, Great Team, and Great Support Service. And if you want to add more features to the product, they can submit any idea that comes to your mind. They really care about their clients and we are really happy and honored to deal with Webkul.

Osama
Talk to Sales

Global

Live Chat
Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home