Rename _*Marker
classes to be _*Scope
, for consistency (#118070)
* Rename _*Marker classes to be _*Scope, for consistency * [EMPTY] Commit to refresh the tree that is currently red (#118062) * Fix remaining tests Co-authored-by: Drew Roen <102626803+drewroengoogle@users.noreply.github.com>
This commit is contained in:
parent
a3629a223f
commit
ae7b99efb5
@ -362,7 +362,7 @@ class _MenuAnchorState extends State<MenuAnchor> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return _MenuAnchorMarker(
|
return _MenuAnchorScope(
|
||||||
anchorKey: _anchorKey,
|
anchorKey: _anchorKey,
|
||||||
anchor: this,
|
anchor: this,
|
||||||
isOpen: _isOpen,
|
isOpen: _isOpen,
|
||||||
@ -511,7 +511,7 @@ class _MenuAnchorState extends State<MenuAnchor> {
|
|||||||
// Copy all the themes from the supplied outer context to the
|
// Copy all the themes from the supplied outer context to the
|
||||||
// overlay.
|
// overlay.
|
||||||
outerContext,
|
outerContext,
|
||||||
_MenuAnchorMarker(
|
_MenuAnchorScope(
|
||||||
// Re-advertize the anchor here in the overlay, since
|
// Re-advertize the anchor here in the overlay, since
|
||||||
// otherwise a search for the anchor by descendants won't find
|
// otherwise a search for the anchor by descendants won't find
|
||||||
// it.
|
// it.
|
||||||
@ -571,7 +571,7 @@ class _MenuAnchorState extends State<MenuAnchor> {
|
|||||||
// dependency relationship that will rebuild the context when the node
|
// dependency relationship that will rebuild the context when the node
|
||||||
// changes.
|
// changes.
|
||||||
static _MenuAnchorState? _maybeOf(BuildContext context) {
|
static _MenuAnchorState? _maybeOf(BuildContext context) {
|
||||||
return context.dependOnInheritedWidgetOfExactType<_MenuAnchorMarker>()?.anchor;
|
return context.dependOnInheritedWidgetOfExactType<_MenuAnchorScope>()?.anchor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2195,8 +2195,8 @@ class _LocalizedShortcutLabeler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _MenuAnchorMarker extends InheritedWidget {
|
class _MenuAnchorScope extends InheritedWidget {
|
||||||
const _MenuAnchorMarker({
|
const _MenuAnchorScope({
|
||||||
required super.child,
|
required super.child,
|
||||||
required this.anchorKey,
|
required this.anchorKey,
|
||||||
required this.anchor,
|
required this.anchor,
|
||||||
@ -2208,7 +2208,7 @@ class _MenuAnchorMarker extends InheritedWidget {
|
|||||||
final bool isOpen;
|
final bool isOpen;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool updateShouldNotify(_MenuAnchorMarker oldWidget) {
|
bool updateShouldNotify(_MenuAnchorScope oldWidget) {
|
||||||
return anchorKey != oldWidget.anchorKey
|
return anchorKey != oldWidget.anchorKey
|
||||||
|| anchor != oldWidget.anchor
|
|| anchor != oldWidget.anchor
|
||||||
|| isOpen != oldWidget.isOpen;
|
|| isOpen != oldWidget.isOpen;
|
||||||
|
@ -681,7 +681,7 @@ class Actions extends StatefulWidget {
|
|||||||
// getElementForInheritedWidgetOfExactType. Returns true if the visitor found
|
// getElementForInheritedWidgetOfExactType. Returns true if the visitor found
|
||||||
// what it was looking for.
|
// what it was looking for.
|
||||||
static bool _visitActionsAncestors(BuildContext context, bool Function(InheritedElement element) visitor) {
|
static bool _visitActionsAncestors(BuildContext context, bool Function(InheritedElement element) visitor) {
|
||||||
InheritedElement? actionsElement = context.getElementForInheritedWidgetOfExactType<_ActionsMarker>();
|
InheritedElement? actionsElement = context.getElementForInheritedWidgetOfExactType<_ActionsScope>();
|
||||||
while (actionsElement != null) {
|
while (actionsElement != null) {
|
||||||
if (visitor(actionsElement) == true) {
|
if (visitor(actionsElement) == true) {
|
||||||
break;
|
break;
|
||||||
@ -690,7 +690,7 @@ class Actions extends StatefulWidget {
|
|||||||
// context.getElementForInheritedWidgetOfExactType will return itself if it
|
// context.getElementForInheritedWidgetOfExactType will return itself if it
|
||||||
// happens to be of the correct type.
|
// happens to be of the correct type.
|
||||||
final BuildContext parent = _getParent(actionsElement);
|
final BuildContext parent = _getParent(actionsElement);
|
||||||
actionsElement = parent.getElementForInheritedWidgetOfExactType<_ActionsMarker>();
|
actionsElement = parent.getElementForInheritedWidgetOfExactType<_ActionsScope>();
|
||||||
}
|
}
|
||||||
return actionsElement != null;
|
return actionsElement != null;
|
||||||
}
|
}
|
||||||
@ -700,7 +700,7 @@ class Actions extends StatefulWidget {
|
|||||||
static ActionDispatcher _findDispatcher(BuildContext context) {
|
static ActionDispatcher _findDispatcher(BuildContext context) {
|
||||||
ActionDispatcher? dispatcher;
|
ActionDispatcher? dispatcher;
|
||||||
_visitActionsAncestors(context, (InheritedElement element) {
|
_visitActionsAncestors(context, (InheritedElement element) {
|
||||||
final ActionDispatcher? found = (element.widget as _ActionsMarker).dispatcher;
|
final ActionDispatcher? found = (element.widget as _ActionsScope).dispatcher;
|
||||||
if (found != null) {
|
if (found != null) {
|
||||||
dispatcher = found;
|
dispatcher = found;
|
||||||
return true;
|
return true;
|
||||||
@ -807,7 +807,7 @@ class Actions extends StatefulWidget {
|
|||||||
);
|
);
|
||||||
|
|
||||||
_visitActionsAncestors(context, (InheritedElement element) {
|
_visitActionsAncestors(context, (InheritedElement element) {
|
||||||
final _ActionsMarker actions = element.widget as _ActionsMarker;
|
final _ActionsScope actions = element.widget as _ActionsScope;
|
||||||
final Action<T>? result = _castAction(actions, intent: intent);
|
final Action<T>? result = _castAction(actions, intent: intent);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
context.dependOnInheritedElement(element);
|
context.dependOnInheritedElement(element);
|
||||||
@ -836,7 +836,7 @@ class Actions extends StatefulWidget {
|
|||||||
);
|
);
|
||||||
|
|
||||||
_visitActionsAncestors(context, (InheritedElement element) {
|
_visitActionsAncestors(context, (InheritedElement element) {
|
||||||
final _ActionsMarker actions = element.widget as _ActionsMarker;
|
final _ActionsScope actions = element.widget as _ActionsScope;
|
||||||
final Action<T>? result = _castAction(actions, intent: intent);
|
final Action<T>? result = _castAction(actions, intent: intent);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
action = result;
|
action = result;
|
||||||
@ -849,8 +849,8 @@ class Actions extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Find the [Action] that handles the given `intent` in the given
|
// Find the [Action] that handles the given `intent` in the given
|
||||||
// `_ActionsMarker`, and verify it has the right type parameter.
|
// `_ActionsScope`, and verify it has the right type parameter.
|
||||||
static Action<T>? _castAction<T extends Intent>(_ActionsMarker actionsMarker, { T? intent }) {
|
static Action<T>? _castAction<T extends Intent>(_ActionsScope actionsMarker, { T? intent }) {
|
||||||
final Action<Intent>? mappedAction = actionsMarker.actions[intent?.runtimeType ?? T];
|
final Action<Intent>? mappedAction = actionsMarker.actions[intent?.runtimeType ?? T];
|
||||||
if (mappedAction is Action<T>?) {
|
if (mappedAction is Action<T>?) {
|
||||||
return mappedAction;
|
return mappedAction;
|
||||||
@ -870,7 +870,7 @@ class Actions extends StatefulWidget {
|
|||||||
/// widget is found.
|
/// widget is found.
|
||||||
static ActionDispatcher of(BuildContext context) {
|
static ActionDispatcher of(BuildContext context) {
|
||||||
assert(context != null);
|
assert(context != null);
|
||||||
final _ActionsMarker? marker = context.dependOnInheritedWidgetOfExactType<_ActionsMarker>();
|
final _ActionsScope? marker = context.dependOnInheritedWidgetOfExactType<_ActionsScope>();
|
||||||
return marker?.dispatcher ?? _findDispatcher(context);
|
return marker?.dispatcher ?? _findDispatcher(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -897,7 +897,7 @@ class Actions extends StatefulWidget {
|
|||||||
Object? returnValue;
|
Object? returnValue;
|
||||||
|
|
||||||
final bool actionFound = _visitActionsAncestors(context, (InheritedElement element) {
|
final bool actionFound = _visitActionsAncestors(context, (InheritedElement element) {
|
||||||
final _ActionsMarker actions = element.widget as _ActionsMarker;
|
final _ActionsScope actions = element.widget as _ActionsScope;
|
||||||
final Action<T>? result = _castAction(actions, intent: intent);
|
final Action<T>? result = _castAction(actions, intent: intent);
|
||||||
if (result != null && result.isEnabled(intent)) {
|
if (result != null && result.isEnabled(intent)) {
|
||||||
// Invoke the action we found using the relevant dispatcher from the Actions
|
// Invoke the action we found using the relevant dispatcher from the Actions
|
||||||
@ -950,7 +950,7 @@ class Actions extends StatefulWidget {
|
|||||||
Object? returnValue;
|
Object? returnValue;
|
||||||
|
|
||||||
_visitActionsAncestors(context, (InheritedElement element) {
|
_visitActionsAncestors(context, (InheritedElement element) {
|
||||||
final _ActionsMarker actions = element.widget as _ActionsMarker;
|
final _ActionsScope actions = element.widget as _ActionsScope;
|
||||||
final Action<T>? result = _castAction(actions, intent: intent);
|
final Action<T>? result = _castAction(actions, intent: intent);
|
||||||
if (result != null && result.isEnabled(intent)) {
|
if (result != null && result.isEnabled(intent)) {
|
||||||
// Invoke the action we found using the relevant dispatcher from the Actions
|
// Invoke the action we found using the relevant dispatcher from the Actions
|
||||||
@ -1024,7 +1024,7 @@ class _ActionsState extends State<Actions> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return _ActionsMarker(
|
return _ActionsScope(
|
||||||
actions: widget.actions,
|
actions: widget.actions,
|
||||||
dispatcher: widget.dispatcher,
|
dispatcher: widget.dispatcher,
|
||||||
rebuildKey: rebuildKey,
|
rebuildKey: rebuildKey,
|
||||||
@ -1035,8 +1035,8 @@ class _ActionsState extends State<Actions> {
|
|||||||
|
|
||||||
// An inherited widget used by Actions widget for fast lookup of the Actions
|
// An inherited widget used by Actions widget for fast lookup of the Actions
|
||||||
// widget information.
|
// widget information.
|
||||||
class _ActionsMarker extends InheritedWidget {
|
class _ActionsScope extends InheritedWidget {
|
||||||
const _ActionsMarker({
|
const _ActionsScope({
|
||||||
required this.dispatcher,
|
required this.dispatcher,
|
||||||
required this.actions,
|
required this.actions,
|
||||||
required this.rebuildKey,
|
required this.rebuildKey,
|
||||||
@ -1049,7 +1049,7 @@ class _ActionsMarker extends InheritedWidget {
|
|||||||
final Object rebuildKey;
|
final Object rebuildKey;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool updateShouldNotify(_ActionsMarker oldWidget) {
|
bool updateShouldNotify(_ActionsScope oldWidget) {
|
||||||
return rebuildKey != oldWidget.rebuildKey
|
return rebuildKey != oldWidget.rebuildKey
|
||||||
|| oldWidget.dispatcher != dispatcher
|
|| oldWidget.dispatcher != dispatcher
|
||||||
|| !mapEquals<Type, Action<Intent>>(oldWidget.actions, actions);
|
|| !mapEquals<Type, Action<Intent>>(oldWidget.actions, actions);
|
||||||
|
@ -388,7 +388,7 @@ class Focus extends StatefulWidget {
|
|||||||
static FocusNode of(BuildContext context, { bool scopeOk = false }) {
|
static FocusNode of(BuildContext context, { bool scopeOk = false }) {
|
||||||
assert(context != null);
|
assert(context != null);
|
||||||
assert(scopeOk != null);
|
assert(scopeOk != null);
|
||||||
final _FocusMarker? marker = context.dependOnInheritedWidgetOfExactType<_FocusMarker>();
|
final _FocusInheritedScope? marker = context.dependOnInheritedWidgetOfExactType<_FocusInheritedScope>();
|
||||||
final FocusNode? node = marker?.notifier;
|
final FocusNode? node = marker?.notifier;
|
||||||
assert(() {
|
assert(() {
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
@ -440,7 +440,7 @@ class Focus extends StatefulWidget {
|
|||||||
static FocusNode? maybeOf(BuildContext context, { bool scopeOk = false }) {
|
static FocusNode? maybeOf(BuildContext context, { bool scopeOk = false }) {
|
||||||
assert(context != null);
|
assert(context != null);
|
||||||
assert(scopeOk != null);
|
assert(scopeOk != null);
|
||||||
final _FocusMarker? marker = context.dependOnInheritedWidgetOfExactType<_FocusMarker>();
|
final _FocusInheritedScope? marker = context.dependOnInheritedWidgetOfExactType<_FocusInheritedScope>();
|
||||||
final FocusNode? node = marker?.notifier;
|
final FocusNode? node = marker?.notifier;
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
return null;
|
return null;
|
||||||
@ -686,7 +686,7 @@ class _FocusState extends State<Focus> {
|
|||||||
child: widget.child,
|
child: widget.child,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return _FocusMarker(
|
return _FocusInheritedScope(
|
||||||
node: focusNode,
|
node: focusNode,
|
||||||
child: child,
|
child: child,
|
||||||
);
|
);
|
||||||
@ -798,7 +798,7 @@ class FocusScope extends Focus {
|
|||||||
/// The [context] argument must not be null.
|
/// The [context] argument must not be null.
|
||||||
static FocusScopeNode of(BuildContext context) {
|
static FocusScopeNode of(BuildContext context) {
|
||||||
assert(context != null);
|
assert(context != null);
|
||||||
final _FocusMarker? marker = context.dependOnInheritedWidgetOfExactType<_FocusMarker>();
|
final _FocusInheritedScope? marker = context.dependOnInheritedWidgetOfExactType<_FocusInheritedScope>();
|
||||||
return marker?.notifier?.nearestScope ?? context.owner!.focusManager.rootScope;
|
return marker?.notifier?.nearestScope ?? context.owner!.focusManager.rootScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -853,7 +853,7 @@ class _FocusScopeState extends _FocusState {
|
|||||||
_focusAttachment!.reparent(parent: widget.parentNode);
|
_focusAttachment!.reparent(parent: widget.parentNode);
|
||||||
return Semantics(
|
return Semantics(
|
||||||
explicitChildNodes: true,
|
explicitChildNodes: true,
|
||||||
child: _FocusMarker(
|
child: _FocusInheritedScope(
|
||||||
node: focusNode,
|
node: focusNode,
|
||||||
child: widget.child,
|
child: widget.child,
|
||||||
),
|
),
|
||||||
@ -861,9 +861,9 @@ class _FocusScopeState extends _FocusState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The InheritedWidget marker for Focus and FocusScope.
|
// The InheritedWidget for Focus and FocusScope.
|
||||||
class _FocusMarker extends InheritedNotifier<FocusNode> {
|
class _FocusInheritedScope extends InheritedNotifier<FocusNode> {
|
||||||
const _FocusMarker({
|
const _FocusInheritedScope({
|
||||||
required FocusNode node,
|
required FocusNode node,
|
||||||
required super.child,
|
required super.child,
|
||||||
}) : assert(node != null),
|
}) : assert(node != null),
|
||||||
|
@ -47,7 +47,7 @@ void _focusAndEnsureVisible(
|
|||||||
// sorting their contents.
|
// sorting their contents.
|
||||||
class _FocusTraversalGroupInfo {
|
class _FocusTraversalGroupInfo {
|
||||||
_FocusTraversalGroupInfo(
|
_FocusTraversalGroupInfo(
|
||||||
_FocusTraversalGroupMarker? marker, {
|
_FocusTraversalGroupScope? marker, {
|
||||||
FocusTraversalPolicy? defaultPolicy,
|
FocusTraversalPolicy? defaultPolicy,
|
||||||
List<FocusNode>? members,
|
List<FocusNode>? members,
|
||||||
}) : groupNode = marker?.focusNode,
|
}) : groupNode = marker?.focusNode,
|
||||||
@ -319,20 +319,20 @@ abstract class FocusTraversalPolicy with Diagnosticable {
|
|||||||
@protected
|
@protected
|
||||||
Iterable<FocusNode> sortDescendants(Iterable<FocusNode> descendants, FocusNode currentNode);
|
Iterable<FocusNode> sortDescendants(Iterable<FocusNode> descendants, FocusNode currentNode);
|
||||||
|
|
||||||
_FocusTraversalGroupMarker? _getMarker(BuildContext? context) {
|
_FocusTraversalGroupScope? _getMarker(BuildContext? context) {
|
||||||
return context?.getElementForInheritedWidgetOfExactType<_FocusTraversalGroupMarker>()?.widget as _FocusTraversalGroupMarker?;
|
return context?.getElementForInheritedWidgetOfExactType<_FocusTraversalGroupScope>()?.widget as _FocusTraversalGroupScope?;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort all descendants, taking into account the FocusTraversalGroup
|
// Sort all descendants, taking into account the FocusTraversalGroup
|
||||||
// that they are each in, and filtering out non-traversable/focusable nodes.
|
// that they are each in, and filtering out non-traversable/focusable nodes.
|
||||||
List<FocusNode> _sortAllDescendants(FocusScopeNode scope, FocusNode currentNode) {
|
List<FocusNode> _sortAllDescendants(FocusScopeNode scope, FocusNode currentNode) {
|
||||||
assert(scope != null);
|
assert(scope != null);
|
||||||
final _FocusTraversalGroupMarker? scopeGroupMarker = _getMarker(scope.context);
|
final _FocusTraversalGroupScope? scopeGroupMarker = _getMarker(scope.context);
|
||||||
final FocusTraversalPolicy defaultPolicy = scopeGroupMarker?.policy ?? ReadingOrderTraversalPolicy();
|
final FocusTraversalPolicy defaultPolicy = scopeGroupMarker?.policy ?? ReadingOrderTraversalPolicy();
|
||||||
// Build the sorting data structure, separating descendants into groups.
|
// Build the sorting data structure, separating descendants into groups.
|
||||||
final Map<FocusNode?, _FocusTraversalGroupInfo> groups = <FocusNode?, _FocusTraversalGroupInfo>{};
|
final Map<FocusNode?, _FocusTraversalGroupInfo> groups = <FocusNode?, _FocusTraversalGroupInfo>{};
|
||||||
for (final FocusNode node in scope.descendants) {
|
for (final FocusNode node in scope.descendants) {
|
||||||
final _FocusTraversalGroupMarker? groupMarker = _getMarker(node.context);
|
final _FocusTraversalGroupScope? groupMarker = _getMarker(node.context);
|
||||||
final FocusNode? groupNode = groupMarker?.focusNode;
|
final FocusNode? groupNode = groupMarker?.focusNode;
|
||||||
// Group nodes need to be added to their parent's node, or to the "null"
|
// Group nodes need to be added to their parent's node, or to the "null"
|
||||||
// node if no parent is found. This creates the hierarchy of group nodes
|
// node if no parent is found. This creates the hierarchy of group nodes
|
||||||
@ -344,7 +344,7 @@ abstract class FocusTraversalPolicy with Diagnosticable {
|
|||||||
// looking with that node's parent, since _getMarker will return the
|
// looking with that node's parent, since _getMarker will return the
|
||||||
// context it was called on if it matches the type.
|
// context it was called on if it matches the type.
|
||||||
final BuildContext? parentContext = _getAncestor(groupNode!.context!, count: 2);
|
final BuildContext? parentContext = _getAncestor(groupNode!.context!, count: 2);
|
||||||
final _FocusTraversalGroupMarker? parentMarker = _getMarker(parentContext);
|
final _FocusTraversalGroupScope? parentMarker = _getMarker(parentContext);
|
||||||
final FocusNode? parentNode = parentMarker?.focusNode;
|
final FocusNode? parentNode = parentMarker?.focusNode;
|
||||||
groups[parentNode] ??= _FocusTraversalGroupInfo(parentMarker, members: <FocusNode>[], defaultPolicy: defaultPolicy);
|
groups[parentNode] ??= _FocusTraversalGroupInfo(parentMarker, members: <FocusNode>[], defaultPolicy: defaultPolicy);
|
||||||
assert(!groups[parentNode]!.members.contains(node));
|
assert(!groups[parentNode]!.members.contains(node));
|
||||||
@ -1586,7 +1586,7 @@ class FocusTraversalGroup extends StatefulWidget {
|
|||||||
/// [FocusTraversalGroup] ancestor is found.
|
/// [FocusTraversalGroup] ancestor is found.
|
||||||
static FocusTraversalPolicy of(BuildContext context) {
|
static FocusTraversalPolicy of(BuildContext context) {
|
||||||
assert(context != null);
|
assert(context != null);
|
||||||
final _FocusTraversalGroupMarker? inherited = context.dependOnInheritedWidgetOfExactType<_FocusTraversalGroupMarker>();
|
final _FocusTraversalGroupScope? inherited = context.dependOnInheritedWidgetOfExactType<_FocusTraversalGroupScope>();
|
||||||
assert(() {
|
assert(() {
|
||||||
if (inherited == null) {
|
if (inherited == null) {
|
||||||
throw FlutterError(
|
throw FlutterError(
|
||||||
@ -1621,7 +1621,7 @@ class FocusTraversalGroup extends StatefulWidget {
|
|||||||
/// ancestor is found.
|
/// ancestor is found.
|
||||||
static FocusTraversalPolicy? maybeOf(BuildContext context) {
|
static FocusTraversalPolicy? maybeOf(BuildContext context) {
|
||||||
assert(context != null);
|
assert(context != null);
|
||||||
final _FocusTraversalGroupMarker? inherited = context.dependOnInheritedWidgetOfExactType<_FocusTraversalGroupMarker>();
|
final _FocusTraversalGroupScope? inherited = context.dependOnInheritedWidgetOfExactType<_FocusTraversalGroupScope>();
|
||||||
return inherited?.policy;
|
return inherited?.policy;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1659,7 +1659,7 @@ class _FocusTraversalGroupState extends State<FocusTraversalGroup> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return _FocusTraversalGroupMarker(
|
return _FocusTraversalGroupScope(
|
||||||
policy: widget.policy,
|
policy: widget.policy,
|
||||||
focusNode: focusNode,
|
focusNode: focusNode,
|
||||||
child: Focus(
|
child: Focus(
|
||||||
@ -1676,8 +1676,8 @@ class _FocusTraversalGroupState extends State<FocusTraversalGroup> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// A "marker" inherited widget to make the group faster to find.
|
// A "marker" inherited widget to make the group faster to find.
|
||||||
class _FocusTraversalGroupMarker extends InheritedWidget {
|
class _FocusTraversalGroupScope extends InheritedWidget {
|
||||||
const _FocusTraversalGroupMarker({
|
const _FocusTraversalGroupScope({
|
||||||
required this.policy,
|
required this.policy,
|
||||||
required this.focusNode,
|
required this.focusNode,
|
||||||
required super.child,
|
required super.child,
|
||||||
|
@ -1277,8 +1277,8 @@ class ShortcutRegistry with ChangeNotifier {
|
|||||||
/// it doesn't find a [ShortcutRegistrar] ancestor.
|
/// it doesn't find a [ShortcutRegistrar] ancestor.
|
||||||
static ShortcutRegistry of(BuildContext context) {
|
static ShortcutRegistry of(BuildContext context) {
|
||||||
assert(context != null);
|
assert(context != null);
|
||||||
final _ShortcutRegistrarMarker? inherited =
|
final _ShortcutRegistrarScope? inherited =
|
||||||
context.dependOnInheritedWidgetOfExactType<_ShortcutRegistrarMarker>();
|
context.dependOnInheritedWidgetOfExactType<_ShortcutRegistrarScope>();
|
||||||
assert(() {
|
assert(() {
|
||||||
if (inherited == null) {
|
if (inherited == null) {
|
||||||
throw FlutterError(
|
throw FlutterError(
|
||||||
@ -1313,8 +1313,8 @@ class ShortcutRegistry with ChangeNotifier {
|
|||||||
/// [ShortcutRegistrar] ancestor.
|
/// [ShortcutRegistrar] ancestor.
|
||||||
static ShortcutRegistry? maybeOf(BuildContext context) {
|
static ShortcutRegistry? maybeOf(BuildContext context) {
|
||||||
assert(context != null);
|
assert(context != null);
|
||||||
final _ShortcutRegistrarMarker? inherited =
|
final _ShortcutRegistrarScope? inherited =
|
||||||
context.dependOnInheritedWidgetOfExactType<_ShortcutRegistrarMarker>();
|
context.dependOnInheritedWidgetOfExactType<_ShortcutRegistrarScope>();
|
||||||
return inherited?.registry;
|
return inherited?.registry;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1431,7 +1431,7 @@ class _ShortcutRegistrarState extends State<ShortcutRegistrar> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return _ShortcutRegistrarMarker(
|
return _ShortcutRegistrarScope(
|
||||||
registry: registry,
|
registry: registry,
|
||||||
child: Shortcuts.manager(
|
child: Shortcuts.manager(
|
||||||
manager: manager,
|
manager: manager,
|
||||||
@ -1441,8 +1441,8 @@ class _ShortcutRegistrarState extends State<ShortcutRegistrar> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ShortcutRegistrarMarker extends InheritedWidget {
|
class _ShortcutRegistrarScope extends InheritedWidget {
|
||||||
const _ShortcutRegistrarMarker({
|
const _ShortcutRegistrarScope({
|
||||||
required this.registry,
|
required this.registry,
|
||||||
required super.child,
|
required super.child,
|
||||||
});
|
});
|
||||||
@ -1450,7 +1450,7 @@ class _ShortcutRegistrarMarker extends InheritedWidget {
|
|||||||
final ShortcutRegistry registry;
|
final ShortcutRegistry registry;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool updateShouldNotify(covariant _ShortcutRegistrarMarker oldWidget) {
|
bool updateShouldNotify(covariant _ShortcutRegistrarScope oldWidget) {
|
||||||
return registry != oldWidget.registry;
|
return registry != oldWidget.registry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,11 +137,11 @@ void main() {
|
|||||||
' _FadeUpwardsPageTransition\n'
|
' _FadeUpwardsPageTransition\n'
|
||||||
' AnimatedBuilder\n'
|
' AnimatedBuilder\n'
|
||||||
' RepaintBoundary\n'
|
' RepaintBoundary\n'
|
||||||
' _FocusMarker\n'
|
' _FocusInheritedScope\n'
|
||||||
' Semantics\n'
|
' Semantics\n'
|
||||||
' FocusScope\n'
|
' FocusScope\n'
|
||||||
' PrimaryScrollController\n'
|
' PrimaryScrollController\n'
|
||||||
' _ActionsMarker\n'
|
' _ActionsScope\n'
|
||||||
' Actions\n'
|
' Actions\n'
|
||||||
' Builder\n'
|
' Builder\n'
|
||||||
' PageStorage\n'
|
' PageStorage\n'
|
||||||
@ -158,17 +158,17 @@ void main() {
|
|||||||
' _Theatre\n'
|
' _Theatre\n'
|
||||||
' Overlay-[LabeledGlobalKey<OverlayState>#00000]\n'
|
' Overlay-[LabeledGlobalKey<OverlayState>#00000]\n'
|
||||||
' UnmanagedRestorationScope\n'
|
' UnmanagedRestorationScope\n'
|
||||||
' _FocusMarker\n'
|
' _FocusInheritedScope\n'
|
||||||
' Focus\n'
|
' Focus\n'
|
||||||
' _FocusMarker\n'
|
' _FocusInheritedScope\n'
|
||||||
' Focus\n'
|
' Focus\n'
|
||||||
' _FocusTraversalGroupMarker\n'
|
' _FocusTraversalGroupScope\n'
|
||||||
' FocusTraversalGroup\n'
|
' FocusTraversalGroup\n'
|
||||||
' AbsorbPointer\n'
|
' AbsorbPointer\n'
|
||||||
' Listener\n'
|
' Listener\n'
|
||||||
' HeroControllerScope\n'
|
' HeroControllerScope\n'
|
||||||
' Navigator-[GlobalObjectKey<NavigatorState> _WidgetsAppState#00000]\n'
|
' Navigator-[GlobalObjectKey<NavigatorState> _WidgetsAppState#00000]\n'
|
||||||
' _FocusMarker\n'
|
' _FocusInheritedScope\n'
|
||||||
' Semantics\n'
|
' Semantics\n'
|
||||||
' FocusScope\n'
|
' FocusScope\n'
|
||||||
' DefaultSelectionStyle\n'
|
' DefaultSelectionStyle\n'
|
||||||
@ -195,31 +195,31 @@ void main() {
|
|||||||
' MediaQuery\n'
|
' MediaQuery\n'
|
||||||
' _MediaQueryFromWindow\n'
|
' _MediaQueryFromWindow\n'
|
||||||
' Semantics\n'
|
' Semantics\n'
|
||||||
' _FocusMarker\n'
|
' _FocusInheritedScope\n'
|
||||||
' Focus\n'
|
' Focus\n'
|
||||||
' Shortcuts\n'
|
' Shortcuts\n'
|
||||||
' _ShortcutRegistrarMarker\n'
|
' _ShortcutRegistrarScope\n'
|
||||||
' ShortcutRegistrar\n'
|
' ShortcutRegistrar\n'
|
||||||
' TapRegionSurface\n'
|
' TapRegionSurface\n'
|
||||||
' _FocusMarker\n'
|
' _FocusInheritedScope\n'
|
||||||
' Focus\n'
|
' Focus\n'
|
||||||
' _FocusTraversalGroupMarker\n'
|
' _FocusTraversalGroupScope\n'
|
||||||
' FocusTraversalGroup\n'
|
' FocusTraversalGroup\n'
|
||||||
' _ActionsMarker\n'
|
' _ActionsScope\n'
|
||||||
' Actions\n'
|
' Actions\n'
|
||||||
'${kIsWeb
|
'${kIsWeb
|
||||||
? ' Semantics\n'
|
? ' Semantics\n'
|
||||||
' _FocusMarker\n'
|
' _FocusInheritedScope\n'
|
||||||
' Focus\n'
|
' Focus\n'
|
||||||
' Shortcuts\n'
|
' Shortcuts\n'
|
||||||
: ''}'
|
: ''}'
|
||||||
' Semantics\n'
|
' Semantics\n'
|
||||||
' _FocusMarker\n'
|
' _FocusInheritedScope\n'
|
||||||
' Focus\n'
|
' Focus\n'
|
||||||
' Shortcuts\n'
|
' Shortcuts\n'
|
||||||
' DefaultTextEditingShortcuts\n'
|
' DefaultTextEditingShortcuts\n'
|
||||||
' Semantics\n'
|
' Semantics\n'
|
||||||
' _FocusMarker\n'
|
' _FocusInheritedScope\n'
|
||||||
' Focus\n'
|
' Focus\n'
|
||||||
' Shortcuts\n'
|
' Shortcuts\n'
|
||||||
' _SharedAppModel\n'
|
' _SharedAppModel\n'
|
||||||
@ -230,7 +230,7 @@ void main() {
|
|||||||
' RootRestorationScope\n'
|
' RootRestorationScope\n'
|
||||||
' WidgetsApp-[GlobalObjectKey _MaterialAppState#00000]\n'
|
' WidgetsApp-[GlobalObjectKey _MaterialAppState#00000]\n'
|
||||||
' Semantics\n'
|
' Semantics\n'
|
||||||
' _FocusMarker\n'
|
' _FocusInheritedScope\n'
|
||||||
' Focus\n'
|
' Focus\n'
|
||||||
' HeroControllerScope\n'
|
' HeroControllerScope\n'
|
||||||
' ScrollConfiguration\n'
|
' ScrollConfiguration\n'
|
||||||
@ -362,7 +362,7 @@ void main() {
|
|||||||
' MediaQuery\n'
|
' MediaQuery\n'
|
||||||
' LayoutId-[<_ScaffoldSlot.snackBar>]\n'
|
' LayoutId-[<_ScaffoldSlot.snackBar>]\n'
|
||||||
' CustomMultiChildLayout\n'
|
' CustomMultiChildLayout\n'
|
||||||
' _ActionsMarker\n'
|
' _ActionsScope\n'
|
||||||
' Actions\n'
|
' Actions\n'
|
||||||
' AnimatedBuilder\n'
|
' AnimatedBuilder\n'
|
||||||
' DefaultTextStyle\n'
|
' DefaultTextStyle\n'
|
||||||
|
@ -2443,7 +2443,7 @@ void main() {
|
|||||||
' MediaQuery\n'
|
' MediaQuery\n'
|
||||||
' LayoutId-[<_ScaffoldSlot.body>]\n'
|
' LayoutId-[<_ScaffoldSlot.body>]\n'
|
||||||
' CustomMultiChildLayout\n'
|
' CustomMultiChildLayout\n'
|
||||||
' _ActionsMarker\n'
|
' _ActionsScope\n'
|
||||||
' Actions\n'
|
' Actions\n'
|
||||||
' AnimatedBuilder\n'
|
' AnimatedBuilder\n'
|
||||||
' DefaultTextStyle\n'
|
' DefaultTextStyle\n'
|
||||||
|
@ -2494,7 +2494,7 @@ void main() {
|
|||||||
|
|
||||||
expect(
|
expect(
|
||||||
tester.allWidgets.map((Widget widget) => widget.runtimeType.toString()).toList(),
|
tester.allWidgets.map((Widget widget) => widget.runtimeType.toString()).toList(),
|
||||||
containsAllInOrder(<String>['PlatformViewLink', 'Focus', '_FocusMarker', 'Semantics', 'PlatformViewSurface']),
|
containsAllInOrder(<String>['PlatformViewLink', 'Focus', '_FocusInheritedScope', 'Semantics', 'PlatformViewSurface']),
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(createdPlatformViewId, currentViewId + 1);
|
expect(createdPlatformViewId, currentViewId + 1);
|
||||||
@ -2591,7 +2591,7 @@ void main() {
|
|||||||
|
|
||||||
expect(
|
expect(
|
||||||
tester.allWidgets.map((Widget widget) => widget.runtimeType.toString()).toList(),
|
tester.allWidgets.map((Widget widget) => widget.runtimeType.toString()).toList(),
|
||||||
containsAllInOrder(<String>['PlatformViewLink', 'Focus', '_FocusMarker', 'Semantics', 'PlatformViewSurface']),
|
containsAllInOrder(<String>['PlatformViewLink', 'Focus', '_FocusInheritedScope', 'Semantics', 'PlatformViewSurface']),
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(createdPlatformViewId, currentViewId + 1);
|
expect(createdPlatformViewId, currentViewId + 1);
|
||||||
@ -2686,7 +2686,7 @@ void main() {
|
|||||||
|
|
||||||
expect(
|
expect(
|
||||||
tester.allWidgets.map((Widget widget) => widget.runtimeType.toString()).toList(),
|
tester.allWidgets.map((Widget widget) => widget.runtimeType.toString()).toList(),
|
||||||
containsAllInOrder(<String>['PlatformViewLink', 'Focus', '_FocusMarker', 'Semantics', 'PlatformViewSurface']),
|
containsAllInOrder(<String>['PlatformViewLink', 'Focus', '_FocusInheritedScope', 'Semantics', 'PlatformViewSurface']),
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(createdPlatformViewId, currentViewId + 1);
|
expect(createdPlatformViewId, currentViewId + 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user