Picker constructor
Picker({
- required PickerAdapter adapter,
- List<
PickerDelimiter> ? delimiter, - List<
int> ? selecteds, - double height = 150.0,
- double itemExtent = 28.0,
- EdgeInsetsGeometry? columnPadding,
- TextStyle? textStyle,
- TextStyle? cancelTextStyle,
- TextStyle? confirmTextStyle,
- TextStyle? selectedTextStyle,
- IconThemeData? selectedIconTheme,
- TextAlign textAlign = TextAlign.start,
- double? textScaleFactor,
- Widget? title,
- Color? backgroundColor = Colors.white,
- Color? containerColor,
- Color? headerColor,
- WidgetBuilder? builderHeader,
- bool hideHeader = false,
- bool reversedOrder = false,
- Decoration? headerDecoration,
- List<
int> ? columnFlex, - int smooth = 0,
- double magnification = 1.0,
- double diameterRatio = 1.1,
- double squeeze = 1.45,
- Widget selectionOverlay = const CupertinoPickerDefaultSelectionOverlay(),
- PickerItemBuilder? onBuilderItem,
- VoidCallback? onCancel,
- Pickerset? onchanged,
- int? yearfrom,
- 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;
}