Picker constructor

Picker({
  1. required PickerAdapter adapter,
  2. List<PickerDelimiter>? delimiter,
  3. List<int>? selecteds,
  4. double height = 150.0,
  5. double itemExtent = 28.0,
  6. EdgeInsetsGeometry? columnPadding,
  7. TextStyle? textStyle,
  8. TextStyle? cancelTextStyle,
  9. TextStyle? confirmTextStyle,
  10. TextStyle? selectedTextStyle,
  11. IconThemeData? selectedIconTheme,
  12. TextAlign textAlign = TextAlign.start,
  13. double? textScaleFactor,
  14. Widget? title,
  15. Color? backgroundColor = Colors.white,
  16. Color? containerColor,
  17. Color? headerColor,
  18. WidgetBuilder? builderHeader,
  19. bool hideHeader = false,
  20. bool reversedOrder = false,
  21. Decoration? headerDecoration,
  22. List<int>? columnFlex,
  23. Widget? footer,
  24. int smooth = 0,
  25. double magnification = 1.0,
  26. double diameterRatio = 1.1,
  27. double squeeze = 1.45,
  28. Widget selectionOverlay = const CupertinoPickerDefaultSelectionOverlay(),
  29. PickerItemBuilder? onBuilderItem,
  30. VoidCallback? onCancel,
  31. Pickerset? onchanged,
  32. int? yearfrom,
  33. int? yearto,
})

Implementation

Picker(
    {required this.adapter,
    this.delimiter,
    List<int>? selecteds,
    this.height = 150.0,
    this.itemExtent = 28.0,
    this.columnPadding,
    this.textStyle,
    this.cancelTextStyle,
    this.confirmTextStyle,
    this.selectedTextStyle,
    this.selectedIconTheme,
    this.textAlign = TextAlign.start,
    this.textScaleFactor,
    this.title,
    this.backgroundColor = Colors.white,
    this.containerColor,
    this.headerColor,
    this.builderHeader,
    this.hideHeader = false,
   this.reversedOrder = false,
    this.headerDecoration,
    this.columnFlex,
    this.footer,
    this.smooth = 0,
    this.magnification = 1.0,
    this.diameterRatio = 1.1,
    this.squeeze = 1.45,
    this.selectionOverlay = const CupertinoPickerDefaultSelectionOverlay(),
    this.onBuilderItem,
    this.onCancel,
    this.onchanged,
    this.yearfrom,this.yearto
    } ) {
    if(this.yearfrom!=null &&this.yearto!=null){
         var start=this.yearfrom;
        var end=this.yearto;
          if(int.parse(start.toString())<int.parse(end.toString())){
             for(var i=start;i!<=end!;i++){
            Generateyears.add(i.toString());
           }
          }
          else{
            for(var i=1990;i<=2050;i++){
            Generateyears.add(i.toString());
           }
          }
      }
      else if(this.yearfrom!=null &&this.yearto==null){
        var start=this.yearfrom;

           for(var i=start;i!<=2050;i++){
            Generateyears.add(i.toString());
           }
      }
      else{
         for(var i=1990;i<=2050;i++){
            Generateyears.add(i.toString());
           }
      }

  this.selecteds = selecteds == null ? <int>[] : selecteds;
}