switch satement to show a widget flutter code example
Example 1: conditionalstatement in widget flutter
Container(
color: Colors.white,
child: ('condition')
? Widget1(...)
: Widget2(...)
)
Example 2: flutter stateful widget
class YellowBird extends StatefulWidget {
const YellowBird({ Key key }) : super(key: key);
@override
_YellowBirdState createState() => _YellowBirdState();
}
class _YellowBirdState extends State<YellowBird> {
@override
Widget build(BuildContext context) {
return Container(color: const Color(0xFFFFE306));
}
}