DatePicker constructor
DatePicker({
- required DateController controller,
- required ItemBuilder itemBuilder,
- Widget? startWidget,
- List<
DateType> showColumn = const [DateType.YEAR, DateType.MONTH, DateType.DAY, DateType.HOUR, DateType.MINUTE], - Widget? endWidget,
- DateTime? initStartDate,
- DateTime? initEndDate,
- BoxDecoration? pickerDecoration,
- double height = 500,
- bool scrollLoop = true,
- EdgeInsetsGeometry? padding,
- double vGap = 16,
- double pickerVisibilityHeight = 140,
- double itemWidth = 100,
- double maskHeight = 40,
- double maskRadius = 0,
- Color? maskColor = const Color.fromRGBO(242, 242, 244, 0.7),
- double? diameterRatio,
- Color? backgroundColor,
- double? offAxisFraction,
- bool? useMagnifier,
- double? magnification,
- double itemExtent = 40,
- double? squeeze,
- Widget? selectionOverlay,
- int forwardYears = 50,
- int totalYears = 110,
- Duration duration = const Duration(milliseconds: 300),
- Curve curve = Curves.easeInOutCubic,
- Widget? action,
- Key? key,
Implementation
DatePicker({
required this.controller,
required this.itemBuilder,
this.startWidget,
this.showColumn = const [
DateType.YEAR,
DateType.MONTH,
DateType.DAY,
DateType.HOUR,
DateType.MINUTE
],
this.endWidget,
this.initStartDate,
this.initEndDate,
this.pickerDecoration,
this.height = 500,
this.scrollLoop = true,
this.padding,
this.vGap = 16,
this.pickerVisibilityHeight = 140,
this.itemWidth = 100,
this.maskHeight = 40,
this.maskRadius = 0,
this.maskColor = const Color.fromRGBO(242, 242, 244, 0.7),
this.diameterRatio,
this.backgroundColor,
this.offAxisFraction,
this.useMagnifier,
this.magnification,
this.itemExtent = 40,
this.squeeze,
this.selectionOverlay,
this.forwardYears = 50,
this.totalYears = 110,
this.duration = const Duration(milliseconds: 300),
this.curve = Curves.easeInOutCubic,
this.action,
Key? key,
}) : super(key: key) {
assert(totalYears > forwardYears, "totalYears必须大于forwardYears");
}