An open API service indexing awesome lists of open source software.

https://github.com/frederickcxa/conditional-builder

Synchronous conditional widget renderer for Flutter :fire:
https://github.com/frederickcxa/conditional-builder

android dart declarative-ui flutter ios

Last synced: 5 months ago
JSON representation

Synchronous conditional widget renderer for Flutter :fire:

Awesome Lists containing this project

README

          

# ConditionalBuilder

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:

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

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

ConditionalBuilder(
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');
}
)
```