feat:重构代办事项模块
This commit is contained in:
51
lib/widgets/common.dart
Normal file
51
lib/widgets/common.dart
Normal file
@@ -0,0 +1,51 @@
|
||||
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();
|
||||
}
|
||||
Reference in New Issue
Block a user