awesome_dialog
一个新 Flutter 包项目,用于简单而出色的对话框。
用法
要使用此包,请在您的pubspec.yaml文件中添加awesome_dialog作为依赖项。
并将此导入语句添加到您的文件中。
import 'package:awesome_dialog/awesome_dialog.dart';
Image

示例
AwesomeDialog(context: context,
dialogType: DialogType.INFO,
animType: AnimType.BOTTOMSLIDE,
tittle: 'Dialog Title',
desc: 'Dialog description here..................................................',
btnCancelOnPress: () {},
btnOkOnPress: () {}).show();
自定义主体
如果指定了主体,则将忽略标题和描述,这允许进一步自定义对话框。
AwesomeDialog(
context: context,
animType: AnimType.SCALE,
dialogType: DialogType.INFO,
body: Center(child: Text(
'If the body is specified, then title and description will be ignored, this allows to further customize the dialogue.',
style: TextStyle(fontStyle: FontStyle.italic),
),),
tittle: 'This is Ignored',
desc: 'This is also Ignored',
btnOkOnPress: () {},
).show();
自定义按钮
要使用自定义按钮,只需指定buttonOk或btnCancel小部件,所有文本参数、图标等都将被忽略。
关闭和回调
AwesomeDialog具有onDissmissCallback(),并且可以随时使用dissmiss()公共方法将其关闭。