class CustomFlatButton extends StatefulWidget {
String ButtonName="";
CustomFlatButton(String ButtonName){
this.ButtonName=ButtonName;
}
@override
_CustomFlatButtonState createState() => _CustomFlatButtonState(ButtonName);
}
class _CustomFlatButtonState extends State<CustomFlatButton> {
String ButtonName="";
_CustomFlatButtonState(String ButtonName){
this.ButtonName=ButtonName;
}
@override
Widget build(BuildContext context) {
return FlatButton(
color: Colors.blue,
textColor: Colors.white,
disabledColor: Colors.grey,
disabledTextColor: Colors.black,
padding: EdgeInsets.all(8.0),
splashColor: Colors.blueAccent,
onPressed: () {
ListWheelScrollView(itemExtent: 31,useMagnifier: true,magnification: 1.5,children: <Widget>[
Container(color: Colors.red,height: 200,width: 200)
],);
},
child: Text(
ButtonName,
style: TextStyle(fontSize: 20.0),
),
);
}
}
How to render a widget when users click the Button. Here in the code
onPressed: () {
ListWheelScrollView(itemExtent: 31,useMagnifier: true,magnification: 1.5,children: <Widget>[
Container(color: Colors.red,height: 200,width: 200)
],);
}
I want to display a ListWheelScrollView Widget on pressing the button means when button is pressed then a ListWheelScrollView should be displayed.
I am new to flutter. Please let me know if you find any difficulty in understanding my question