Unverified Commit 0a417c3b authored by Greg Spencer's avatar Greg Spencer Committed by GitHub

A bunch of cleanups and a missing `ShortcutRegistar` in `WidgetsApp` (#104560)

A bunch of random cleanup things I found while doing MenuBar development.

Changes an if test to an assert in binding.dart, since the if should always be true.
Adds the default ShortcutRegistrar that should have been in the ShortcutRegistry PR.
Moves a debug message in the FocusManager to print the result after the focus change instead of before.
Reorders the test parameters in theme_data_test.dart to match the order of the theme data fields everywhere else.
parent 19d69a97
......@@ -399,9 +399,9 @@ mixin GestureBinding on BindingBase implements HitTestable, HitTestDispatcher, H
@pragma('vm:notify-debugger-on-exception')
void dispatchEvent(PointerEvent event, HitTestResult? hitTestResult) {
assert(!locked);
// No hit test information implies that this is a [PointerHoverEvent],
// [PointerAddedEvent], or [PointerRemovedEvent]. These events are specially
// routed here; other events will be routed through the `handleEvent` below.
// No hit test information implies that this is a [PointerAddedEvent] or
// [PointerRemovedEvent]. These events are specially routed here; other
// events will be routed through the `handleEvent` below.
if (hitTestResult == null) {
assert(event is PointerAddedEvent || event is PointerRemovedEvent);
try {
......
......@@ -1730,12 +1730,14 @@ class _WidgetsAppState extends State<WidgetsApp> with WidgetsBindingObserver {
actions: widget.actions ?? WidgetsApp.defaultActions,
child: FocusTraversalGroup(
policy: ReadingOrderTraversalPolicy(),
child: ShortcutRegistrar(
child: child,
),
),
),
),
),
),
);
}
}
......@@ -1798,10 +1798,10 @@ class FocusManager with DiagnosticableTreeMixin, ChangeNotifier {
_dirtyNodes.add(_primaryFocus!);
}
}
assert(_focusDebug('Notifying ${_dirtyNodes.length} dirty nodes:', _dirtyNodes.toList().map<String>((FocusNode node) => node.toString())));
for (final FocusNode node in _dirtyNodes) {
node._notify();
}
assert(_focusDebug('Notified ${_dirtyNodes.length} dirty nodes:', _dirtyNodes.toList().map<String>((FocusNode node) => node.toString())));
_dirtyNodes.clear();
if (previousFocus != _primaryFocus) {
notifyListeners();
......
......@@ -186,6 +186,13 @@ void main() {
' Localizations\n'
' MediaQuery\n'
' _MediaQueryFromWindow\n'
' _ShortcutRegistrarMarker\n'
' _ShortcutsMarker\n'
' Semantics\n'
' _FocusMarker\n'
' Focus\n'
' Shortcuts\n'
' ShortcutRegistrar\n'
' _FocusMarker\n'
' Focus\n'
' _FocusTraversalGroupMarker\n'
......
......@@ -706,6 +706,7 @@ void main() {
buttonColor: Colors.black,
fixTextFieldOutlineLabel: false,
primaryColorBrightness: Brightness.dark,
androidOverscrollIndicator: AndroidOverscrollIndicator.glow,
);
final SliderThemeData otherSliderTheme = SliderThemeData.fromPrimaryColors(
......@@ -722,245 +723,303 @@ void main() {
);
final ThemeData otherTheme = ThemeData.raw(
// For the sanity of the reader, make sure these properties are in the same
// order everywhere that they are separated by section comments (e.g.
// GENERAL CONFIGURATION). Each section except for deprecations should be
// alphabetical by symbol name.
// GENERAL CONFIGURATION
applyElevationOverlayColor: true,
cupertinoOverrideTheme: ThemeData.light().cupertinoOverrideTheme,
extensions: const <Object, ThemeExtension<dynamic>>{
MyThemeExtensionB: MyThemeExtensionB(textStyle: TextStyle()),
},
inputDecorationTheme: ThemeData.light().inputDecorationTheme.copyWith(border: InputBorder.none),
materialTapTargetSize: MaterialTapTargetSize.padded,
pageTransitionsTheme: const PageTransitionsTheme(),
platform: TargetPlatform.android,
scrollbarTheme: const ScrollbarThemeData(radius: Radius.circular(10.0)),
splashFactory: InkRipple.splashFactory,
useMaterial3: true,
visualDensity: VisualDensity.standard,
primaryColor: Colors.white,
primaryColorBrightness: Brightness.light,
primaryColorLight: Colors.white,
primaryColorDark: Colors.white,
accentColor: Colors.white,
accentColorBrightness: Brightness.light,
canvasColor: Colors.white,
shadowColor: Colors.white,
scaffoldBackgroundColor: Colors.white,
// COLOR
backgroundColor: Colors.white,
bottomAppBarColor: Colors.white,
canvasColor: Colors.white,
cardColor: Colors.white,
colorScheme: const ColorScheme.light(),
dialogBackgroundColor: Colors.white,
disabledColor: Colors.white,
dividerColor: Colors.white,
errorColor: Colors.white,
focusColor: Colors.white,
hoverColor: Colors.white,
highlightColor: Colors.white,
splashColor: Colors.white,
splashFactory: InkRipple.splashFactory,
useMaterial3: true,
selectedRowColor: Colors.white,
unselectedWidgetColor: Colors.white,
disabledColor: Colors.white,
buttonTheme: const ButtonThemeData(colorScheme: ColorScheme.light()),
toggleButtonsTheme: const ToggleButtonsThemeData(textStyle: TextStyle(color: Colors.white)),
buttonColor: Colors.white,
secondaryHeaderColor: Colors.white,
backgroundColor: Colors.white,
dialogBackgroundColor: Colors.white,
indicatorColor: Colors.white,
hintColor: Colors.white,
errorColor: Colors.white,
hoverColor: Colors.white,
indicatorColor: Colors.white,
primaryColor: Colors.white,
primaryColorDark: Colors.white,
primaryColorLight: Colors.white,
scaffoldBackgroundColor: Colors.white,
secondaryHeaderColor: Colors.white,
selectedRowColor: Colors.white,
shadowColor: Colors.white,
splashColor: Colors.white,
toggleableActiveColor: Colors.white,
textTheme: ThemeData.light().textTheme,
primaryTextTheme: ThemeData.light().textTheme,
accentTextTheme: ThemeData.light().textTheme,
inputDecorationTheme: ThemeData.light().inputDecorationTheme.copyWith(border: InputBorder.none),
unselectedWidgetColor: Colors.white,
// TYPOGRAPHY & ICONOGRAPHY
iconTheme: ThemeData.light().iconTheme,
primaryIconTheme: ThemeData.light().iconTheme,
accentIconTheme: ThemeData.light().iconTheme,
sliderTheme: otherSliderTheme,
tabBarTheme: const TabBarTheme(labelColor: Colors.white),
tooltipTheme: const TooltipThemeData(height: 100),
expansionTileTheme: const ExpansionTileThemeData(backgroundColor: Colors.black),
cardTheme: const CardTheme(color: Colors.white),
chipTheme: otherChipTheme,
platform: TargetPlatform.android,
materialTapTargetSize: MaterialTapTargetSize.padded,
applyElevationOverlayColor: true,
pageTransitionsTheme: const PageTransitionsTheme(),
primaryTextTheme: ThemeData.light().textTheme,
textTheme: ThemeData.light().textTheme,
typography: Typography.material2018(platform: TargetPlatform.iOS),
// COMPONENT THEMES
appBarTheme: const AppBarTheme(backgroundColor: Colors.white),
scrollbarTheme: const ScrollbarThemeData(radius: Radius.circular(10.0)),
bannerTheme: const MaterialBannerThemeData(backgroundColor: Colors.white),
bottomAppBarTheme: const BottomAppBarTheme(color: Colors.white),
colorScheme: const ColorScheme.light(),
bottomNavigationBarTheme: const BottomNavigationBarThemeData(type: BottomNavigationBarType.shifting),
bottomSheetTheme: const BottomSheetThemeData(backgroundColor: Colors.white),
buttonBarTheme: const ButtonBarThemeData(alignment: MainAxisAlignment.end),
buttonTheme: const ButtonThemeData(colorScheme: ColorScheme.light()),
cardTheme: const CardTheme(color: Colors.white),
checkboxTheme: const CheckboxThemeData(),
chipTheme: otherChipTheme,
dataTableTheme: const DataTableThemeData(),
dialogTheme: const DialogTheme(backgroundColor: Colors.white),
dividerTheme: const DividerThemeData(color: Colors.white),
drawerTheme: const DrawerThemeData(),
elevatedButtonTheme: const ElevatedButtonThemeData(),
expansionTileTheme: const ExpansionTileThemeData(backgroundColor: Colors.black),
floatingActionButtonTheme: const FloatingActionButtonThemeData(backgroundColor: Colors.white),
listTileTheme: const ListTileThemeData(),
navigationBarTheme: const NavigationBarThemeData(backgroundColor: Colors.white),
navigationRailTheme: const NavigationRailThemeData(backgroundColor: Colors.white),
typography: Typography.material2018(platform: TargetPlatform.iOS),
cupertinoOverrideTheme: ThemeData.light().cupertinoOverrideTheme,
snackBarTheme: const SnackBarThemeData(backgroundColor: Colors.white),
bottomSheetTheme: const BottomSheetThemeData(backgroundColor: Colors.white),
popupMenuTheme: const PopupMenuThemeData(color: Colors.white),
bannerTheme: const MaterialBannerThemeData(backgroundColor: Colors.white),
dividerTheme: const DividerThemeData(color: Colors.white),
buttonBarTheme: const ButtonBarThemeData(alignment: MainAxisAlignment.end),
bottomNavigationBarTheme: const BottomNavigationBarThemeData(type: BottomNavigationBarType.shifting),
timePickerTheme: const TimePickerThemeData(backgroundColor: Colors.white),
textButtonTheme: const TextButtonThemeData(),
elevatedButtonTheme: const ElevatedButtonThemeData(),
outlinedButtonTheme: const OutlinedButtonThemeData(),
textSelectionTheme: const TextSelectionThemeData(cursorColor: Colors.white),
dataTableTheme: const DataTableThemeData(),
checkboxTheme: const CheckboxThemeData(),
popupMenuTheme: const PopupMenuThemeData(color: Colors.white),
progressIndicatorTheme: const ProgressIndicatorThemeData(),
radioTheme: const RadioThemeData(),
sliderTheme: otherSliderTheme,
snackBarTheme: const SnackBarThemeData(backgroundColor: Colors.white),
switchTheme: const SwitchThemeData(),
progressIndicatorTheme: const ProgressIndicatorThemeData(),
drawerTheme: const DrawerThemeData(),
listTileTheme: const ListTileThemeData(),
tabBarTheme: const TabBarTheme(labelColor: Colors.white),
textButtonTheme: const TextButtonThemeData(),
textSelectionTheme: const TextSelectionThemeData(cursorColor: Colors.white),
timePickerTheme: const TimePickerThemeData(backgroundColor: Colors.white),
toggleButtonsTheme: const ToggleButtonsThemeData(textStyle: TextStyle(color: Colors.white)),
tooltipTheme: const TooltipThemeData(height: 100),
// DEPRECATED (newest deprecations at the bottom)
accentColor: Colors.white,
accentColorBrightness: Brightness.light,
accentIconTheme: ThemeData.light().iconTheme,
accentTextTheme: ThemeData.light().textTheme,
buttonColor: Colors.white,
fixTextFieldOutlineLabel: true,
primaryColorBrightness: Brightness.light,
androidOverscrollIndicator: AndroidOverscrollIndicator.stretch,
extensions: const <Object, ThemeExtension<dynamic>>{
MyThemeExtensionB: MyThemeExtensionB(textStyle: TextStyle()),
},
);
final ThemeData themeDataCopy = theme.copyWith(
primaryColor: otherTheme.primaryColor,
primaryColorBrightness: otherTheme.primaryColorBrightness,
primaryColorLight: otherTheme.primaryColorLight,
primaryColorDark: otherTheme.primaryColorDark,
canvasColor: otherTheme.canvasColor,
shadowColor: otherTheme.shadowColor,
scaffoldBackgroundColor: otherTheme.scaffoldBackgroundColor,
// For the sanity of the reader, make sure these properties are in the same
// order everywhere that they are separated by section comments (e.g.
// GENERAL CONFIGURATION). Each section except for deprecations should be
// alphabetical by symbol name.
// GENERAL CONFIGURATION
applyElevationOverlayColor: otherTheme.applyElevationOverlayColor,
cupertinoOverrideTheme: otherTheme.cupertinoOverrideTheme,
extensions: otherTheme.extensions.values,
inputDecorationTheme: otherTheme.inputDecorationTheme,
materialTapTargetSize: otherTheme.materialTapTargetSize,
pageTransitionsTheme: otherTheme.pageTransitionsTheme,
platform: otherTheme.platform,
scrollbarTheme: otherTheme.scrollbarTheme,
splashFactory: otherTheme.splashFactory,
useMaterial3: otherTheme.useMaterial3,
visualDensity: otherTheme.visualDensity,
// COLOR
backgroundColor: otherTheme.backgroundColor,
bottomAppBarColor: otherTheme.bottomAppBarColor,
canvasColor: otherTheme.canvasColor,
cardColor: otherTheme.cardColor,
colorScheme: otherTheme.colorScheme,
dialogBackgroundColor: otherTheme.dialogBackgroundColor,
disabledColor: otherTheme.disabledColor,
dividerColor: otherTheme.dividerColor,
errorColor: otherTheme.errorColor,
focusColor: otherTheme.focusColor,
hoverColor: otherTheme.hoverColor,
highlightColor: otherTheme.highlightColor,
splashColor: otherTheme.splashColor,
splashFactory: otherTheme.splashFactory,
useMaterial3: otherTheme.useMaterial3,
selectedRowColor: otherTheme.selectedRowColor,
unselectedWidgetColor: otherTheme.unselectedWidgetColor,
disabledColor: otherTheme.disabledColor,
buttonTheme: otherTheme.buttonTheme,
toggleButtonsTheme: otherTheme.toggleButtonsTheme,
buttonColor: otherTheme.buttonColor,
secondaryHeaderColor: otherTheme.secondaryHeaderColor,
backgroundColor: otherTheme.backgroundColor,
dialogBackgroundColor: otherTheme.dialogBackgroundColor,
indicatorColor: otherTheme.indicatorColor,
hintColor: otherTheme.hintColor,
errorColor: otherTheme.errorColor,
hoverColor: otherTheme.hoverColor,
indicatorColor: otherTheme.indicatorColor,
primaryColor: otherTheme.primaryColor,
primaryColorDark: otherTheme.primaryColorDark,
primaryColorLight: otherTheme.primaryColorLight,
scaffoldBackgroundColor: otherTheme.scaffoldBackgroundColor,
secondaryHeaderColor: otherTheme.secondaryHeaderColor,
selectedRowColor: otherTheme.selectedRowColor,
shadowColor: otherTheme.shadowColor,
splashColor: otherTheme.splashColor,
toggleableActiveColor: otherTheme.toggleableActiveColor,
textTheme: otherTheme.textTheme,
primaryTextTheme: otherTheme.primaryTextTheme,
inputDecorationTheme: otherTheme.inputDecorationTheme,
unselectedWidgetColor: otherTheme.unselectedWidgetColor,
// TYPOGRAPHY & ICONOGRAPHY
iconTheme: otherTheme.iconTheme,
primaryIconTheme: otherTheme.primaryIconTheme,
sliderTheme: otherTheme.sliderTheme,
tabBarTheme: otherTheme.tabBarTheme,
tooltipTheme: otherTheme.tooltipTheme,
expansionTileTheme: otherTheme.expansionTileTheme,
cardTheme: otherTheme.cardTheme,
chipTheme: otherTheme.chipTheme,
platform: otherTheme.platform,
materialTapTargetSize: otherTheme.materialTapTargetSize,
applyElevationOverlayColor: otherTheme.applyElevationOverlayColor,
pageTransitionsTheme: otherTheme.pageTransitionsTheme,
primaryTextTheme: otherTheme.primaryTextTheme,
textTheme: otherTheme.textTheme,
typography: otherTheme.typography,
// COMPONENT THEMES
appBarTheme: otherTheme.appBarTheme,
bannerTheme: otherTheme.bannerTheme,
bottomAppBarTheme: otherTheme.bottomAppBarTheme,
colorScheme: otherTheme.colorScheme,
bottomNavigationBarTheme: otherTheme.bottomNavigationBarTheme,
bottomSheetTheme: otherTheme.bottomSheetTheme,
buttonBarTheme: otherTheme.buttonBarTheme,
buttonTheme: otherTheme.buttonTheme,
cardTheme: otherTheme.cardTheme,
checkboxTheme: otherTheme.checkboxTheme,
chipTheme: otherTheme.chipTheme,
dataTableTheme: otherTheme.dataTableTheme,
dialogTheme: otherTheme.dialogTheme,
dividerTheme: otherTheme.dividerTheme,
drawerTheme: otherTheme.drawerTheme,
elevatedButtonTheme: otherTheme.elevatedButtonTheme,
expansionTileTheme: otherTheme.expansionTileTheme,
floatingActionButtonTheme: otherTheme.floatingActionButtonTheme,
listTileTheme: otherTheme.listTileTheme,
navigationBarTheme: otherTheme.navigationBarTheme,
navigationRailTheme: otherTheme.navigationRailTheme,
typography: otherTheme.typography,
cupertinoOverrideTheme: otherTheme.cupertinoOverrideTheme,
snackBarTheme: otherTheme.snackBarTheme,
bottomSheetTheme: otherTheme.bottomSheetTheme,
popupMenuTheme: otherTheme.popupMenuTheme,
bannerTheme: otherTheme.bannerTheme,
dividerTheme: otherTheme.dividerTheme,
buttonBarTheme: otherTheme.buttonBarTheme,
bottomNavigationBarTheme: otherTheme.bottomNavigationBarTheme,
timePickerTheme: otherTheme.timePickerTheme,
textButtonTheme: otherTheme.textButtonTheme,
elevatedButtonTheme: otherTheme.elevatedButtonTheme,
outlinedButtonTheme: otherTheme.outlinedButtonTheme,
textSelectionTheme: otherTheme.textSelectionTheme,
dataTableTheme: otherTheme.dataTableTheme,
checkboxTheme: otherTheme.checkboxTheme,
popupMenuTheme: otherTheme.popupMenuTheme,
progressIndicatorTheme: otherTheme.progressIndicatorTheme,
radioTheme: otherTheme.radioTheme,
sliderTheme: otherTheme.sliderTheme,
snackBarTheme: otherTheme.snackBarTheme,
switchTheme: otherTheme.switchTheme,
progressIndicatorTheme: otherTheme.progressIndicatorTheme,
drawerTheme: otherTheme.drawerTheme,
listTileTheme: otherTheme.listTileTheme,
tabBarTheme: otherTheme.tabBarTheme,
textButtonTheme: otherTheme.textButtonTheme,
textSelectionTheme: otherTheme.textSelectionTheme,
timePickerTheme: otherTheme.timePickerTheme,
toggleButtonsTheme: otherTheme.toggleButtonsTheme,
tooltipTheme: otherTheme.tooltipTheme,
// DEPRECATED (newest deprecations at the bottom)
accentColor: otherTheme.accentColor,
accentColorBrightness: otherTheme.accentColorBrightness,
accentIconTheme: otherTheme.accentIconTheme,
accentTextTheme: otherTheme.accentTextTheme,
buttonColor: otherTheme.buttonColor,
fixTextFieldOutlineLabel: otherTheme.fixTextFieldOutlineLabel,
extensions: otherTheme.extensions.values,
primaryColorBrightness: otherTheme.primaryColorBrightness,
androidOverscrollIndicator: otherTheme.androidOverscrollIndicator,
);
expect(themeDataCopy.brightness, equals(otherTheme.brightness));
expect(themeDataCopy.primaryColor, equals(otherTheme.primaryColor));
expect(themeDataCopy.primaryColorBrightness, equals(otherTheme.primaryColorBrightness));
expect(themeDataCopy.primaryColorLight, equals(otherTheme.primaryColorLight));
expect(themeDataCopy.primaryColorDark, equals(otherTheme.primaryColorDark));
expect(themeDataCopy.canvasColor, equals(otherTheme.canvasColor));
expect(themeDataCopy.shadowColor, equals(otherTheme.shadowColor));
expect(themeDataCopy.scaffoldBackgroundColor, equals(otherTheme.scaffoldBackgroundColor));
// For the sanity of the reader, make sure these properties are in the same
// order everywhere that they are separated by section comments (e.g.
// GENERAL CONFIGURATION). Each section except for deprecations should be
// alphabetical by symbol name.
// GENERAL CONFIGURATION
expect(themeDataCopy.applyElevationOverlayColor, equals(otherTheme.applyElevationOverlayColor));
expect(themeDataCopy.cupertinoOverrideTheme, equals(otherTheme.cupertinoOverrideTheme));
expect(themeDataCopy.extensions, equals(otherTheme.extensions));
expect(themeDataCopy.inputDecorationTheme, equals(otherTheme.inputDecorationTheme));
expect(themeDataCopy.materialTapTargetSize, equals(otherTheme.materialTapTargetSize));
expect(themeDataCopy.pageTransitionsTheme, equals(otherTheme.pageTransitionsTheme));
expect(themeDataCopy.platform, equals(otherTheme.platform));
expect(themeDataCopy.scrollbarTheme, equals(otherTheme.scrollbarTheme));
expect(themeDataCopy.splashFactory, equals(otherTheme.splashFactory));
expect(themeDataCopy.useMaterial3, equals(otherTheme.useMaterial3));
expect(themeDataCopy.visualDensity, equals(otherTheme.visualDensity));
// COLOR
expect(themeDataCopy.backgroundColor, equals(otherTheme.backgroundColor));
expect(themeDataCopy.bottomAppBarColor, equals(otherTheme.bottomAppBarColor));
expect(themeDataCopy.canvasColor, equals(otherTheme.canvasColor));
expect(themeDataCopy.cardColor, equals(otherTheme.cardColor));
expect(themeDataCopy.colorScheme, equals(otherTheme.colorScheme));
expect(themeDataCopy.dialogBackgroundColor, equals(otherTheme.dialogBackgroundColor));
expect(themeDataCopy.disabledColor, equals(otherTheme.disabledColor));
expect(themeDataCopy.dividerColor, equals(otherTheme.dividerColor));
expect(themeDataCopy.errorColor, equals(otherTheme.errorColor));
expect(themeDataCopy.focusColor, equals(otherTheme.focusColor));
expect(themeDataCopy.focusColor, equals(otherTheme.focusColor));
expect(themeDataCopy.hoverColor, equals(otherTheme.hoverColor));
expect(themeDataCopy.highlightColor, equals(otherTheme.highlightColor));
expect(themeDataCopy.splashColor, equals(otherTheme.splashColor));
expect(themeDataCopy.splashFactory, equals(otherTheme.splashFactory));
expect(themeDataCopy.useMaterial3, equals(otherTheme.useMaterial3));
expect(themeDataCopy.hintColor, equals(otherTheme.hintColor));
expect(themeDataCopy.hoverColor, equals(otherTheme.hoverColor));
expect(themeDataCopy.indicatorColor, equals(otherTheme.indicatorColor));
expect(themeDataCopy.primaryColor, equals(otherTheme.primaryColor));
expect(themeDataCopy.primaryColorDark, equals(otherTheme.primaryColorDark));
expect(themeDataCopy.primaryColorLight, equals(otherTheme.primaryColorLight));
expect(themeDataCopy.scaffoldBackgroundColor, equals(otherTheme.scaffoldBackgroundColor));
expect(themeDataCopy.secondaryHeaderColor, equals(otherTheme.secondaryHeaderColor));
expect(themeDataCopy.selectedRowColor, equals(otherTheme.selectedRowColor));
expect(themeDataCopy.shadowColor, equals(otherTheme.shadowColor));
expect(themeDataCopy.splashColor, equals(otherTheme.splashColor));
expect(themeDataCopy.toggleableActiveColor, equals(otherTheme.toggleableActiveColor));
expect(themeDataCopy.unselectedWidgetColor, equals(otherTheme.unselectedWidgetColor));
expect(themeDataCopy.disabledColor, equals(otherTheme.disabledColor));
expect(themeDataCopy.buttonTheme, equals(otherTheme.buttonTheme));
expect(themeDataCopy.toggleButtonsTheme, equals(otherTheme.toggleButtonsTheme));
expect(themeDataCopy.buttonColor, equals(otherTheme.buttonColor));
expect(themeDataCopy.secondaryHeaderColor, equals(otherTheme.secondaryHeaderColor));
expect(themeDataCopy.textSelectionTheme.selectionColor, equals(otherTheme.textSelectionTheme.selectionColor));
expect(themeDataCopy.textSelectionTheme.cursorColor, equals(otherTheme.textSelectionTheme.cursorColor));
expect(themeDataCopy.textSelectionTheme.selectionColor, equals(otherTheme.textSelectionTheme.selectionColor));
expect(themeDataCopy.textSelectionTheme.cursorColor, equals(otherTheme.textSelectionTheme.cursorColor));
expect(themeDataCopy.textSelectionTheme.selectionHandleColor, equals(otherTheme.textSelectionTheme.selectionHandleColor));
expect(themeDataCopy.backgroundColor, equals(otherTheme.backgroundColor));
expect(themeDataCopy.dialogBackgroundColor, equals(otherTheme.dialogBackgroundColor));
expect(themeDataCopy.indicatorColor, equals(otherTheme.indicatorColor));
expect(themeDataCopy.hintColor, equals(otherTheme.hintColor));
expect(themeDataCopy.errorColor, equals(otherTheme.errorColor));
expect(themeDataCopy.textTheme, equals(otherTheme.textTheme));
// TYPOGRAPHY & ICONOGRAPHY
expect(themeDataCopy.iconTheme, equals(otherTheme.iconTheme));
expect(themeDataCopy.primaryIconTheme, equals(otherTheme.primaryIconTheme));
expect(themeDataCopy.primaryTextTheme, equals(otherTheme.primaryTextTheme));
expect(themeDataCopy.sliderTheme, equals(otherTheme.sliderTheme));
expect(themeDataCopy.tabBarTheme, equals(otherTheme.tabBarTheme));
expect(themeDataCopy.tooltipTheme, equals(otherTheme.tooltipTheme));
expect(themeDataCopy.expansionTileTheme, equals(otherTheme.expansionTileTheme));
expect(themeDataCopy.cardTheme, equals(otherTheme.cardTheme));
expect(themeDataCopy.chipTheme, equals(otherTheme.chipTheme));
expect(themeDataCopy.platform, equals(otherTheme.platform));
expect(themeDataCopy.materialTapTargetSize, equals(otherTheme.materialTapTargetSize));
expect(themeDataCopy.applyElevationOverlayColor, equals(otherTheme.applyElevationOverlayColor));
expect(themeDataCopy.pageTransitionsTheme, equals(otherTheme.pageTransitionsTheme));
expect(themeDataCopy.textTheme, equals(otherTheme.textTheme));
expect(themeDataCopy.typography, equals(otherTheme.typography));
// COMPONENT THEMES
expect(themeDataCopy.appBarTheme, equals(otherTheme.appBarTheme));
expect(themeDataCopy.bannerTheme, equals(otherTheme.bannerTheme));
expect(themeDataCopy.bottomAppBarTheme, equals(otherTheme.bottomAppBarTheme));
expect(themeDataCopy.colorScheme, equals(otherTheme.colorScheme));
expect(themeDataCopy.bottomNavigationBarTheme, equals(otherTheme.bottomNavigationBarTheme));
expect(themeDataCopy.bottomSheetTheme, equals(otherTheme.bottomSheetTheme));
expect(themeDataCopy.buttonBarTheme, equals(otherTheme.buttonBarTheme));
expect(themeDataCopy.buttonTheme, equals(otherTheme.buttonTheme));
expect(themeDataCopy.cardTheme, equals(otherTheme.cardTheme));
expect(themeDataCopy.checkboxTheme, equals(otherTheme.checkboxTheme));
expect(themeDataCopy.chipTheme, equals(otherTheme.chipTheme));
expect(themeDataCopy.dataTableTheme, equals(otherTheme.dataTableTheme));
expect(themeDataCopy.dialogTheme, equals(otherTheme.dialogTheme));
expect(themeDataCopy.dividerTheme, equals(otherTheme.dividerTheme));
expect(themeDataCopy.drawerTheme, equals(otherTheme.drawerTheme));
expect(themeDataCopy.elevatedButtonTheme, equals(otherTheme.elevatedButtonTheme));
expect(themeDataCopy.expansionTileTheme, equals(otherTheme.expansionTileTheme));
expect(themeDataCopy.floatingActionButtonTheme, equals(otherTheme.floatingActionButtonTheme));
expect(themeDataCopy.listTileTheme, equals(otherTheme.listTileTheme));
expect(themeDataCopy.navigationBarTheme, equals(otherTheme.navigationBarTheme));
expect(themeDataCopy.navigationRailTheme, equals(otherTheme.navigationRailTheme));
expect(themeDataCopy.typography, equals(otherTheme.typography));
expect(themeDataCopy.cupertinoOverrideTheme, equals(otherTheme.cupertinoOverrideTheme));
expect(themeDataCopy.snackBarTheme, equals(otherTheme.snackBarTheme));
expect(themeDataCopy.bottomSheetTheme, equals(otherTheme.bottomSheetTheme));
expect(themeDataCopy.popupMenuTheme, equals(otherTheme.popupMenuTheme));
expect(themeDataCopy.bannerTheme, equals(otherTheme.bannerTheme));
expect(themeDataCopy.dividerTheme, equals(otherTheme.dividerTheme));
expect(themeDataCopy.buttonBarTheme, equals(otherTheme.buttonBarTheme));
expect(themeDataCopy.bottomNavigationBarTheme, equals(otherTheme.bottomNavigationBarTheme));
expect(themeDataCopy.timePickerTheme, equals(otherTheme.timePickerTheme));
expect(themeDataCopy.textButtonTheme, equals(otherTheme.textButtonTheme));
expect(themeDataCopy.elevatedButtonTheme, equals(otherTheme.elevatedButtonTheme));
expect(themeDataCopy.outlinedButtonTheme, equals(otherTheme.outlinedButtonTheme));
expect(themeDataCopy.textSelectionTheme, equals(otherTheme.textSelectionTheme));
expect(themeDataCopy.dataTableTheme, equals(otherTheme.dataTableTheme));
expect(themeDataCopy.checkboxTheme, equals(otherTheme.checkboxTheme));
expect(themeDataCopy.popupMenuTheme, equals(otherTheme.popupMenuTheme));
expect(themeDataCopy.progressIndicatorTheme, equals(otherTheme.progressIndicatorTheme));
expect(themeDataCopy.radioTheme, equals(otherTheme.radioTheme));
expect(themeDataCopy.sliderTheme, equals(otherTheme.sliderTheme));
expect(themeDataCopy.snackBarTheme, equals(otherTheme.snackBarTheme));
expect(themeDataCopy.switchTheme, equals(otherTheme.switchTheme));
expect(themeDataCopy.progressIndicatorTheme, equals(otherTheme.progressIndicatorTheme));
expect(themeDataCopy.drawerTheme, equals(otherTheme.drawerTheme));
expect(themeDataCopy.listTileTheme, equals(otherTheme.listTileTheme));
expect(themeDataCopy.tabBarTheme, equals(otherTheme.tabBarTheme));
expect(themeDataCopy.textButtonTheme, equals(otherTheme.textButtonTheme));
expect(themeDataCopy.textSelectionTheme, equals(otherTheme.textSelectionTheme));
expect(themeDataCopy.textSelectionTheme.selectionColor, equals(otherTheme.textSelectionTheme.selectionColor));
expect(themeDataCopy.textSelectionTheme.cursorColor, equals(otherTheme.textSelectionTheme.cursorColor));
expect(themeDataCopy.textSelectionTheme.selectionColor, equals(otherTheme.textSelectionTheme.selectionColor));
expect(themeDataCopy.textSelectionTheme.cursorColor, equals(otherTheme.textSelectionTheme.cursorColor));
expect(themeDataCopy.textSelectionTheme.selectionHandleColor, equals(otherTheme.textSelectionTheme.selectionHandleColor));
expect(themeDataCopy.timePickerTheme, equals(otherTheme.timePickerTheme));
expect(themeDataCopy.toggleButtonsTheme, equals(otherTheme.toggleButtonsTheme));
expect(themeDataCopy.tooltipTheme, equals(otherTheme.tooltipTheme));
// DEPRECATED (newest deprecations at the bottom)
expect(themeDataCopy.accentColor, equals(otherTheme.accentColor));
expect(themeDataCopy.accentColorBrightness, equals(otherTheme.accentColorBrightness));
expect(themeDataCopy.accentIconTheme, equals(otherTheme.accentIconTheme));
expect(themeDataCopy.accentTextTheme, equals(otherTheme.accentTextTheme));
expect(themeDataCopy.buttonColor, equals(otherTheme.buttonColor));
expect(themeDataCopy.fixTextFieldOutlineLabel, equals(otherTheme.fixTextFieldOutlineLabel));
expect(themeDataCopy.extensions, equals(otherTheme.extensions));
expect(themeDataCopy.primaryColorBrightness, equals(otherTheme.primaryColorBrightness));
expect(themeDataCopy.androidOverscrollIndicator, equals(otherTheme.androidOverscrollIndicator));
});
testWidgets('ThemeData.toString has less than 200 characters output', (WidgetTester tester) async {
......
......@@ -1697,7 +1697,7 @@ void main() {
final String messagesStr = messages.toString();
expect(messagesStr.split('\n').length, equals(58));
expect(messagesStr, contains(RegExp(r' └─Child 1: FocusScopeNode#[a-f0-9]{5}\(parent1 \[PRIMARY FOCUS\]\)')));
expect(messagesStr, contains('FOCUS: Notifying 2 dirty nodes'));
expect(messagesStr, contains('FOCUS: Notified 2 dirty nodes'));
expect(messagesStr, contains(RegExp(r'FOCUS: Scheduling update, current focus is null, next focus will be FocusScopeNode#.*parent1')));
});
}
......@@ -1354,6 +1354,51 @@ void main() {
expect(invokedB, equals(1));
});
testWidgets('MaterialApp has a ShortcutRegistrar listening', (WidgetTester tester) async {
int invokedA = 0;
int invokedB = 0;
await tester.pumpWidget(
MaterialApp(
home: TestCallbackRegistration(
shortcuts: <ShortcutActivator, Intent>{
const SingleActivator(LogicalKeyboardKey.keyA): VoidCallbackIntent(() {
invokedA += 1;
}),
const SingleActivator(LogicalKeyboardKey.keyB): VoidCallbackIntent(() {
invokedB += 1;
}),
},
child: Actions(
actions: <Type, Action<Intent>>{
VoidCallbackIntent: VoidCallbackAction(),
},
child: const Focus(
autofocus: true,
child: Placeholder(),
),
),
),
),
);
await tester.pump();
await tester.sendKeyDownEvent(LogicalKeyboardKey.keyA);
await tester.pump();
expect(invokedA, equals(1));
expect(invokedB, equals(0));
await tester.sendKeyUpEvent(LogicalKeyboardKey.keyA);
expect(invokedA, equals(1));
expect(invokedB, equals(0));
invokedA = 0;
invokedB = 0;
await tester.sendKeyDownEvent(LogicalKeyboardKey.keyB);
expect(invokedA, equals(0));
expect(invokedB, equals(1));
await tester.sendKeyUpEvent(LogicalKeyboardKey.keyB);
expect(invokedA, equals(0));
expect(invokedB, equals(1));
});
testWidgets("doesn't override text field shortcuts", (WidgetTester tester) async {
final TextEditingController controller = TextEditingController();
await tester.pumpWidget(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment