Notification texts go here Contact Us Buy Now!

Icons still showing even if it's parent widget's height is zero in Flutter

if (height > 0) IconButton(icon: Icon(Icons.favorite_border), onPressed: () {},)
This code snippet verifies if the widget's height is greater than 0, and only then displays the IconButton widget. This ensures that the icon is only visible when the parent widget has a non-zero height. You may adjust the value compared to 0 (e.g., 10) to remove the icon.
clipBehavior: Clip.hardEdge
Another way to resolve this issue is to add `clipBehavior: Clip.hardEdge` to the parent Container. This property prevents the child widgets from overflowing outside the parent's boundaries. By setting it to `Clip.hardEdge`, you force the icons to be clipped at the parent's edges, ensuring they are hidden when the parent's height is zero.

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.