feat(date):更新日期组件
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
/// A Calculator.
|
||||
class Calculator {
|
||||
/// Returns [value] plus 1.
|
||||
int addOne(int value) => value + 1;
|
||||
}
|
||||
library flutter_common;
|
||||
|
||||
export 'calendarcalendar/calendar_choose_widget.dart';
|
||||
export 'calendarcalendar/custom_calendar_range_picker_widget.dart';
|
||||
export 'calendarcalendar/custom_date_picker.dart';
|
||||
export 'utils/date_utils.dart';
|
||||
|
||||
@@ -59,100 +59,106 @@ class ToastUtils {
|
||||
bool isShowConfirm = false,
|
||||
Color? barrierColor,
|
||||
EdgeInsetsGeometry? padding,
|
||||
bool useSafeArea = true,
|
||||
bool useSafeArea = false,
|
||||
}) {
|
||||
cancelToast();
|
||||
return showDialog(
|
||||
useSafeArea: useSafeArea,
|
||||
context: context,
|
||||
builder: (BuildContext ctx) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
height: MediaQuery.of(context).size.height / 2,
|
||||
margin: EdgeInsets.only(
|
||||
top: height == null
|
||||
? MediaQuery.of(context).size.height / 2
|
||||
: (MediaQuery.of(context).size.height - height),
|
||||
),
|
||||
padding: padding ?? const EdgeInsets.only(bottom: 40),
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(12),
|
||||
topRight: Radius.circular(12),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
header ??
|
||||
Container(
|
||||
padding: const EdgeInsets.only(bottom: 5),
|
||||
decoration: const BoxDecoration(
|
||||
border: Border(
|
||||
bottom:
|
||||
BorderSide(color: Color(0xffE1E1E1), width: 0.5),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () => Navigator.of(context).pop(),
|
||||
child: Container(
|
||||
padding:
|
||||
const EdgeInsets.only(left: 6, right: 10),
|
||||
color: Colors.transparent,
|
||||
child: Icon(
|
||||
Icons.keyboard_arrow_down_rounded,
|
||||
size: leftIconSize ?? 40,
|
||||
final dialogHeight = height ?? MediaQuery.of(ctx).size.height / 2;
|
||||
final bottomInset = MediaQuery.of(ctx).padding.bottom;
|
||||
return Material(
|
||||
type: MaterialType.transparency,
|
||||
child: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: dialogHeight,
|
||||
padding: (padding ?? const EdgeInsets.only(bottom: 40))
|
||||
.add(EdgeInsets.only(bottom: bottomInset)),
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(12),
|
||||
topRight: Radius.circular(12),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
header ??
|
||||
Container(
|
||||
padding: const EdgeInsets.only(bottom: 5),
|
||||
decoration: const BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color: Color(0xffE1E1E1),
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
title ?? '头部',
|
||||
style: TextStyle(
|
||||
color: const Color(0xff333333),
|
||||
fontSize: titleFontSize ?? 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
child: Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () => Navigator.of(ctx).pop(),
|
||||
child: Container(
|
||||
padding:
|
||||
const EdgeInsets.only(left: 6, right: 10),
|
||||
color: Colors.transparent,
|
||||
child: Icon(
|
||||
Icons.keyboard_arrow_down_rounded,
|
||||
size: leftIconSize ?? 40,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
title ?? '头部',
|
||||
style: TextStyle(
|
||||
color: const Color(0xff333333),
|
||||
fontSize: titleFontSize ?? 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
if (isShowConfirm) {
|
||||
if (onConfirm != null) {
|
||||
onConfirm();
|
||||
Navigator.of(ctx).pop();
|
||||
}
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 10,
|
||||
top: 8,
|
||||
bottom: 8,
|
||||
right: 18,
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
color: Colors.transparent,
|
||||
child: Text(
|
||||
'确定',
|
||||
style: TextStyle(
|
||||
color: isShowConfirm
|
||||
? const Color(0xff4D6FD5)
|
||||
: Colors.transparent,
|
||||
fontSize: 16),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
if (isShowConfirm) {
|
||||
if (onConfirm != null) {
|
||||
onConfirm();
|
||||
Navigator.pop(context);
|
||||
}
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 10,
|
||||
top: 8,
|
||||
bottom: 8,
|
||||
right: 18,
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
color: Colors.transparent,
|
||||
child: Text(
|
||||
'确定',
|
||||
style: TextStyle(
|
||||
color: isShowConfirm
|
||||
? const Color(0xff4D6FD5)
|
||||
: Colors.transparent,
|
||||
fontSize: 16),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(child: contentWidget ?? const SizedBox())
|
||||
],
|
||||
),
|
||||
Expanded(child: contentWidget ?? const SizedBox())
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user