Skip to content

Commit

Permalink
Remove extraneous InheritedWidget (flutter#104676)
Browse files Browse the repository at this point in the history
When I removed Shortcuts.of and Shortcuts.maybeOf, I forgot to also remove the associated InheritedWidget. This does that.
  • Loading branch information
gspencergoog committed May 26, 2022
1 parent be7a422 commit 3e7e01c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 25 deletions.
22 changes: 2 additions & 20 deletions packages/flutter/lib/src/widgets/shortcuts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -944,29 +944,11 @@ class _ShortcutsState extends State<Shortcuts> {
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.
///
Expand Down
6 changes: 1 addition & 5 deletions packages/flutter/test/material/debug_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ void main() {
' MediaQuery\n'
' _MediaQueryFromWindow\n'
' _ShortcutRegistrarMarker\n'
' _ShortcutsMarker\n'
' Semantics\n'
' _FocusMarker\n'
' Focus\n'
Expand All @@ -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'
Expand Down

0 comments on commit 3e7e01c

Please sign in to comment.