mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-06-20 20:38:33 +08:00
fix(修复DialogDemo, 无法关闭的问题):
This commit is contained in:
@ -22,7 +22,21 @@ class _Demo extends State<DialogDemo> {
|
|||||||
barrierDismissible: false, // user must tap button!
|
barrierDismissible: false, // user must tap button!
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return Dialog(
|
return Dialog(
|
||||||
child: Text("我是一个Dialog"),
|
child: Container(
|
||||||
|
height: 100,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: <Widget>[
|
||||||
|
Text('我是一个dialog'),
|
||||||
|
RaisedButton(
|
||||||
|
child: Text('取消'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -63,15 +77,30 @@ class _DialogMoreDemo extends State<DialogMoreDemo> {
|
|||||||
return StatefulBuilder(
|
return StatefulBuilder(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return Dialog(
|
return Dialog(
|
||||||
child: RaisedButton(
|
child: Container(
|
||||||
|
height: 150,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: <Widget>[
|
||||||
|
Text('我是一个dialog'),
|
||||||
|
RaisedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
print("print $value");
|
|
||||||
state(() {
|
state(() {
|
||||||
value += 1;
|
value += 1;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: Text("我是一个Dialog, 点我更新value: $value"),
|
child: Text("我是一个Dialog, 点我更新value: $value"),
|
||||||
|
),
|
||||||
|
RaisedButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
child: Text("取消"),
|
||||||
)
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user