DatePicker constructor

DatePicker({
  1. required DateController controller,
  2. required ItemBuilder itemBuilder,
  3. Widget? startWidget,
  4. List<DateType> showColumn = const [DateType.YEAR, DateType.MONTH, DateType.DAY, DateType.HOUR, DateType.MINUTE],
  5. Widget? endWidget,
  6. DateTime? initStartDate,
  7. DateTime? initEndDate,
  8. BoxDecoration? pickerDecoration,
  9. double height = 500,
  10. bool scrollLoop = true,
  11. EdgeInsetsGeometry? padding,
  12. double vGap = 16,
  13. double pickerVisibilityHeight = 140,
  14. double itemWidth = 100,
  15. double maskHeight = 40,
  16. double maskRadius = 0,
  17. Color? maskColor = const Color.fromRGBO(242, 242, 244, 0.7),
  18. double? diameterRatio,
  19. Color? backgroundColor,
  20. double? offAxisFraction,
  21. bool? useMagnifier,
  22. double? magnification,
  23. double itemExtent = 40,
  24. double? squeeze,
  25. Widget? selectionOverlay,
  26. int forwardYears = 50,
  27. int totalYears = 110,
  28. Duration duration = const Duration(milliseconds: 300),
  29. Curve curve = Curves.easeInOutCubic,
  30. Widget? action,
  31. 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");
}