@@ -75,6 +75,7 @@ class DatePickerThemeData with Diagnosticable {
75
75
this .inputDecorationTheme,
76
76
this .cancelButtonStyle,
77
77
this .confirmButtonStyle,
78
+ this .locale,
78
79
});
79
80
80
81
/// Overrides the default value of [Dialog.backgroundColor] .
@@ -347,6 +348,10 @@ class DatePickerThemeData with Diagnosticable {
347
348
/// Overrides the default style of the confirm (OK) button of a [DatePickerDialog] .
348
349
final ButtonStyle ? confirmButtonStyle;
349
350
351
+ /// An optional [locale] argument can be used to set the locale for the date
352
+ /// picker. It defaults to the ambient locale provided by [Localizations] .
353
+ final Locale ? locale;
354
+
350
355
/// Creates a copy of this object with the given fields replaced with the
351
356
/// new values.
352
357
DatePickerThemeData copyWith ({
@@ -387,6 +392,7 @@ class DatePickerThemeData with Diagnosticable {
387
392
InputDecorationTheme ? inputDecorationTheme,
388
393
ButtonStyle ? cancelButtonStyle,
389
394
ButtonStyle ? confirmButtonStyle,
395
+ Locale ? locale,
390
396
}) {
391
397
return DatePickerThemeData (
392
398
backgroundColor: backgroundColor ?? this .backgroundColor,
@@ -426,6 +432,7 @@ class DatePickerThemeData with Diagnosticable {
426
432
inputDecorationTheme: inputDecorationTheme ?? this .inputDecorationTheme,
427
433
cancelButtonStyle: cancelButtonStyle ?? this .cancelButtonStyle,
428
434
confirmButtonStyle: confirmButtonStyle ?? this .confirmButtonStyle,
435
+ locale: locale ?? this .locale,
429
436
);
430
437
}
431
438
@@ -472,6 +479,7 @@ class DatePickerThemeData with Diagnosticable {
472
479
inputDecorationTheme: t < 0.5 ? a? .inputDecorationTheme : b? .inputDecorationTheme,
473
480
cancelButtonStyle: ButtonStyle .lerp (a? .cancelButtonStyle, b? .cancelButtonStyle, t),
474
481
confirmButtonStyle: ButtonStyle .lerp (a? .confirmButtonStyle, b? .confirmButtonStyle, t),
482
+ locale: t < 0.5 ? a? .locale : b? .locale,
475
483
);
476
484
}
477
485
@@ -524,6 +532,7 @@ class DatePickerThemeData with Diagnosticable {
524
532
inputDecorationTheme,
525
533
cancelButtonStyle,
526
534
confirmButtonStyle,
535
+ locale,
527
536
]);
528
537
529
538
@override
@@ -568,7 +577,8 @@ class DatePickerThemeData with Diagnosticable {
568
577
&& other.dividerColor == dividerColor
569
578
&& other.inputDecorationTheme == inputDecorationTheme
570
579
&& other.cancelButtonStyle == cancelButtonStyle
571
- && other.confirmButtonStyle == confirmButtonStyle;
580
+ && other.confirmButtonStyle == confirmButtonStyle
581
+ && other.locale == locale;
572
582
}
573
583
574
584
@override
@@ -611,6 +621,7 @@ class DatePickerThemeData with Diagnosticable {
611
621
properties.add (DiagnosticsProperty <InputDecorationTheme >('inputDecorationTheme' , inputDecorationTheme, defaultValue: null ));
612
622
properties.add (DiagnosticsProperty <ButtonStyle >('cancelButtonStyle' , cancelButtonStyle, defaultValue: null ));
613
623
properties.add (DiagnosticsProperty <ButtonStyle >('confirmButtonStyle' , confirmButtonStyle, defaultValue: null ));
624
+ properties.add (DiagnosticsProperty <Locale >('locale' , locale, defaultValue: null ));
614
625
}
615
626
}
616
627
0 commit comments