The constructor is very easy to know because we have known the types of its parameters. I will give an example to them.
titlePadding&contentPadding
The title is a widget, the children is a list of the widgets, this is easy to understand. The titlePadding controls the padding of the title, the contentPadding controls the padding of the children. Let's see an example.
Widget_padDialog() =>SimpleDialog( title:Text("Do you know why?", textAlign:TextAlign.center, ), titlePadding:EdgeInsets.symmetric( horizontal:30, vertical:20, ), children:<Widget>[Text("Sometime,we learn very well,because we want to it.", textAlign:TextAlign.center, ) ], contentPadding:EdgeInsets.symmetric( horizontal:40, vertical:20, ), );
Let's see the effect of our code.
backgroundColor& elevation
The backgroundColor is a Color, the elevation controls the shadow of the widget, those are common parameters that we have used them before. I just give an example.
Widget_colorDialog() =>SimpleDialog( title:Text("Message", textAlign:TextAlign.center, ), children:<Widget>[Text("You must learn it carefully.", textAlign:TextAlign.center, ), ], backgroundColor:RED, elevation:4, );
It will show like this. The color of the background will change to RED.The shadow becomes less.
shape
The is also the same as the shape of Container, you can check it in that article. I just give you an example.
Widget_shapeDialog() =>SimpleDialog( title:Text("Be careful!", textAlign:TextAlign.center, ), children:<Widget>[Text("If you write a message, you should care about the message.", textAlign:TextAlign.center, ), ], backgroundColor:BLUE_LIGHT, elevation:4, shape:StadiumBorder( side:BorderSide( style:BorderStyle.none, ), ), );
It will show as below.
Conclusion
From this article, you can learn how to implement the dialog with the SimpleDialog widget. It is easy to use, so I don't give the detail of many parameters. If you a newer, you should read the other articles before.