if (listtag.length > 0) {
return showDialog<Null>(
context: context,
builder: (BuildContext context) {
var listtag2 = result['data']['list'];
return StatefulBuilder(
builder: (context, state) {
return SimpleDialog(
children: <Widget>[
Container(
alignment: Alignment.centerRight,
child: Padding(
padding: EdgeInsets.only(
top: 0.0, left: 0.0, right: 10.0, bottom: 0.0),
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context).pop();
},
child: Icon(
Icons.close,
color: Color(0xFFC6C6C6),
size: 20.0,
),
),
),
width: ScreenUtil.getInstance().setWidth(300),
),
Padding(
padding: EdgeInsets.only(
top: 0.0,
left: 0.0,
right: 0.0,
bottom: ScreenUtil.getInstance().setWidth(70)),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'選擇或刪除咨詢類型',
style: new TextStyle(
fontSize: ScreenUtil.getInstance().setSp(30),
color: Color(0xFF333333)),
),
],
),
),
Container(
alignment: Alignment.topCenter,
width: MediaQuery.of(context).size.width,
height: 100,
color: Color(0xFFffffff),
margin: EdgeInsets.only(
top: 0.0, left: 10.0, right: 10.0, bottom: 0.0),
child: GridView.builder(
physics: NeverScrollableScrollPhysics(),
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
mainAxisSpacing: 0,
// 竖向间距
crossAxisCount: 2,
childAspectRatio: 10 / 3,
// 横向 Item 的个数
crossAxisSpacing: 10.0,
// childAspectRatio: 1,
),
scrollDirection: Axis.vertical,
itemCount: listtag2.length,
itemBuilder: (BuildContext context, int index) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
listtag2[index]['isCheck'] =
listtag2[index]['isCheck']==0 ? 1 : 0;
state(() {
listtag2 = listtag2;
});
},
child: tagitem(listtag[index], index),
);
},
),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context).pop();
},
child: Container(
height: ScreenUtil.getInstance().setWidth(60),
alignment: Alignment.center,
margin: EdgeInsets.only(
top: 0.0,
left: ScreenUtil.getInstance().setWidth(150),
right: ScreenUtil.getInstance().setWidth(150),
bottom: 0.0),
decoration: new BoxDecoration(
color: Color(0xFF1BB3B2),
borderRadius: BorderRadius.circular(
ScreenUtil.getInstance().setWidth(30)),
),
child: Text(
'確認',
style: new TextStyle(
fontSize: ScreenUtil.getInstance().setSp(32),
color: Color(0xFFffffff)),
),
),
),
],
);
},
);
},
).then((val) {
print(val);
});
} else {
Fluttertoast.showToast(
msg: '没有可选标签',
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.CENTER,
);
}