@@ -12,13 +12,13 @@ import 'package:reactive_forms/reactive_forms.dart';
1212/// that is bound to [ReactiveMonthPickerDialog] .
1313
1414/// This is a convenience widget that wraps the function
15- /// [showDatePicker] and [showTimePicker ] in a [ReactiveMonthPickerDialog] .
15+ /// [showMonthPicker ] in a [ReactiveMonthPickerDialog] .
1616///
1717/// The [formControlName] is required to bind this [ReactiveMonthPickerDialog]
1818/// to a [FormControl] .
1919///
20- /// For documentation about the various parameters, see the [showDatePicker ]
21- /// and [showTimePicker] function parameters.
20+ /// For documentation about the various parameters, see the [showMonthPicker ]
21+ /// function parameters.
2222///
2323/// ## Example:
2424///
@@ -28,7 +28,7 @@ import 'package:reactive_forms/reactive_forms.dart';
2828/// )
2929/// ```
3030class ReactiveMonthPickerDialog extends ReactiveFormField <DateTime , String > {
31- /// Creates a [ReactiveMonthPickerDialog] that wraps the function [showDatePicker ] .
31+ /// Creates a [ReactiveMonthPickerDialog] that wraps the function [showMonthPicker ] .
3232 ///
3333 /// Can optionally provide a [formControl] to bind this widget to a control.
3434 ///
@@ -38,59 +38,37 @@ class ReactiveMonthPickerDialog extends ReactiveFormField<DateTime, String> {
3838 /// Must provide one of the arguments [formControl] or a [formControlName] ,
3939 /// but not both at the same time.
4040 ///
41- /// The parameter [transitionBuilder] is the equivalent of [builder]
42- /// parameter in the [showTimePicker] .
43- ///
44- /// For documentation about the various parameters, see the [showTimePicker]
41+ /// For documentation about the various parameters, see the [showMonthPicker]
4542 /// function parameters.
46- ReactiveMonthPickerDialog (
47- { super .key,
48- super .formControlName,
49- super .formControl,
50- super .validationMessages,
51- ControlValueAccessor <DateTime , String >? valueAccessor,
52- super .showErrors,
43+ ReactiveMonthPickerDialog ({
44+ super .key,
45+ super .formControlName,
46+ super .formControl,
47+ super .validationMessages,
48+ ControlValueAccessor <DateTime , String >? valueAccessor,
49+ super .showErrors,
5350
54- ////////////////////////////////////////////////////////////////////////////
55- InputDecoration ? decoration,
56- bool showClearIcon = true ,
57- Widget clearIcon = const Icon (Icons .clear),
58- TextStyle ? style,
59- DateTime ? firstDate,
60- DateTime ? lastDate,
61- Locale ? locale,
62- bool Function (DateTime )? selectableMonthPredicate,
63- bool capitalizeFirstLetter = true ,
64- Color ? headerColor,
65- Color ? headerTextColor,
66- Color ? selectedMonthBackgroundColor,
67- Color ? backgroundColor,
68- Color ? selectedMonthTextColor,
69- Color ? unselectedMonthTextColor,
70- Color ? currentMonthTextColor,
71- Widget ? confirmText,
72- Widget ? cancelText,
73- double ? customHeight,
74- double customWidth = 320 ,
75- bool yearFirst = false ,
76- bool dismissible = false ,
77- double roundedCornersRadius = 0 ,
78- bool forceSelectedDate = false ,
79- ButtonStyle ? Function (DateTime )? monthStylePredicate,
80- ButtonStyle ? Function (int )? yearStylePredicate,
81- double selectedMonthPadding = 0 ,
82- int animationMilliseconds = 450 ,
83- bool hideHeaderRow = false ,
84- double ? textScaleFactor,
85- double ? arrowSize,
86- bool forcePortrait = false ,
87- Widget ? customDivider,
88- bool blockScrolling = true ,
89- BorderSide dialogBorderSide = BorderSide .none})
90- : super (
51+ ////////////////////////////////////////////////////////////////////////////
52+ InputDecoration ? decoration,
53+ bool showClearIcon = true ,
54+ Widget clearIcon = const Icon (Icons .clear),
55+ TextStyle ? style,
56+ DateTime ? firstDate,
57+ DateTime ? lastDate,
58+ Locale ? locale,
59+ bool Function (DateTime )? selectableMonthPredicate,
60+ bool Function (int )? selectableYearPredicate,
61+ ButtonStyle ? Function (DateTime )? monthStylePredicate,
62+ ButtonStyle ? Function (int )? yearStylePredicate,
63+ Widget ? headerTitle,
64+ bool onlyYear = false ,
65+ MonthPickerDialogSettings monthPickerDialogSettings =
66+ defaultMonthPickerDialogSettings,
67+ }) : super (
9168 valueAccessor: valueAccessor ??
9269 DateTimeValueAccessor (
93- dateTimeFormat: DateFormat ('yyyy/MM' ),
70+ dateTimeFormat:
71+ onlyYear ? DateFormat .y () : DateFormat ('yyyy/MM' ),
9472 ),
9573 builder: (field) {
9674 Widget ? suffixIcon = decoration? .suffixIcon;
@@ -127,35 +105,13 @@ class ReactiveMonthPickerDialog extends ReactiveFormField<DateTime, String> {
127105 ),
128106 firstDate: firstDate ?? DateTime (1900 ),
129107 lastDate: effectiveLastDate,
130- locale: locale,
131108 selectableMonthPredicate: selectableMonthPredicate,
132- capitalizeFirstLetter: capitalizeFirstLetter,
133- headerColor: headerColor,
134- headerTextColor: headerTextColor,
135- selectedMonthBackgroundColor: selectedMonthBackgroundColor,
136- selectedMonthTextColor: selectedMonthTextColor,
137- unselectedMonthTextColor: unselectedMonthTextColor,
138- confirmWidget: confirmText,
139- cancelWidget: cancelText,
140- customHeight: customHeight,
141- customWidth: customWidth,
142- yearFirst: yearFirst,
143- dismissible: dismissible,
144- roundedCornersRadius: roundedCornersRadius,
145- forceSelectedDate: forceSelectedDate,
146- backgroundColor: backgroundColor,
109+ selectableYearPredicate: selectableYearPredicate,
147110 monthStylePredicate: monthStylePredicate,
148111 yearStylePredicate: yearStylePredicate,
149- currentMonthTextColor: currentMonthTextColor,
150- selectedMonthPadding: selectedMonthPadding,
151- animationMilliseconds: animationMilliseconds,
152- hideHeaderRow: hideHeaderRow,
153- textScaleFactor: textScaleFactor,
154- arrowSize: arrowSize,
155- forcePortrait: forcePortrait,
156- customDivider: customDivider,
157- blockScrolling: blockScrolling,
158- dialogBorderSide: dialogBorderSide,
112+ headerTitle: headerTitle,
113+ monthPickerDialogSettings: monthPickerDialogSettings,
114+ onlyYear: onlyYear,
159115 );
160116
161117 field.didChange (
0 commit comments