visible method

Widget visible(
  1. bool isVisible, {
  2. Widget replacement = const SizedBox.shrink(),
})

Shows this widget when isVisible, otherwise replacement.

The default replacement takes no space, unlike Opacity(opacity: 0) which still lays out and still absorbs hit tests.

Implementation

Widget visible(
  // ignore: avoid_positional_boolean_parameters
  bool isVisible, {
  Widget replacement = const SizedBox.shrink(),
}) => isVisible ? this : replacement;