From 3e7e01c893a50f2babef909c805abc5a6a464857 Mon Sep 17 00:00:00 2001 From: Greg Spencer Date: Thu, 26 May 2022 15:25:48 -0700 Subject: [PATCH] Remove extraneous InheritedWidget (#104676) When I removed Shortcuts.of and Shortcuts.maybeOf, I forgot to also remove the associated InheritedWidget. This does that. --- .../flutter/lib/src/widgets/shortcuts.dart | 22 ++----------------- .../flutter/test/material/debug_test.dart | 6 +---- 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/packages/flutter/lib/src/widgets/shortcuts.dart b/packages/flutter/lib/src/widgets/shortcuts.dart index a5d84f4a37dd..2179da4d4421 100644 --- a/packages/flutter/lib/src/widgets/shortcuts.dart +++ b/packages/flutter/lib/src/widgets/shortcuts.dart @@ -860,7 +860,7 @@ class Shortcuts extends StatefulWidget { /// If this widget was created with [Shortcuts.manager], then /// [ShortcutManager.shortcuts] will be used as the source for shortcuts. If /// the unnamed constructor is used, this manager will be null, and a - /// default-constructed `ShortcutsManager` will be used. + /// default-constructed [ShortcutManager] will be used. final ShortcutManager? manager; /// {@template flutter.widgets.shortcuts.shortcuts} @@ -944,29 +944,11 @@ class _ShortcutsState extends State { debugLabel: '$Shortcuts', canRequestFocus: false, onKey: _handleOnKey, - child: _ShortcutsMarker( - manager: manager, - child: widget.child, - ), + child: widget.child, ); } } -class _ShortcutsMarker extends InheritedWidget { - const _ShortcutsMarker({ - required this.manager, - required super.child, - }) : assert(manager != null), - assert(child != null); - - final ShortcutManager manager; - - @override - bool updateShouldNotify(_ShortcutsMarker oldWidget) { - return manager != oldWidget.manager; - } -} - /// A widget that provides an uncomplicated mechanism for binding a key /// combination to a specific callback. /// diff --git a/packages/flutter/test/material/debug_test.dart b/packages/flutter/test/material/debug_test.dart index 554393780a5d..ef90ff95c038 100644 --- a/packages/flutter/test/material/debug_test.dart +++ b/packages/flutter/test/material/debug_test.dart @@ -187,7 +187,6 @@ void main() { ' MediaQuery\n' ' _MediaQueryFromWindow\n' ' _ShortcutRegistrarMarker\n' - ' _ShortcutsMarker\n' ' Semantics\n' ' _FocusMarker\n' ' Focus\n' @@ -200,19 +199,16 @@ void main() { ' _ActionsMarker\n' ' Actions\n' '${kIsWeb - ? ' _ShortcutsMarker\n' - ' Semantics\n' + ? ' Semantics\n' ' _FocusMarker\n' ' Focus\n' ' Shortcuts\n' : ''}' - ' _ShortcutsMarker\n' ' Semantics\n' ' _FocusMarker\n' ' Focus\n' ' Shortcuts\n' ' DefaultTextEditingShortcuts\n' - ' _ShortcutsMarker\n' ' Semantics\n' ' _FocusMarker\n' ' Focus\n'