Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
f1a8eed0
Unverified
Commit
f1a8eed0
authored
Feb 14, 2019
by
Todd Volkert
Committed by
GitHub
Feb 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Clean up matters related to "offstageness". (#27425)" (#27915)
This reverts commit
1d93e924
.
parent
2cbd050f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
80 deletions
+52
-80
basic.dart
packages/flutter/lib/src/widgets/basic.dart
+2
-5
framework.dart
packages/flutter/lib/src/widgets/framework.dart
+1
-8
overlay.dart
packages/flutter/lib/src/widgets/overlay.dart
+2
-5
sliver.dart
packages/flutter/lib/src/widgets/sliver.dart
+15
-18
viewport.dart
packages/flutter/lib/src/widgets/viewport.dart
+4
-7
finders.dart
packages/flutter_test/lib/src/finders.dart
+28
-37
No files found.
packages/flutter/lib/src/widgets/basic.dart
View file @
f1a8eed0
...
...
@@ -2465,11 +2465,8 @@ class _OffstageElement extends SingleChildRenderObjectElement {
@override
void
debugVisitOnstageChildren
(
ElementVisitor
visitor
)
{
assert
(()
{
if
(!
widget
.
offstage
)
super
.
debugVisitOnstageChildren
(
visitor
);
return
true
;
}());
if
(!
widget
.
offstage
)
super
.
debugVisitOnstageChildren
(
visitor
);
}
}
...
...
packages/flutter/lib/src/widgets/framework.dart
View file @
f1a8eed0
...
...
@@ -2666,11 +2666,6 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
/// The default implementation defers to [visitChildren] and therefore treats
/// the element as onstage.
///
/// This method should only be used in tests and debug code. In production,
/// the vague concept of "onstage" vs "offstage" is meaningless and should not
/// be used to affect widget behavior; this method does nothing in release
/// builds.
///
/// See also:
///
/// * [Offstage] widget that hides its children.
...
...
@@ -2678,9 +2673,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
/// * [RenderObject.visitChildrenForSemantics], in contrast to this method,
/// designed specifically for excluding parts of the UI from the semantics
/// tree.
void
debugVisitOnstageChildren
(
ElementVisitor
visitor
)
{
assert
(()
{
visitChildren
(
visitor
);
return
true
;
}());
}
void
debugVisitOnstageChildren
(
ElementVisitor
visitor
)
=>
visitChildren
(
visitor
);
/// Wrapper around [visitChildren] for [BuildContext].
@override
...
...
packages/flutter/lib/src/widgets/overlay.dart
View file @
f1a8eed0
...
...
@@ -472,11 +472,8 @@ class _TheatreElement extends RenderObjectElement {
@override
void
debugVisitOnstageChildren
(
ElementVisitor
visitor
)
{
assert
(()
{
if
(
_onstage
!=
null
)
visitor
(
_onstage
);
return
true
;
}());
if
(
_onstage
!=
null
)
visitor
(
_onstage
);
}
@override
...
...
packages/flutter/lib/src/widgets/sliver.dart
View file @
f1a8eed0
...
...
@@ -1179,24 +1179,21 @@ class SliverMultiBoxAdaptorElement extends RenderObjectElement implements Render
@override
void
debugVisitOnstageChildren
(
ElementVisitor
visitor
)
{
assert
(()
{
_childElements
.
values
.
where
((
Element
child
)
{
final
SliverMultiBoxAdaptorParentData
parentData
=
child
.
renderObject
.
parentData
;
double
itemExtent
;
switch
(
renderObject
.
constraints
.
axis
)
{
case
Axis
.
horizontal
:
itemExtent
=
child
.
renderObject
.
paintBounds
.
width
;
break
;
case
Axis
.
vertical
:
itemExtent
=
child
.
renderObject
.
paintBounds
.
height
;
break
;
}
final
SliverConstraints
constraints
=
renderObject
.
constraints
;
return
parentData
.
layoutOffset
<
constraints
.
scrollOffset
+
constraints
.
remainingPaintExtent
&&
parentData
.
layoutOffset
+
itemExtent
>
constraints
.
scrollOffset
;
}).
forEach
(
visitor
);
return
true
;
}());
_childElements
.
values
.
where
((
Element
child
)
{
final
SliverMultiBoxAdaptorParentData
parentData
=
child
.
renderObject
.
parentData
;
double
itemExtent
;
switch
(
renderObject
.
constraints
.
axis
)
{
case
Axis
.
horizontal
:
itemExtent
=
child
.
renderObject
.
paintBounds
.
width
;
break
;
case
Axis
.
vertical
:
itemExtent
=
child
.
renderObject
.
paintBounds
.
height
;
break
;
}
return
parentData
.
layoutOffset
<
renderObject
.
constraints
.
scrollOffset
+
renderObject
.
constraints
.
remainingPaintExtent
&&
parentData
.
layoutOffset
+
itemExtent
>
renderObject
.
constraints
.
scrollOffset
;
}).
forEach
(
visitor
);
}
}
...
...
packages/flutter/lib/src/widgets/viewport.dart
View file @
f1a8eed0
...
...
@@ -208,13 +208,10 @@ class _ViewportElement extends MultiChildRenderObjectElement {
@override
void
debugVisitOnstageChildren
(
ElementVisitor
visitor
)
{
assert
(()
{
children
.
where
((
Element
e
)
{
final
RenderSliver
renderSliver
=
e
.
renderObject
;
return
renderSliver
.
geometry
.
visible
;
}).
forEach
(
visitor
);
return
true
;
}());
children
.
where
((
Element
e
)
{
final
RenderSliver
renderSliver
=
e
.
renderObject
;
return
renderSliver
.
geometry
.
visible
;
}).
forEach
(
visitor
);
}
}
...
...
packages/flutter_test/lib/src/finders.dart
View file @
f1a8eed0
...
...
@@ -32,7 +32,8 @@ class CommonFinders {
/// expect(find.text('Back'), findsOneWidget);
/// ```
///
/// The `skipOffstage` argument maps to [Finder.skipOffstage] (q.v.).
/// If the `skipOffstage` argument is true (the default), then this skips
/// nodes that are [Offstage] or that are from inactive [Route]s.
Finder
text
(
String
text
,
{
bool
skipOffstage
=
true
})
=>
_TextFinder
(
text
,
skipOffstage:
skipOffstage
);
/// Looks for widgets that contain a [Text] descendant with `text`
...
...
@@ -50,7 +51,8 @@ class CommonFinders {
/// tester.tap(find.widgetWithText(Button, 'Update'));
/// ```
///
/// The `skipOffstage` argument maps to [Finder.skipOffstage] (q.v.).
/// If the `skipOffstage` argument is true (the default), then this skips
/// nodes that are [Offstage] or that are from inactive [Route]s.
Finder
widgetWithText
(
Type
widgetType
,
String
text
,
{
bool
skipOffstage
=
true
})
{
return
find
.
ancestor
(
of:
find
.
text
(
text
,
skipOffstage:
skipOffstage
),
...
...
@@ -66,7 +68,8 @@ class CommonFinders {
/// expect(find.byKey(backKey), findsOneWidget);
/// ```
///
/// The `skipOffstage` argument maps to [Finder.skipOffstage] (q.v.).
/// If the `skipOffstage` argument is true (the default), then this skips
/// nodes that are [Offstage] or that are from inactive [Route]s.
Finder
byKey
(
Key
key
,
{
bool
skipOffstage
=
true
})
=>
_KeyFinder
(
key
,
skipOffstage:
skipOffstage
);
/// Finds widgets by searching for widgets with a particular type.
...
...
@@ -83,7 +86,8 @@ class CommonFinders {
/// expect(find.byType(IconButton), findsOneWidget);
/// ```
///
/// The `skipOffstage` argument maps to [Finder.skipOffstage] (q.v.).
/// If the `skipOffstage` argument is true (the default), then this skips
/// nodes that are [Offstage] or that are from inactive [Route]s.
Finder
byType
(
Type
type
,
{
bool
skipOffstage
=
true
})
=>
_WidgetTypeFinder
(
type
,
skipOffstage:
skipOffstage
);
/// Finds [Icon] widgets containing icon data equal to the `icon`
...
...
@@ -95,7 +99,8 @@ class CommonFinders {
/// expect(find.byIcon(Icons.inbox), findsOneWidget);
/// ```
///
/// The `skipOffstage` argument maps to [Finder.skipOffstage] (q.v.).
/// If the `skipOffstage` argument is true (the default), then this skips
/// nodes that are [Offstage] or that are from inactive [Route]s.
Finder
byIcon
(
IconData
icon
,
{
bool
skipOffstage
=
true
})
=>
_WidgetIconFinder
(
icon
,
skipOffstage:
skipOffstage
);
/// Looks for widgets that contain an [Icon] descendant displaying [IconData]
...
...
@@ -113,7 +118,8 @@ class CommonFinders {
/// tester.tap(find.widgetWithIcon(Button, Icons.arrow_forward));
/// ```
///
/// The `skipOffstage` argument maps to [Finder.skipOffstage] (q.v.).
/// If the `skipOffstage` argument is true (the default), then this skips
/// nodes that are [Offstage] or that are from inactive [Route]s.
Finder
widgetWithIcon
(
Type
widgetType
,
IconData
icon
,
{
bool
skipOffstage
=
true
})
{
return
find
.
ancestor
(
of:
find
.
byIcon
(
icon
),
...
...
@@ -135,7 +141,8 @@ class CommonFinders {
/// expect(find.byElementType(SingleChildRenderObjectElement), findsOneWidget);
/// ```
///
/// The `skipOffstage` argument maps to [Finder.skipOffstage] (q.v.).
/// If the `skipOffstage` argument is true (the default), then this skips
/// nodes that are [Offstage] or that are from inactive [Route]s.
Finder
byElementType
(
Type
type
,
{
bool
skipOffstage
=
true
})
=>
_ElementTypeFinder
(
type
,
skipOffstage:
skipOffstage
);
/// Finds widgets whose current widget is the instance given by the
...
...
@@ -153,7 +160,8 @@ class CommonFinders {
/// tester.tap(find.byWidget(myButton));
/// ```
///
/// The `skipOffstage` argument maps to [Finder.skipOffstage] (q.v.).
/// If the `skipOffstage` argument is true (the default), then this skips
/// nodes that are [Offstage] or that are from inactive [Route]s.
Finder
byWidget
(
Widget
widget
,
{
bool
skipOffstage
=
true
})
=>
_WidgetFinder
(
widget
,
skipOffstage:
skipOffstage
);
/// Finds widgets using a widget [predicate].
...
...
@@ -172,7 +180,8 @@ class CommonFinders {
/// fails to locate the desired widget. Otherwise, the description prints the
/// signature of the predicate function.
///
/// The `skipOffstage` argument maps to [Finder.skipOffstage] (q.v.).
/// If the `skipOffstage` argument is true (the default), then this skips
/// nodes that are [Offstage] or that are from inactive [Route]s.
Finder
byWidgetPredicate
(
WidgetPredicate
predicate
,
{
String
description
,
bool
skipOffstage
=
true
})
{
return
_WidgetPredicateFinder
(
predicate
,
description:
description
,
skipOffstage:
skipOffstage
);
}
...
...
@@ -185,7 +194,8 @@ class CommonFinders {
/// expect(find.byTooltip('Back'), findsOneWidget);
/// ```
///
/// The `skipOffstage` argument maps to [Finder.skipOffstage] (q.v.).
/// If the `skipOffstage` argument is true (the default), then this skips
/// nodes that are [Offstage] or that are from inactive [Route]s.
Finder
byTooltip
(
String
message
,
{
bool
skipOffstage
=
true
})
{
return
byWidgetPredicate
(
(
Widget
widget
)
=>
widget
is
Tooltip
&&
widget
.
message
==
message
,
...
...
@@ -212,7 +222,8 @@ class CommonFinders {
/// fails to locate the desired widget. Otherwise, the description prints the
/// signature of the predicate function.
///
/// The `skipOffstage` argument maps to [Finder.skipOffstage] (q.v.).
/// If the `skipOffstage` argument is true (the default), then this skips
/// nodes that are [Offstage] or that are from inactive [Route]s.
Finder
byElementPredicate
(
ElementPredicate
predicate
,
{
String
description
,
bool
skipOffstage
=
true
})
{
return
_ElementPredicateFinder
(
predicate
,
description:
description
,
skipOffstage:
skipOffstage
);
}
...
...
@@ -231,13 +242,9 @@ class CommonFinders {
/// If the [matchRoot] argument is true then the widget(s) specified by [of]
/// will be matched along with the descendants.
///
/// The `skipOffstage` argument maps to [Finder.skipOffstage] (q.v.).
Finder
descendant
({
@required
Finder
of
,
@required
Finder
matching
,
bool
matchRoot
=
false
,
bool
skipOffstage
=
true
,
})
{
/// If the [skipOffstage] argument is true (the default), then nodes that are
/// [Offstage] or that are from inactive [Route]s are skipped.
Finder
descendant
({
Finder
of
,
Finder
matching
,
bool
matchRoot
=
false
,
bool
skipOffstage
=
true
})
{
return
_DescendantFinder
(
of
,
matching
,
matchRoot:
matchRoot
,
skipOffstage:
skipOffstage
);
}
...
...
@@ -289,25 +296,9 @@ abstract class Finder {
/// Whether this finder skips nodes that are offstage.
///
/// By default, finders skip nodes that are considered "offstage". The term is
/// very loosely defined and is only meaningful in a debug environment; it is
/// not a term that applies in production. A widget is considered "offstage"
/// if it is "not really visible".
///
/// If [skipOffstage] is true, then the elements are walked using
/// [Element.debugVisitOnstageChildren]. This skips hidden children of
/// [Offstage] widgets, children of inactive [Route]s, some non-visible
/// children in viewports, and other nodes that are generally considered to be
/// "not there" when considering what the user can see.
///
/// The [skipOffstage] argument can be set to `false` to match _all_ nodes
/// regardless of this status. This is useful to test for the presence of
/// widgets being kept alive using [KeepAlive], for instance.
///
/// See also:
///
/// * [Element.debugVisitOnstageChildren], which can be overriden to
/// decide whether a child is onstage or offstage.
/// If this is true, then the elements are walked using
/// [Element.debugVisitOnstageChildren]. This skips offstage children of
/// [Offstage] widgets, as well as children of inactive [Route]s.
final
bool
skipOffstage
;
/// Returns all the [Element]s that will be considered by this finder.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment