@@ -340,9 +340,11 @@ class DatePickerDialog extends StatefulWidget {
340340 /// string. For example, 'Month, Day, Year' for en_US.
341341 final String ? fieldLabelText;
342342
343+ /// {@template flutter.material.datePickerDialog}
343344 /// The keyboard type of the [TextField] .
344345 ///
345346 /// If this is null, it will default to [TextInputType.datetime]
347+ /// {@endtemplate}
346348 final TextInputType ? keyboardType;
347349
348350 /// Restoration ID to save and restore the state of the [DatePickerDialog] .
@@ -991,6 +993,7 @@ Future<DateTimeRange?> showDateRangePicker({
991993 TextDirection ? textDirection,
992994 TransitionBuilder ? builder,
993995 Offset ? anchorPoint,
996+ TextInputType keyboardType = TextInputType .datetime,
994997}) async {
995998 assert (
996999 initialDateRange == null || ! initialDateRange.start.isAfter (initialDateRange.end),
@@ -1039,6 +1042,7 @@ Future<DateTimeRange?> showDateRangePicker({
10391042 fieldEndHintText: fieldEndHintText,
10401043 fieldStartLabelText: fieldStartLabelText,
10411044 fieldEndLabelText: fieldEndLabelText,
1045+ keyboardType: keyboardType,
10421046 );
10431047
10441048 if (textDirection != null ) {
@@ -1125,6 +1129,7 @@ class DateRangePickerDialog extends StatefulWidget {
11251129 this .fieldEndHintText,
11261130 this .fieldStartLabelText,
11271131 this .fieldEndLabelText,
1132+ this .keyboardType = TextInputType .datetime,
11281133 this .restorationId,
11291134 });
11301135
@@ -1231,6 +1236,9 @@ class DateRangePickerDialog extends StatefulWidget {
12311236 /// is used.
12321237 final String ? fieldEndLabelText;
12331238
1239+ /// {@macro flutter.material.datePickerDialog}
1240+ final TextInputType keyboardType;
1241+
12341242 /// Restoration ID to save and restore the state of the [DateRangePickerDialog] .
12351243 ///
12361244 /// If it is non-null, the date range picker will persist and restore the
@@ -1427,6 +1435,7 @@ class _DateRangePickerDialogState extends State<DateRangePickerDialog> with Rest
14271435 fieldEndHintText: widget.fieldEndHintText,
14281436 fieldStartLabelText: widget.fieldStartLabelText,
14291437 fieldEndLabelText: widget.fieldEndLabelText,
1438+ keyboardType: widget.keyboardType,
14301439 ),
14311440 const Spacer (),
14321441 ],
@@ -2773,6 +2782,7 @@ class _InputDateRangePicker extends StatefulWidget {
27732782 this .fieldEndLabelText,
27742783 this .autofocus = false ,
27752784 this .autovalidate = false ,
2785+ this .keyboardType = TextInputType .datetime,
27762786 }) : initialStartDate = initialStartDate == null ? null : DateUtils .dateOnly (initialStartDate),
27772787 initialEndDate = initialEndDate == null ? null : DateUtils .dateOnly (initialEndDate),
27782788 firstDate = DateUtils .dateOnly (firstDate),
@@ -2832,6 +2842,9 @@ class _InputDateRangePicker extends StatefulWidget {
28322842 /// [_InputDateRangePickerState.validate] to validate.
28332843 final bool autovalidate;
28342844
2845+ /// {@macro flutter.material.datePickerDialog}
2846+ final TextInputType keyboardType;
2847+
28352848 @override
28362849 _InputDateRangePickerState createState () => _InputDateRangePickerState ();
28372850}
@@ -2972,7 +2985,7 @@ class _InputDateRangePickerState extends State<_InputDateRangePicker> {
29722985 labelText: widget.fieldStartLabelText ?? localizations.dateRangeStartLabel,
29732986 errorText: _startErrorText,
29742987 ),
2975- keyboardType: TextInputType .datetime ,
2988+ keyboardType: widget.keyboardType ,
29762989 onChanged: _handleStartChanged,
29772990 autofocus: widget.autofocus,
29782991 ),
@@ -2988,7 +3001,7 @@ class _InputDateRangePickerState extends State<_InputDateRangePicker> {
29883001 labelText: widget.fieldEndLabelText ?? localizations.dateRangeEndLabel,
29893002 errorText: _endErrorText,
29903003 ),
2991- keyboardType: TextInputType .datetime ,
3004+ keyboardType: widget.keyboardType ,
29923005 onChanged: _handleEndChanged,
29933006 ),
29943007 ),
0 commit comments