show method
Implementation
show(BuildContext context) {
ClipRRect? image;
if (topImage != null) {
image = ClipRRect(
child: new Image(image: topImage!),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(cornerRadius),
topRight: Radius.circular(cornerRadius)),
);
}
if (title != null && description != null) {
insertByIndex(titlePadding, title, 0);
insertByIndex(descriptionPadding, description, 1);
}
if (title != null && description == null) {
insertByIndex(titlePadding, title, 0);
}
if (description != null && title == null) {
insertByIndex(descriptionPadding, description, 0);
}
contentList?.forEach((element) {
insertByIndex(EdgeInsets.zero, element, _contentList.length);
});
return showDialog(
context: context,
barrierDismissible: true,
builder: (BuildContext context) {
return Material(
color: Colors.transparent,
child: Container(
color: Color.fromRGBO(0, 0, 0, fogOpacity),
child: new Center(
child: new Container(
decoration: BoxDecoration(
boxShadow: <BoxShadow>[
new BoxShadow(
spreadRadius: 1.0,
color: Colors.black54,
offset: new Offset(5.0, 5.0),
blurRadius: 30.0,
)
],
borderRadius:
BorderRadius.all(Radius.circular(cornerRadius)),
color: cardColor,
),
height: height,
width: width,
child: new Column(
children: <Widget>[
Stack(
children: <Widget>[
image == null
? Container(
alignment: Alignment.center,
height: height,
padding: contentPadding,
child: Column(
crossAxisAlignment: contentListAlignment,
mainAxisAlignment: MainAxisAlignment.center,
children: _contentList,
),
)
: image,
closeButton == true
? Container(
margin: EdgeInsets.only(top: 8),
height: 26,
alignment: Alignment.topRight,
child: FloatingActionButton(
onPressed: () {
Navigator.pop(context);
},
child: Icon(
Icons.close,
color: Colors.black87,
size: 19,
),
backgroundColor:
Color.fromRGBO(240, 240, 240, 0.8),
elevation: 2,
),
)
: Container(),
],
),
image == null
? Container()
: Expanded(
child: Container(
padding: contentPadding,
child: Column(
crossAxisAlignment: contentListAlignment,
mainAxisAlignment: MainAxisAlignment.end,
children: _contentList,
),
),
),
],
)),
),
),
);
},
);
}