Skip to content

Commit ebc2c3e

Browse files
authored
Clean up SnackBar inherit theme data test (flutter#154921)
Fixes [Verbose `SnackBar` inherit theme data test](flutter#154920)
1 parent bffa215 commit ebc2c3e

File tree

1 file changed

+6
-84
lines changed

1 file changed

+6
-84
lines changed

packages/flutter/test/material/snack_bar_test.dart

Lines changed: 6 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -596,90 +596,13 @@ void main() {
596596
expect(buttonTextStyle.color, equals(darkTheme.colorScheme.inversePrimary));
597597
});
598598

599-
testWidgets('SnackBar should inherit theme data from its ancestor.', (WidgetTester tester) async {
600-
final SliderThemeData sliderTheme = SliderThemeData.fromPrimaryColors(
601-
primaryColor: Colors.black,
602-
primaryColorDark: Colors.black,
603-
primaryColorLight: Colors.black,
604-
valueIndicatorTextStyle: const TextStyle(color: Colors.black),
605-
);
606-
607-
final ChipThemeData chipTheme = ChipThemeData.fromDefaults(
608-
primaryColor: Colors.black,
609-
secondaryColor: Colors.white,
610-
labelStyle: const TextStyle(color: Colors.black),
611-
);
612-
613-
const PageTransitionsTheme pageTransitionTheme = PageTransitionsTheme(
614-
builders: <TargetPlatform, PageTransitionsBuilder>{
615-
TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
616-
TargetPlatform.macOS: CupertinoPageTransitionsBuilder(),
617-
},
618-
);
619-
620-
final ThemeData theme = ThemeData.light().copyWith(
621-
visualDensity: VisualDensity.standard,
622-
primaryColor: Colors.black,
623-
primaryColorLight: Colors.black,
624-
primaryColorDark: Colors.black,
625-
canvasColor: Colors.black,
626-
shadowColor: Colors.black,
627-
scaffoldBackgroundColor: Colors.black,
628-
cardColor: Colors.black,
629-
dividerColor: Colors.black,
630-
focusColor: Colors.black,
631-
hoverColor: Colors.black,
632-
highlightColor: Colors.black,
633-
splashColor: Colors.black,
634-
splashFactory: InkRipple.splashFactory,
635-
unselectedWidgetColor: Colors.black,
636-
disabledColor: Colors.black,
637-
buttonTheme: const ButtonThemeData(colorScheme: ColorScheme.dark()),
638-
toggleButtonsTheme: const ToggleButtonsThemeData(textStyle: TextStyle(color: Colors.black)),
639-
secondaryHeaderColor: Colors.black,
640-
dialogBackgroundColor: Colors.black,
641-
indicatorColor: Colors.black,
642-
hintColor: Colors.black,
643-
textTheme: ThemeData.dark().textTheme,
644-
primaryTextTheme: ThemeData.dark().textTheme,
645-
inputDecorationTheme: ThemeData.dark().inputDecorationTheme.copyWith(border: const OutlineInputBorder()),
646-
iconTheme: ThemeData.dark().iconTheme,
647-
primaryIconTheme: ThemeData.dark().iconTheme,
648-
sliderTheme: sliderTheme,
649-
tabBarTheme: const TabBarTheme(labelColor: Colors.black),
650-
tooltipTheme: const TooltipThemeData(height: 100),
651-
cardTheme: const CardTheme(color: Colors.black),
652-
chipTheme: chipTheme,
653-
platform: TargetPlatform.iOS,
654-
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
655-
applyElevationOverlayColor: false,
656-
pageTransitionsTheme: pageTransitionTheme,
657-
appBarTheme: const AppBarTheme(backgroundColor: Colors.black),
658-
scrollbarTheme: const ScrollbarThemeData(radius: Radius.circular(10.0)),
659-
bottomAppBarTheme: const BottomAppBarTheme(color: Colors.black),
660-
colorScheme: const ColorScheme.light(),
661-
dialogTheme: const DialogTheme(backgroundColor: Colors.black),
662-
floatingActionButtonTheme: const FloatingActionButtonThemeData(backgroundColor: Colors.black),
663-
navigationRailTheme: const NavigationRailThemeData(backgroundColor: Colors.black),
664-
typography: Typography.material2018(),
665-
snackBarTheme: const SnackBarThemeData(backgroundColor: Colors.black),
666-
bottomSheetTheme: const BottomSheetThemeData(backgroundColor: Colors.black),
667-
popupMenuTheme: const PopupMenuThemeData(color: Colors.black),
668-
bannerTheme: const MaterialBannerThemeData(backgroundColor: Colors.black),
669-
dividerTheme: const DividerThemeData(color: Colors.black),
670-
bottomNavigationBarTheme: const BottomNavigationBarThemeData(type: BottomNavigationBarType.fixed),
671-
timePickerTheme: const TimePickerThemeData(backgroundColor: Colors.black),
672-
textButtonTheme: TextButtonThemeData(style: TextButton.styleFrom(foregroundColor: Colors.red)),
673-
elevatedButtonTheme: ElevatedButtonThemeData(style: ElevatedButton.styleFrom(backgroundColor: Colors.green)),
674-
outlinedButtonTheme: OutlinedButtonThemeData(style: OutlinedButton.styleFrom(foregroundColor: Colors.blue)),
675-
textSelectionTheme: const TextSelectionThemeData(cursorColor: Colors.black),
676-
dataTableTheme: const DataTableThemeData(),
677-
checkboxTheme: const CheckboxThemeData(),
678-
radioTheme: const RadioThemeData(),
679-
switchTheme: const SwitchThemeData(),
680-
progressIndicatorTheme: const ProgressIndicatorThemeData(),
599+
testWidgets('SnackBar should inherit theme data from its ancestor', (WidgetTester tester) async {
600+
final ThemeData theme = ThemeData(
601+
colorScheme: ColorScheme.fromSeed(
602+
seedColor: Colors.green,
603+
brightness: Brightness.dark,
604+
),
681605
);
682-
683606
ThemeData? themeBeforeSnackBar;
684607
ThemeData? themeAfterSnackBar;
685608
await tester.pumpWidget(
@@ -722,7 +645,6 @@ void main() {
722645
final ThemeData comparedTheme = themeBeforeSnackBar!.copyWith(
723646
colorScheme: themeAfterSnackBar!.colorScheme,
724647
); // Fields replaced by SnackBar.
725-
726648
expect(comparedTheme, themeAfterSnackBar);
727649
});
728650

0 commit comments

Comments
 (0)