diff --git a/packages/flutter/lib/src/gestures/binding.dart b/packages/flutter/lib/src/gestures/binding.dart index bacc0af759..d77598ba64 100644 --- a/packages/flutter/lib/src/gestures/binding.dart +++ b/packages/flutter/lib/src/gestures/binding.dart @@ -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 { diff --git a/packages/flutter/lib/src/widgets/app.dart b/packages/flutter/lib/src/widgets/app.dart index 99d5eb904f..f628e5abc6 100644 --- a/packages/flutter/lib/src/widgets/app.dart +++ b/packages/flutter/lib/src/widgets/app.dart @@ -1730,7 +1730,9 @@ class _WidgetsAppState extends State with WidgetsBindingObserver { actions: widget.actions ?? WidgetsApp.defaultActions, child: FocusTraversalGroup( policy: ReadingOrderTraversalPolicy(), - child: child, + child: ShortcutRegistrar( + child: child, + ), ), ), ), diff --git a/packages/flutter/lib/src/widgets/focus_manager.dart b/packages/flutter/lib/src/widgets/focus_manager.dart index dc76a19fc3..38757a228c 100644 --- a/packages/flutter/lib/src/widgets/focus_manager.dart +++ b/packages/flutter/lib/src/widgets/focus_manager.dart @@ -1798,10 +1798,10 @@ class FocusManager with DiagnosticableTreeMixin, ChangeNotifier { _dirtyNodes.add(_primaryFocus!); } } - assert(_focusDebug('Notifying ${_dirtyNodes.length} dirty nodes:', _dirtyNodes.toList().map((FocusNode node) => node.toString()))); for (final FocusNode node in _dirtyNodes) { node._notify(); } + assert(_focusDebug('Notified ${_dirtyNodes.length} dirty nodes:', _dirtyNodes.toList().map((FocusNode node) => node.toString()))); _dirtyNodes.clear(); if (previousFocus != _primaryFocus) { notifyListeners(); diff --git a/packages/flutter/test/material/debug_test.dart b/packages/flutter/test/material/debug_test.dart index 32ad1ca624..554393780a 100644 --- a/packages/flutter/test/material/debug_test.dart +++ b/packages/flutter/test/material/debug_test.dart @@ -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' diff --git a/packages/flutter/test/material/theme_data_test.dart b/packages/flutter/test/material/theme_data_test.dart index b9ac657908..a30fe469ca 100644 --- a/packages/flutter/test/material/theme_data_test.dart +++ b/packages/flutter/test/material/theme_data_test.dart @@ -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( - 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, - bottomAppBarColor: Colors.white, - cardColor: Colors.white, - dividerColor: 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, - toggleableActiveColor: Colors.white, - textTheme: ThemeData.light().textTheme, - primaryTextTheme: ThemeData.light().textTheme, - accentTextTheme: ThemeData.light().textTheme, - inputDecorationTheme: ThemeData.light().inputDecorationTheme.copyWith(border: InputBorder.none), - 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, + // 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, - pageTransitionsTheme: const PageTransitionsTheme(), - appBarTheme: const AppBarTheme(backgroundColor: Colors.white), - scrollbarTheme: const ScrollbarThemeData(radius: Radius.circular(10.0)), - bottomAppBarTheme: const BottomAppBarTheme(color: Colors.white), - colorScheme: const ColorScheme.light(), - dialogTheme: const DialogTheme(backgroundColor: Colors.white), - floatingActionButtonTheme: const FloatingActionButtonThemeData(backgroundColor: Colors.white), - 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(), - radioTheme: const RadioThemeData(), - switchTheme: const SwitchThemeData(), - progressIndicatorTheme: const ProgressIndicatorThemeData(), - drawerTheme: const DrawerThemeData(), - listTileTheme: const ListTileThemeData(), - fixTextFieldOutlineLabel: true, - androidOverscrollIndicator: AndroidOverscrollIndicator.stretch, extensions: const >{ 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, + + // 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, + highlightColor: Colors.white, + hintColor: 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, + unselectedWidgetColor: Colors.white, + + // TYPOGRAPHY & ICONOGRAPHY + iconTheme: ThemeData.light().iconTheme, + primaryIconTheme: ThemeData.light().iconTheme, + primaryTextTheme: ThemeData.light().textTheme, + textTheme: ThemeData.light().textTheme, + typography: Typography.material2018(platform: TargetPlatform.iOS), + + // COMPONENT THEMES + appBarTheme: const AppBarTheme(backgroundColor: Colors.white), + bannerTheme: const MaterialBannerThemeData(backgroundColor: Colors.white), + bottomAppBarTheme: const BottomAppBarTheme(color: Colors.white), + 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), + outlinedButtonTheme: const OutlinedButtonThemeData(), + popupMenuTheme: const PopupMenuThemeData(color: Colors.white), + progressIndicatorTheme: const ProgressIndicatorThemeData(), + radioTheme: const RadioThemeData(), + sliderTheme: otherSliderTheme, + snackBarTheme: const SnackBarThemeData(backgroundColor: Colors.white), + switchTheme: const SwitchThemeData(), + 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, ); 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, - bottomAppBarColor: otherTheme.bottomAppBarColor, - cardColor: otherTheme.cardColor, - dividerColor: otherTheme.dividerColor, - focusColor: otherTheme.focusColor, - hoverColor: otherTheme.hoverColor, - highlightColor: otherTheme.highlightColor, - splashColor: otherTheme.splashColor, + // 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, - selectedRowColor: otherTheme.selectedRowColor, - unselectedWidgetColor: otherTheme.unselectedWidgetColor, - disabledColor: otherTheme.disabledColor, - buttonTheme: otherTheme.buttonTheme, - toggleButtonsTheme: otherTheme.toggleButtonsTheme, - buttonColor: otherTheme.buttonColor, - secondaryHeaderColor: otherTheme.secondaryHeaderColor, + visualDensity: otherTheme.visualDensity, + + // COLOR backgroundColor: otherTheme.backgroundColor, + bottomAppBarColor: otherTheme.bottomAppBarColor, + canvasColor: otherTheme.canvasColor, + cardColor: otherTheme.cardColor, + colorScheme: otherTheme.colorScheme, dialogBackgroundColor: otherTheme.dialogBackgroundColor, - indicatorColor: otherTheme.indicatorColor, - hintColor: otherTheme.hintColor, + disabledColor: otherTheme.disabledColor, + dividerColor: otherTheme.dividerColor, errorColor: otherTheme.errorColor, + focusColor: otherTheme.focusColor, + highlightColor: otherTheme.highlightColor, + hintColor: otherTheme.hintColor, + 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, - radioTheme: otherTheme.radioTheme, - switchTheme: otherTheme.switchTheme, + popupMenuTheme: otherTheme.popupMenuTheme, progressIndicatorTheme: otherTheme.progressIndicatorTheme, - drawerTheme: otherTheme.drawerTheme, - listTileTheme: otherTheme.listTileTheme, + radioTheme: otherTheme.radioTheme, + sliderTheme: otherTheme.sliderTheme, + snackBarTheme: otherTheme.snackBarTheme, + switchTheme: otherTheme.switchTheme, + 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)); - expect(themeDataCopy.bottomAppBarColor, equals(otherTheme.bottomAppBarColor)); - expect(themeDataCopy.cardColor, equals(otherTheme.cardColor)); - expect(themeDataCopy.dividerColor, equals(otherTheme.dividerColor)); - 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)); + // 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.selectedRowColor, equals(otherTheme.selectedRowColor)); - expect(themeDataCopy.unselectedWidgetColor, equals(otherTheme.unselectedWidgetColor)); + 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.buttonTheme, equals(otherTheme.buttonTheme)); - expect(themeDataCopy.toggleButtonsTheme, equals(otherTheme.toggleButtonsTheme)); - expect(themeDataCopy.buttonColor, equals(otherTheme.buttonColor)); + expect(themeDataCopy.dividerColor, equals(otherTheme.dividerColor)); + expect(themeDataCopy.errorColor, equals(otherTheme.errorColor)); + expect(themeDataCopy.focusColor, equals(otherTheme.focusColor)); + expect(themeDataCopy.highlightColor, equals(otherTheme.highlightColor)); + 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)); + + // TYPOGRAPHY & ICONOGRAPHY + expect(themeDataCopy.iconTheme, equals(otherTheme.iconTheme)); + expect(themeDataCopy.primaryIconTheme, equals(otherTheme.primaryIconTheme)); + expect(themeDataCopy.primaryTextTheme, equals(otherTheme.primaryTextTheme)); + 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.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.outlinedButtonTheme, equals(otherTheme.outlinedButtonTheme)); + 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.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.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)); - 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.appBarTheme, equals(otherTheme.appBarTheme)); - expect(themeDataCopy.bottomAppBarTheme, equals(otherTheme.bottomAppBarTheme)); - expect(themeDataCopy.colorScheme, equals(otherTheme.colorScheme)); - expect(themeDataCopy.dialogTheme, equals(otherTheme.dialogTheme)); - expect(themeDataCopy.floatingActionButtonTheme, equals(otherTheme.floatingActionButtonTheme)); - 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.radioTheme, equals(otherTheme.radioTheme)); - 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.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 { diff --git a/packages/flutter/test/widgets/focus_manager_test.dart b/packages/flutter/test/widgets/focus_manager_test.dart index 9aa3d1d9d7..08ef7b8775 100644 --- a/packages/flutter/test/widgets/focus_manager_test.dart +++ b/packages/flutter/test/widgets/focus_manager_test.dart @@ -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'))); }); } diff --git a/packages/flutter/test/widgets/shortcuts_test.dart b/packages/flutter/test/widgets/shortcuts_test.dart index 403a7dcb76..d46746cca9 100644 --- a/packages/flutter/test/widgets/shortcuts_test.dart +++ b/packages/flutter/test/widgets/shortcuts_test.dart @@ -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: { + const SingleActivator(LogicalKeyboardKey.keyA): VoidCallbackIntent(() { + invokedA += 1; + }), + const SingleActivator(LogicalKeyboardKey.keyB): VoidCallbackIntent(() { + invokedB += 1; + }), + }, + child: Actions( + actions: >{ + 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(