@@ -348,7 +348,8 @@ class ThemeData with Diagnosticable {
348
348
SliderThemeData ? sliderTheme,
349
349
SnackBarThemeData ? snackBarTheme,
350
350
SwitchThemeData ? switchTheme,
351
- TabBarTheme ? tabBarTheme,
351
+ // TODO(QuncCccccc): Change the parameter type to TabBarThemeData
352
+ Object ? tabBarTheme,
352
353
TextButtonThemeData ? textButtonTheme,
353
354
TextSelectionThemeData ? textSelectionTheme,
354
355
TimePickerThemeData ? timePickerTheme,
@@ -541,7 +542,15 @@ class ThemeData with Diagnosticable {
541
542
sliderTheme ?? = const SliderThemeData ();
542
543
snackBarTheme ?? = const SnackBarThemeData ();
543
544
switchTheme ?? = const SwitchThemeData ();
544
- tabBarTheme ?? = const TabBarTheme ();
545
+ // TODO(QuncCccccc): Clean this up once the type of `tabBarTheme` is changed to `TabBarThemeData`
546
+ if (tabBarTheme != null ) {
547
+ if (tabBarTheme is TabBarTheme ) {
548
+ tabBarTheme = tabBarTheme.data;
549
+ } else if (tabBarTheme is ! TabBarThemeData ) {
550
+ throw ArgumentError ('tabBarTheme must be either a TabBarThemeData or a TabBarTheme' );
551
+ }
552
+ }
553
+ tabBarTheme ?? = const TabBarThemeData ();
545
554
textButtonTheme ?? = const TextButtonThemeData ();
546
555
textSelectionTheme ?? = const TextSelectionThemeData ();
547
556
timePickerTheme ?? = const TimePickerThemeData ();
@@ -634,7 +643,7 @@ class ThemeData with Diagnosticable {
634
643
sliderTheme: sliderTheme,
635
644
snackBarTheme: snackBarTheme,
636
645
switchTheme: switchTheme,
637
- tabBarTheme: tabBarTheme,
646
+ tabBarTheme: tabBarTheme as TabBarThemeData ,
638
647
textButtonTheme: textButtonTheme,
639
648
textSelectionTheme: textSelectionTheme,
640
649
timePickerTheme: timePickerTheme,
@@ -1387,7 +1396,7 @@ class ThemeData with Diagnosticable {
1387
1396
final SwitchThemeData switchTheme;
1388
1397
1389
1398
/// A theme for customizing the size, shape, and color of the tab bar indicator.
1390
- final TabBarTheme tabBarTheme;
1399
+ final TabBarThemeData tabBarTheme;
1391
1400
1392
1401
/// A theme for customizing the appearance and internal layout of
1393
1402
/// [TextButton] s.
@@ -1507,7 +1516,8 @@ class ThemeData with Diagnosticable {
1507
1516
SliderThemeData ? sliderTheme,
1508
1517
SnackBarThemeData ? snackBarTheme,
1509
1518
SwitchThemeData ? switchTheme,
1510
- TabBarTheme ? tabBarTheme,
1519
+ // TODO(QuncCccccc): Change the parameter type to TabBarThemeData
1520
+ Object ? tabBarTheme,
1511
1521
TextButtonThemeData ? textButtonTheme,
1512
1522
TextSelectionThemeData ? textSelectionTheme,
1513
1523
TimePickerThemeData ? timePickerTheme,
@@ -1547,6 +1557,15 @@ class ThemeData with Diagnosticable {
1547
1557
throw ArgumentError ('dialogTheme must be either a DialogThemeData or a DialogTheme' );
1548
1558
}
1549
1559
}
1560
+
1561
+ // TODO(QuncCccccc): Clean this up once the type of `tabBarTheme` is changed to `TabBarThemeData`
1562
+ if (tabBarTheme != null ) {
1563
+ if (tabBarTheme is TabBarTheme ) {
1564
+ tabBarTheme = tabBarTheme.data;
1565
+ } else if (tabBarTheme is ! TabBarThemeData ) {
1566
+ throw ArgumentError ('tabBarTheme must be either a TabBarThemeData or a TabBarTheme' );
1567
+ }
1568
+ }
1550
1569
return ThemeData .raw (
1551
1570
// For the sanity of the reader, make sure these properties are in the same
1552
1571
// order in every place that they are separated by section comments (e.g.
@@ -1634,7 +1653,7 @@ class ThemeData with Diagnosticable {
1634
1653
sliderTheme: sliderTheme ?? this .sliderTheme,
1635
1654
snackBarTheme: snackBarTheme ?? this .snackBarTheme,
1636
1655
switchTheme: switchTheme ?? this .switchTheme,
1637
- tabBarTheme: tabBarTheme ?? this .tabBarTheme,
1656
+ tabBarTheme: tabBarTheme as TabBarThemeData ? ?? this .tabBarTheme,
1638
1657
textButtonTheme: textButtonTheme ?? this .textButtonTheme,
1639
1658
textSelectionTheme: textSelectionTheme ?? this .textSelectionTheme,
1640
1659
timePickerTheme: timePickerTheme ?? this .timePickerTheme,
@@ -1827,7 +1846,7 @@ class ThemeData with Diagnosticable {
1827
1846
sliderTheme: SliderThemeData .lerp (a.sliderTheme, b.sliderTheme, t),
1828
1847
snackBarTheme: SnackBarThemeData .lerp (a.snackBarTheme, b.snackBarTheme, t),
1829
1848
switchTheme: SwitchThemeData .lerp (a.switchTheme, b.switchTheme, t),
1830
- tabBarTheme: TabBarTheme .lerp (a.tabBarTheme, b.tabBarTheme, t),
1849
+ tabBarTheme: TabBarThemeData .lerp (a.tabBarTheme, b.tabBarTheme, t),
1831
1850
textButtonTheme: TextButtonThemeData .lerp (a.textButtonTheme, b.textButtonTheme, t)! ,
1832
1851
textSelectionTheme: TextSelectionThemeData .lerp (a.textSelectionTheme, b.textSelectionTheme, t)! ,
1833
1852
timePickerTheme: TimePickerThemeData .lerp (a.timePickerTheme, b.timePickerTheme, t),
@@ -2125,7 +2144,7 @@ class ThemeData with Diagnosticable {
2125
2144
properties.add (DiagnosticsProperty <SliderThemeData >('sliderTheme' , sliderTheme, level: DiagnosticLevel .debug));
2126
2145
properties.add (DiagnosticsProperty <SnackBarThemeData >('snackBarTheme' , snackBarTheme, defaultValue: defaultData.snackBarTheme, level: DiagnosticLevel .debug));
2127
2146
properties.add (DiagnosticsProperty <SwitchThemeData >('switchTheme' , switchTheme, defaultValue: defaultData.switchTheme, level: DiagnosticLevel .debug));
2128
- properties.add (DiagnosticsProperty <TabBarTheme >('tabBarTheme' , tabBarTheme, level: DiagnosticLevel .debug));
2147
+ properties.add (DiagnosticsProperty <TabBarThemeData >('tabBarTheme' , tabBarTheme, level: DiagnosticLevel .debug));
2129
2148
properties.add (DiagnosticsProperty <TextButtonThemeData >('textButtonTheme' , textButtonTheme, defaultValue: defaultData.textButtonTheme, level: DiagnosticLevel .debug));
2130
2149
properties.add (DiagnosticsProperty <TextSelectionThemeData >('textSelectionTheme' , textSelectionTheme, defaultValue: defaultData.textSelectionTheme, level: DiagnosticLevel .debug));
2131
2150
properties.add (DiagnosticsProperty <TimePickerThemeData >('timePickerTheme' , timePickerTheme, defaultValue: defaultData.timePickerTheme, level: DiagnosticLevel .debug));
0 commit comments