buildcondition 0.0.4 copy "buildcondition: ^0.0.4" to clipboard
buildcondition: ^0.0.4 copied to clipboard

description:Synchronous conditional widget renderer.

BuildCondition #

Synchronous conditional widget renderer.

Lets you declaratively render a widget based on a condition, using this you can get rid of implicit conditional statements in your code to display/hide a widget.

Usage #

After following the installation guide, you can use this widget as follow:

BuildCondition(
  condition: true,
  builder: (context) {
    return Text('This gets rendered');
  },
 )

BuildCondition(
  condition: false,
  builder: (context) {
    return Text('This does not get rendered, an empty Container will be rendered');
  },
)

BuildCondition(
  condition: false,
  builder: (context) {
    return Text('This does not get rendered, as fallback is not null, it is used to render the fallback widget.');
  },
  fallback: (context) {
    return Text('This gets rendered');
  }
)
11
likes
130
pub points
82%
popularity

Publisher

unverified uploader

description:Synchronous conditional widget renderer.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on buildcondition