Skip to content

Commit e676024

Browse files
authored
[Material] Redesign Time Picker (flutter#59191)
1 parent 2cd205b commit e676024

File tree

8 files changed

+2395
-1270
lines changed

8 files changed

+2395
-1270
lines changed

packages/flutter/lib/material.dart

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ export 'src/material/theme.dart';
124124
export 'src/material/theme_data.dart';
125125
export 'src/material/time.dart';
126126
export 'src/material/time_picker.dart';
127+
export 'src/material/time_picker_theme.dart';
127128
export 'src/material/toggle_buttons.dart';
128129
export 'src/material/toggle_buttons_theme.dart';
129130
export 'src/material/toggleable.dart';

packages/flutter/lib/src/material/theme_data.dart

+15
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import 'slider_theme.dart';
3535
import 'snack_bar_theme.dart';
3636
import 'tab_bar_theme.dart';
3737
import 'text_theme.dart';
38+
import 'time_picker_theme.dart';
3839
import 'toggle_buttons_theme.dart';
3940
import 'tooltip_theme.dart';
4041
import 'typography.dart';
@@ -269,6 +270,7 @@ class ThemeData with Diagnosticable {
269270
DividerThemeData dividerTheme,
270271
ButtonBarThemeData buttonBarTheme,
271272
BottomNavigationBarThemeData bottomNavigationBarTheme,
273+
TimePickerThemeData timePickerTheme,
272274
bool fixTextFieldOutlineLabel,
273275
}) {
274276
assert(colorScheme?.brightness == null || brightness == null || colorScheme.brightness == brightness);
@@ -380,6 +382,7 @@ class ThemeData with Diagnosticable {
380382
dividerTheme ??= const DividerThemeData();
381383
buttonBarTheme ??= const ButtonBarThemeData();
382384
bottomNavigationBarTheme ??= const BottomNavigationBarThemeData();
385+
timePickerTheme ??= const TimePickerThemeData();
383386

384387
fixTextFieldOutlineLabel ??= false;
385388

@@ -448,6 +451,7 @@ class ThemeData with Diagnosticable {
448451
dividerTheme: dividerTheme,
449452
buttonBarTheme: buttonBarTheme,
450453
bottomNavigationBarTheme: bottomNavigationBarTheme,
454+
timePickerTheme: timePickerTheme,
451455
fixTextFieldOutlineLabel: fixTextFieldOutlineLabel,
452456
);
453457
}
@@ -527,6 +531,7 @@ class ThemeData with Diagnosticable {
527531
@required this.dividerTheme,
528532
@required this.buttonBarTheme,
529533
@required this.bottomNavigationBarTheme,
534+
@required this.timePickerTheme,
530535
@required this.fixTextFieldOutlineLabel,
531536
}) : assert(visualDensity != null),
532537
assert(primaryColor != null),
@@ -589,6 +594,7 @@ class ThemeData with Diagnosticable {
589594
assert(dividerTheme != null),
590595
assert(buttonBarTheme != null),
591596
assert(bottomNavigationBarTheme != null),
597+
assert(timePickerTheme != null),
592598
assert(fixTextFieldOutlineLabel != null);
593599

594600
/// Create a [ThemeData] based on the colors in the given [colorScheme] and
@@ -1036,6 +1042,9 @@ class ThemeData with Diagnosticable {
10361042
/// widgets.
10371043
final BottomNavigationBarThemeData bottomNavigationBarTheme;
10381044

1045+
/// A theme for customizing the appearance and layout of time picker widgets.
1046+
final TimePickerThemeData timePickerTheme;
1047+
10391048
/// A temporary flag to allow apps to opt-in to a
10401049
/// [small fix](https://github.com/flutter/flutter/issues/54028) for the Y
10411050
/// coordinate of the floating label in a [TextField] [OutlineInputBorder].
@@ -1117,6 +1126,7 @@ class ThemeData with Diagnosticable {
11171126
DividerThemeData dividerTheme,
11181127
ButtonBarThemeData buttonBarTheme,
11191128
BottomNavigationBarThemeData bottomNavigationBarTheme,
1129+
TimePickerThemeData timePickerTheme,
11201130
bool fixTextFieldOutlineLabel,
11211131
}) {
11221132
cupertinoOverrideTheme = cupertinoOverrideTheme?.noDefault();
@@ -1185,6 +1195,7 @@ class ThemeData with Diagnosticable {
11851195
dividerTheme: dividerTheme ?? this.dividerTheme,
11861196
buttonBarTheme: buttonBarTheme ?? this.buttonBarTheme,
11871197
bottomNavigationBarTheme: bottomNavigationBarTheme ?? this.bottomNavigationBarTheme,
1198+
timePickerTheme: timePickerTheme ?? this.timePickerTheme,
11881199
fixTextFieldOutlineLabel: fixTextFieldOutlineLabel ?? this.fixTextFieldOutlineLabel,
11891200
);
11901201
}
@@ -1331,6 +1342,7 @@ class ThemeData with Diagnosticable {
13311342
dividerTheme: DividerThemeData.lerp(a.dividerTheme, b.dividerTheme, t),
13321343
buttonBarTheme: ButtonBarThemeData.lerp(a.buttonBarTheme, b.buttonBarTheme, t),
13331344
bottomNavigationBarTheme: BottomNavigationBarThemeData.lerp(a.bottomNavigationBarTheme, b.bottomNavigationBarTheme, t),
1345+
timePickerTheme: TimePickerThemeData.lerp(a.timePickerTheme, b.timePickerTheme, t),
13341346
fixTextFieldOutlineLabel: t < 0.5 ? a.fixTextFieldOutlineLabel : b.fixTextFieldOutlineLabel,
13351347
);
13361348
}
@@ -1405,6 +1417,7 @@ class ThemeData with Diagnosticable {
14051417
&& other.dividerTheme == dividerTheme
14061418
&& other.buttonBarTheme == buttonBarTheme
14071419
&& other.bottomNavigationBarTheme == bottomNavigationBarTheme
1420+
&& other.timePickerTheme == timePickerTheme
14081421
&& other.fixTextFieldOutlineLabel == fixTextFieldOutlineLabel;
14091422
}
14101423

