52 lines
1.2 KiB
Dart
52 lines
1.2 KiB
Dart
import 'package:awesome_dialog/awesome_dialog.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
BoxDecoration buildBoxDecoration() {
|
|
return BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(12),
|
|
border: Border.all(color: Colors.grey[200]!, width: 1),
|
|
);
|
|
}
|
|
|
|
Container buildBody({Widget? child}) {
|
|
return Container(
|
|
color: Colors.grey[50],
|
|
padding: EdgeInsets.all(8),
|
|
child: child,
|
|
);
|
|
}
|
|
|
|
Container buildCard({Widget? child}) {
|
|
return Container(
|
|
decoration: buildBoxDecoration(),
|
|
padding: EdgeInsets.all(10),
|
|
child: child,
|
|
);
|
|
}
|
|
|
|
void showAwesomeDialog({
|
|
required BuildContext context,
|
|
required Widget body,
|
|
required VoidCallback onOk,
|
|
required VoidCallback onCancel,
|
|
}) {
|
|
AwesomeDialog(
|
|
context: context,
|
|
dialogType: DialogType.noHeader,
|
|
animType: AnimType.scale,
|
|
body: body,
|
|
dialogBackgroundColor: Colors.white,
|
|
btnOkText: "确认",
|
|
btnCancelText: "取消",
|
|
btnOkColor: Colors.orange,
|
|
btnCancelColor: Colors.grey,
|
|
buttonsBorderRadius: BorderRadius.circular(10),
|
|
headerAnimationLoop: false,
|
|
dismissOnTouchOutside: false,
|
|
dismissOnBackKeyPress: true,
|
|
btnOkOnPress: onOk,
|
|
btnCancelOnPress: onCancel,
|
|
).show();
|
|
}
|