mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-05-21 23:06:33 +08:00
64 lines
1.5 KiB
Dart
64 lines
1.5 KiB
Dart
/**
|
|
* Created with Android Studio.
|
|
* User: 三帆
|
|
* Date: 07/01/2019
|
|
* Time: 10:31
|
|
* email: sanfan.hx@alibaba-inc.com
|
|
* tartget: xxx
|
|
*/
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
class SimpleDialogDemo extends StatefulWidget {
|
|
_Demo createState() => _Demo();
|
|
}
|
|
|
|
class _Demo extends State<SimpleDialogDemo> {
|
|
|
|
void showAlertDialog(BuildContext context) {
|
|
showDialog<Null>(
|
|
context: context,
|
|
builder: (BuildContext context) {
|
|
return new SimpleDialog(
|
|
title: new Text('选择'),
|
|
children: <Widget>[
|
|
new SimpleDialogOption(
|
|
child: new Text('选项 1'),
|
|
onPressed: () {
|
|
Navigator.of(context).pop();
|
|
},
|
|
),
|
|
new SimpleDialogOption(
|
|
child: new Text('选项 2'),
|
|
onPressed: () {
|
|
Navigator.of(context).pop();
|
|
},
|
|
),
|
|
],
|
|
);
|
|
},
|
|
);
|
|
}
|
|
Widget build(BuildContext context) {
|
|
return new RaisedButton(
|
|
padding: new EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
|
|
//padding
|
|
child: new Text(
|
|
'show SimpleDialog',
|
|
style: new TextStyle(
|
|
fontSize: 18.0, //textsize
|
|
color: Colors.white, // textcolor
|
|
),
|
|
),
|
|
color: Theme.of(context).accentColor,
|
|
elevation: 4.0,
|
|
//shadow
|
|
splashColor: Colors.blueGrey,
|
|
onPressed: () {
|
|
showAlertDialog(context);
|
|
});
|
|
}
|
|
|
|
}
|