Created
February 7, 2020 17:24
-
-
Save crizant/1205a9373bc470fa8e2d6e9a4a177755 to your computer and use it in GitHub Desktop.
Flutter conditional rendering plugin: if-else condition list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyWidget extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Column( | |
children: Conditional.list( | |
context: context, | |
conditionBuilder: (BuildContext context) => someCondition == true, | |
widgetBuilder: (BuildContext context) => <Widget>[ | |
Text('Widget A'), | |
Text('Widget B'), | |
], | |
fallbackBuilder: (BuildContext context) => <Widget>[ | |
Text('Widget C'), | |
Text('Widget D'), | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment