if_widget 0.0.3

Flutter Android iOS web

An if statement widget.

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'))
    ))
)