Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

flutter conditional parent widget

return includeBlueContainer  ? blueWidget() : redWidget();

Widget blueWidget() {
return Container(
  color: Colors.blue,
  child: Container(
    child: Text("Child"),
  ),
)
}

Widget redWidget() {
return Container(
  color: Colors.red,
  child: Container(
    child: Text("Child"),
  ),
)
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #flutter #conditional #parent #widget
ADD COMMENT
Topic
Name
7+8 =