mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Clean up SnackBar inherit theme data test (#154921)
Fixes [Verbose `SnackBar` inherit theme data test](https://github.com/flutter/flutter/issues/154920)
This commit is contained in:
parent
bffa21549c
commit
ebc2c3e437
@ -596,90 +596,13 @@ void main() {
|
||||
expect(buttonTextStyle.color, equals(darkTheme.colorScheme.inversePrimary));
|
||||
});
|
||||
|
||||
testWidgets('SnackBar should inherit theme data from its ancestor.', (WidgetTester tester) async {
|
||||
final SliderThemeData sliderTheme = SliderThemeData.fromPrimaryColors(
|
||||
primaryColor: Colors.black,
|
||||
primaryColorDark: Colors.black,
|
||||
primaryColorLight: Colors.black,
|
||||
valueIndicatorTextStyle: const TextStyle(color: Colors.black),
|
||||
testWidgets('SnackBar should inherit theme data from its ancestor', (WidgetTester tester) async {
|
||||
final ThemeData theme = ThemeData(
|
||||
colorScheme: ColorScheme.fromSeed(
|
||||
seedColor: Colors.green,
|
||||
brightness: Brightness.dark,
|
||||
),
|
||||
);
|
||||
|
||||
final ChipThemeData chipTheme = ChipThemeData.fromDefaults(
|
||||
primaryColor: Colors.black,
|
||||
secondaryColor: Colors.white,
|
||||
labelStyle: const TextStyle(color: Colors.black),
|
||||
);
|
||||
|
||||
const PageTransitionsTheme pageTransitionTheme = PageTransitionsTheme(
|
||||
builders: <TargetPlatform, PageTransitionsBuilder>{
|
||||
TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
|
||||
TargetPlatform.macOS: CupertinoPageTransitionsBuilder(),
|
||||
},
|
||||
);
|
||||
|
||||
final ThemeData theme = ThemeData.light().copyWith(
|
||||
visualDensity: VisualDensity.standard,
|
||||
primaryColor: Colors.black,
|
||||
primaryColorLight: Colors.black,
|
||||
primaryColorDark: Colors.black,
|
||||
canvasColor: Colors.black,
|
||||
shadowColor: Colors.black,
|
||||
scaffoldBackgroundColor: Colors.black,
|
||||
cardColor: Colors.black,
|
||||
dividerColor: Colors.black,
|
||||
focusColor: Colors.black,
|
||||
hoverColor: Colors.black,
|
||||
highlightColor: Colors.black,
|
||||
splashColor: Colors.black,
|
||||
splashFactory: InkRipple.splashFactory,
|
||||
unselectedWidgetColor: Colors.black,
|
||||
disabledColor: Colors.black,
|
||||
buttonTheme: const ButtonThemeData(colorScheme: ColorScheme.dark()),
|
||||
toggleButtonsTheme: const ToggleButtonsThemeData(textStyle: TextStyle(color: Colors.black)),
|
||||
secondaryHeaderColor: Colors.black,
|
||||
dialogBackgroundColor: Colors.black,
|
||||
indicatorColor: Colors.black,
|
||||
hintColor: Colors.black,
|
||||
textTheme: ThemeData.dark().textTheme,
|
||||
primaryTextTheme: ThemeData.dark().textTheme,
|
||||
inputDecorationTheme: ThemeData.dark().inputDecorationTheme.copyWith(border: const OutlineInputBorder()),
|
||||
iconTheme: ThemeData.dark().iconTheme,
|
||||
primaryIconTheme: ThemeData.dark().iconTheme,
|
||||
sliderTheme: sliderTheme,
|
||||
tabBarTheme: const TabBarTheme(labelColor: Colors.black),
|
||||
tooltipTheme: const TooltipThemeData(height: 100),
|
||||
cardTheme: const CardTheme(color: Colors.black),
|
||||
chipTheme: chipTheme,
|
||||
platform: TargetPlatform.iOS,
|
||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
applyElevationOverlayColor: false,
|
||||
pageTransitionsTheme: pageTransitionTheme,
|
||||
appBarTheme: const AppBarTheme(backgroundColor: Colors.black),
|
||||
scrollbarTheme: const ScrollbarThemeData(radius: Radius.circular(10.0)),
|
||||
bottomAppBarTheme: const BottomAppBarTheme(color: Colors.black),
|
||||
colorScheme: const ColorScheme.light(),
|
||||
dialogTheme: const DialogTheme(backgroundColor: Colors.black),
|
||||
floatingActionButtonTheme: const FloatingActionButtonThemeData(backgroundColor: Colors.black),
|
||||
navigationRailTheme: const NavigationRailThemeData(backgroundColor: Colors.black),
|
||||
typography: Typography.material2018(),
|
||||
snackBarTheme: const SnackBarThemeData(backgroundColor: Colors.black),
|
||||
bottomSheetTheme: const BottomSheetThemeData(backgroundColor: Colors.black),
|
||||
popupMenuTheme: const PopupMenuThemeData(color: Colors.black),
|
||||
bannerTheme: const MaterialBannerThemeData(backgroundColor: Colors.black),
|
||||
dividerTheme: const DividerThemeData(color: Colors.black),
|
||||
bottomNavigationBarTheme: const BottomNavigationBarThemeData(type: BottomNavigationBarType.fixed),
|
||||
timePickerTheme: const TimePickerThemeData(backgroundColor: Colors.black),
|
||||
textButtonTheme: TextButtonThemeData(style: TextButton.styleFrom(foregroundColor: Colors.red)),
|
||||
elevatedButtonTheme: ElevatedButtonThemeData(style: ElevatedButton.styleFrom(backgroundColor: Colors.green)),
|
||||
outlinedButtonTheme: OutlinedButtonThemeData(style: OutlinedButton.styleFrom(foregroundColor: Colors.blue)),
|
||||
textSelectionTheme: const TextSelectionThemeData(cursorColor: Colors.black),
|
||||
dataTableTheme: const DataTableThemeData(),
|
||||
checkboxTheme: const CheckboxThemeData(),
|
||||
radioTheme: const RadioThemeData(),
|
||||
switchTheme: const SwitchThemeData(),
|
||||
progressIndicatorTheme: const ProgressIndicatorThemeData(),
|
||||
);
|
||||
|
||||
ThemeData? themeBeforeSnackBar;
|
||||
ThemeData? themeAfterSnackBar;
|
||||
await tester.pumpWidget(
|
||||
@ -722,7 +645,6 @@ void main() {
|
||||
final ThemeData comparedTheme = themeBeforeSnackBar!.copyWith(
|
||||
colorScheme: themeAfterSnackBar!.colorScheme,
|
||||
); // Fields replaced by SnackBar.
|
||||
|
||||
expect(comparedTheme, themeAfterSnackBar);
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user