@@ -1478,6 +1491,7 @@ class ThemeData with Diagnosticable {
14781491
dividerTheme,
14791492
buttonBarTheme,
14801493
bottomNavigationBarTheme,
1494+
timePickerTheme,
14811495
fixTextFieldOutlineLabel,
14821496
];
14831497
return hashList(values);
@@ -1547,6 +1561,7 @@ class ThemeData with Diagnosticable {
15471561
properties.add(DiagnosticsProperty<MaterialBannerThemeData>('bannerTheme', bannerTheme, defaultValue: defaultData.bannerTheme, level: DiagnosticLevel.debug));
15481562
properties.add(DiagnosticsProperty<DividerThemeData>('dividerTheme', dividerTheme, defaultValue: defaultData.dividerTheme, level: DiagnosticLevel.debug));
15491563
properties.add(DiagnosticsProperty<ButtonBarThemeData>('buttonBarTheme', buttonBarTheme, defaultValue: defaultData.buttonBarTheme, level: DiagnosticLevel.debug));
1564+
properties.add(DiagnosticsProperty<TimePickerThemeData>('timePickerTheme', timePickerTheme, defaultValue: defaultData.timePickerTheme, level: DiagnosticLevel.debug));
15501565
properties.add(DiagnosticsProperty<BottomNavigationBarThemeData>('bottomNavigationBarTheme', bottomNavigationBarTheme, defaultValue: defaultData.bottomNavigationBarTheme, level: DiagnosticLevel.debug));
15511566
}
15521567
}

0 commit comments

Comments
 (0)