if_widget

An if statement widget.

you never need

bool _statement = true;

Container(
    child:_stament==true?GestureDetector(
        child:FlatButton(onPressed: ()=>print('onPressed'), child: Text('Button'))
    ):Container())
)

Getting Started


bool _statement = true;

Container(
    child:If(_statement,
    child:GestureDetector(
        child:FlatButton(onPressed: ()=>print('onPressed'), child: Text('Button'))
    ))
)

/// or

Container(
    child:If(_statement,
    builder:(context)=>GestureDetector(
        child:FlatButton(onPressed: ()=>print('onPressed'), child: Text('Button'))
    ))
)

Libraries

if_widget