按钮触发产生弹框,同时底色变按,
//showAlertDialog(context);
//showMyDialog(context);
// show(
// context: context, message: "发现新设备",message1: "目前支持LE1、部分润铂、云锦/云酷、空调"
// "伴侣、墙壁插座、GDC网关,支持机型持续更新,请以实际情况为准");
if (_overlayEntry != null) {
_overlayEntry.remove();
_overlayEntry = null;
return;
}
_overlayEntry = OverlayEntry(
builder:
(context) => Positioned.fill(
top: 0,
child: Material(
color:
Colors.black54, //设置背景暗色
child: Column(
children: [
Expanded(child:
GestureDetector(
onTap: () {
_overlayEntry
.remove();
_overlayEntry =
null;
})),
Container(
child:
new Container(
width:
Adapt.pixel(
674),
alignment:
Alignment
.center,
child:
new Center(
child:
new Card(
elevation:
1, //设置阴影
// shape: const RoundedRectangleBorder(
// borderRadius:
// BorderRadius.all(Radius.circular(14.0))), //设置圆角
child:
new Column(
// card只能有一个widget,但这个widget内容可以包含其他的widget
children: [
Stack(
overflow:
Overflow.visible,
children: <Widget>[
Container(
height: Adapt.pixel(60),
child: new ListTile(
title: new Text("发现新设备",
textAlign: TextAlign.center,
style: new TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
)),
),
),
Positioned(
top: Adapt.pixel(1),
right: Adapt.pixel(10),
child: IconButton(
icon: Image.asset('assets/image/icon/x.png', fit: BoxFit.cover, width: Adapt.pixel(42)),
onPressed: () {
if (_overlayEntry != null) {
_overlayEntry.remove();
_overlayEntry = null;
return;
}
},
))
]),
new ListTile(
contentPadding:
EdgeInsets.all(Adapt.pixel(42)),
title: new Text(
"目前支持LE1、部分润铂、云锦/云酷、空调"
"伴侣、墙壁插座、GDC网关,支持机型持续更新,请以实际情况为准",
textAlign: TextAlign.justify,
style: new TextStyle(
fontSize: 15,
)),
),
],
),
),
),
),
),
Expanded(child:
GestureDetector(
onTap: () {
_overlayEntry
.remove();
_overlayEntry =
null;
})),
],
),
),
));
Overlay.of(context)
.insert(_overlayEntry);
},
网友评论