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 {
...
@@ -2465,11 +2465,8 @@ class _OffstageElement extends SingleChildRenderObjectElement {
@override
@override
void
debugVisitOnstageChildren
(
ElementVisitor
visitor
)
{
void
debugVisitOnstageChildren
(
ElementVisitor
visitor
)
{
assert
(()
{
if
(!
widget
.
offstage
)
if
(!
widget
.
offstage
)
super
.
debugVisitOnstageChildren
(
visitor
);
super
.
debugVisitOnstageChildren
(
visitor
);
return
true
;
}());
}
}
}
}
...
...
packages/flutter/lib/src/widgets/framework.dart
View file @
f1a8eed0
...
@@ -2666,11 +2666,6 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
...
@@ -2666,11 +2666,6 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
/// The default implementation defers to [visitChildren] and therefore treats
/// The default implementation defers to [visitChildren] and therefore treats
/// the element as onstage.
/// 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:
/// See also:
///
///
/// * [Offstage] widget that hides its children.
/// * [Offstage] widget that hides its children.
...
@@ -2678,9 +2673,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
...
@@ -2678,9 +2673,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
/// * [RenderObject.visitChildrenForSemantics], in contrast to this method,
/// * [RenderObject.visitChildrenForSemantics], in contrast to this method,
/// designed specifically for excluding parts of the UI from the semantics
/// designed specifically for excluding parts of the UI from the semantics
/// tree.
/// tree.
void
debugVisitOnstageChildren
(
ElementVisitor
visitor
)
{
void
debugVisitOnstageChildren
(
ElementVisitor
visitor
)
=>
visitChildren
(
visitor
);
assert
(()
{
visitChildren
(
visitor
);
return
true
;
}());
}
/// Wrapper around [visitChildren] for [BuildContext].
/// Wrapper around [visitChildren] for [BuildContext].
@override
@override
...
...
packages/flutter/lib/src/widgets/overlay.dart
View file @
f1a8eed0
...
@@ -472,11 +472,8 @@ class _TheatreElement extends RenderObjectElement {
...
@@ -472,11 +472,8 @@ class _TheatreElement extends RenderObjectElement {
@override
@override
void
debugVisitOnstageChildren
(
ElementVisitor
visitor
)
{
void
debugVisitOnstageChildren
(
ElementVisitor
visitor
)
{
assert
(()
{
if
(
_onstage
!=
null
)
if
(
_onstage
!=
null
)
visitor
(
_onstage
);
visitor
(
_onstage
);
return
true
;
}());
}
}
@override
@override
...
...
packages/flutter/lib/src/widgets/sliver.dart
View file @
f1a8eed0
...
@@ -1179,24 +1179,21 @@ class SliverMultiBoxAdaptorElement extends RenderObjectElement implements Render
...
@@ -1179,24 +1179,21 @@ class SliverMultiBoxAdaptorElement extends RenderObjectElement implements Render
@override
@override
void
debugVisitOnstageChildren
(
ElementVisitor
visitor
)
{
void
debugVisitOnstageChildren
(
ElementVisitor
visitor
)
{
assert
(()
{
_childElements
.
values
.
where
((
Element
child
)
{
_childElements
.
values
.
where
((
Element
child
)
{
final
SliverMultiBoxAdaptorParentData
parentData
=
child
.
renderObject
.
parentData
;
final
SliverMultiBoxAdaptorParentData
parentData
=
child
.
renderObject
.
parentData
;
double
itemExtent
;
double
itemExtent
;
switch
(
renderObject
.
constraints
.
axis
)
{
switch
(
renderObject
.
constraints
.
axis
)
{
case
Axis
.
horizontal
:
case
Axis
.
horizontal
:
itemExtent
=
child
.
renderObject
.
paintBounds
.
width
;
itemExtent
=
child
.
renderObject
.
paintBounds
.
width
;
break
;
break
;
case
Axis
.
vertical
:
case
Axis
.
vertical
:
itemExtent
=
child
.
renderObject
.
paintBounds
.
height
;
itemExtent
=
child
.
renderObject
.
paintBounds
.
height
;
break
;
break
;
}
}
final
SliverConstraints
constraints
=
renderObject
.
constraints
;
return
parentData
.
layoutOffset
<
renderObject
.
constraints
.
scrollOffset
+
renderObject
.
constraints
.
remainingPaintExtent
&&
return
parentData
.
layoutOffset
<
constraints
.
scrollOffset
+
constraints
.
remainingPaintExtent
parentData
.
layoutOffset
+
itemExtent
>
renderObject
.
constraints
.
scrollOffset
;
&&
parentData
.
layoutOffset
+
itemExtent
>
constraints
.
scrollOffset
;
}).
forEach
(
visitor
);
}).
forEach
(
visitor
);
return
true
;
}());
}
}
}
}
...
...
packages/flutter/lib/src/widgets/viewport.dart
View file @
f1a8eed0
...
@@ -208,13 +208,10 @@ class _ViewportElement extends MultiChildRenderObjectElement {
...
@@ -208,13 +208,10 @@ class _ViewportElement extends MultiChildRenderObjectElement {
@override
@override
void
debugVisitOnstageChildren
(
ElementVisitor
visitor
)
{
void
debugVisitOnstageChildren
(
ElementVisitor
visitor
)
{
assert
(()
{
children
.
where
((
Element
e
)
{
children
.
where
((
Element
e
)
{
final
RenderSliver
renderSliver
=
e
.
renderObject
;
final
RenderSliver
renderSliver
=
e
.
renderObject
;
return
renderSliver
.
geometry
.
visible
;
return
renderSliver
.
geometry
.
visible
;
}).
forEach
(
visitor
);
}).
forEach
(
visitor
);
return
true
;
}());
}
}
}
}
...
...
packages/flutter_test/lib/src/finders.dart
View file @
f1a8eed0
...
@@ -32,7 +32,8 @@ class CommonFinders {
...
@@ -32,7 +32,8 @@ class CommonFinders {
/// expect(find.text('Back'), findsOneWidget);
/// 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
);
Finder
text
(
String
text
,
{
bool
skipOffstage
=
true
})
=>
_TextFinder
(
text
,
skipOffstage:
skipOffstage
);
/// Looks for widgets that contain a [Text] descendant with `text`
/// Looks for widgets that contain a [Text] descendant with `text`
...
@@ -50,7 +51,8 @@ class CommonFinders {
...
@@ -50,7 +51,8 @@ class CommonFinders {
/// tester.tap(find.widgetWithText(Button, 'Update'));
/// 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
})
{
Finder
widgetWithText
(
Type
widgetType
,
String
text
,
{
bool
skipOffstage
=
true
})
{
return
find
.
ancestor
(
return
find
.
ancestor
(
of:
find
.
text
(
text
,
skipOffstage:
skipOffstage
),
of:
find
.
text
(
text
,
skipOffstage:
skipOffstage
),
...
@@ -66,7 +68,8 @@ class CommonFinders {
...
@@ -66,7 +68,8 @@ class CommonFinders {
/// expect(find.byKey(backKey), findsOneWidget);
/// 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
);
Finder
byKey
(
Key
key
,
{
bool
skipOffstage
=
true
})
=>
_KeyFinder
(
key
,
skipOffstage:
skipOffstage
);
/// Finds widgets by searching for widgets with a particular type.
/// Finds widgets by searching for widgets with a particular type.
...
@@ -83,7 +86,8 @@ class CommonFinders {
...
@@ -83,7 +86,8 @@ class CommonFinders {
/// expect(find.byType(IconButton), findsOneWidget);
/// 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
);
Finder
byType
(
Type
type
,
{
bool
skipOffstage
=
true
})
=>
_WidgetTypeFinder
(
type
,
skipOffstage:
skipOffstage
);
/// Finds [Icon] widgets containing icon data equal to the `icon`
/// Finds [Icon] widgets containing icon data equal to the `icon`
...
@@ -95,7 +99,8 @@ class CommonFinders {
...
@@ -95,7 +99,8 @@ class CommonFinders {
/// expect(find.byIcon(Icons.inbox), findsOneWidget);
/// 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
);
Finder
byIcon
(
IconData
icon
,
{
bool
skipOffstage
=
true
})
=>
_WidgetIconFinder
(
icon
,
skipOffstage:
skipOffstage
);
/// Looks for widgets that contain an [Icon] descendant displaying [IconData]
/// Looks for widgets that contain an [Icon] descendant displaying [IconData]
...
@@ -113,7 +118,8 @@ class CommonFinders {
...
@@ -113,7 +118,8 @@ class CommonFinders {
/// tester.tap(find.widgetWithIcon(Button, Icons.arrow_forward));
/// 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
})
{
Finder
widgetWithIcon
(
Type
widgetType
,
IconData
icon
,
{
bool
skipOffstage
=
true
})
{
return
find
.
ancestor
(
return
find
.
ancestor
(
of:
find
.
byIcon
(
icon
),
of:
find
.
byIcon
(
icon
),
...
@@ -135,7 +141,8 @@ class CommonFinders {
...
@@ -135,7 +141,8 @@ class CommonFinders {
/// expect(find.byElementType(SingleChildRenderObjectElement), findsOneWidget);
/// 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
);
Finder
byElementType
(
Type
type
,
{
bool
skipOffstage
=
true
})
=>
_ElementTypeFinder
(
type
,
skipOffstage:
skipOffstage
);
/// Finds widgets whose current widget is the instance given by the
/// Finds widgets whose current widget is the instance given by the
...
@@ -153,7 +160,8 @@ class CommonFinders {
...
@@ -153,7 +160,8 @@ class CommonFinders {
/// tester.tap(find.byWidget(myButton));
/// 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
);
Finder
byWidget
(
Widget
widget
,
{
bool
skipOffstage
=
true
})
=>
_WidgetFinder
(
widget
,
skipOffstage:
skipOffstage
);
/// Finds widgets using a widget [predicate].
/// Finds widgets using a widget [predicate].
...
@@ -172,7 +180,8 @@ class CommonFinders {
...
@@ -172,7 +180,8 @@ class CommonFinders {
/// fails to locate the desired widget. Otherwise, the description prints the
/// fails to locate the desired widget. Otherwise, the description prints the
/// signature of the predicate function.
/// 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
})
{
Finder
byWidgetPredicate
(
WidgetPredicate
predicate
,
{
String
description
,
bool
skipOffstage
=
true
})
{
return
_WidgetPredicateFinder
(
predicate
,
description:
description
,
skipOffstage:
skipOffstage
);
return
_WidgetPredicateFinder
(
predicate
,
description:
description
,
skipOffstage:
skipOffstage
);
}
}
...
@@ -185,7 +194,8 @@ class CommonFinders {
...
@@ -185,7 +194,8 @@ class CommonFinders {
/// expect(find.byTooltip('Back'), findsOneWidget);
/// 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
})
{
Finder
byTooltip
(
String
message
,
{
bool
skipOffstage
=
true
})
{
return
byWidgetPredicate
(
return
byWidgetPredicate
(
(
Widget
widget
)
=>
widget
is
Tooltip
&&
widget
.
message
==
message
,
(
Widget
widget
)
=>
widget
is
Tooltip
&&
widget
.
message
==
message
,
...
@@ -212,7 +222,8 @@ class CommonFinders {
...
@@ -212,7 +222,8 @@ class CommonFinders {
/// fails to locate the desired widget. Otherwise, the description prints the
/// fails to locate the desired widget. Otherwise, the description prints the
/// signature of the predicate function.
/// 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
})
{
Finder
byElementPredicate
(
ElementPredicate
predicate
,
{
String
description
,
bool
skipOffstage
=
true
})
{
return
_ElementPredicateFinder
(
predicate
,
description:
description
,
skipOffstage:
skipOffstage
);
return
_ElementPredicateFinder
(
predicate
,
description:
description
,
skipOffstage:
skipOffstage
);
}
}
...
@@ -231,13 +242,9 @@ class CommonFinders {
...
@@ -231,13 +242,9 @@ class CommonFinders {
/// If the [matchRoot] argument is true then the widget(s) specified by [of]
/// If the [matchRoot] argument is true then the widget(s) specified by [of]
/// will be matched along with the descendants.
/// will be matched along with the descendants.
///
///
/// The `skipOffstage` argument maps to [Finder.skipOffstage] (q.v.).
/// If the [skipOffstage] argument is true (the default), then nodes that are
Finder
descendant
({
/// [Offstage] or that are from inactive [Route]s are skipped.
@required
Finder
of
,
Finder
descendant
({
Finder
of
,
Finder
matching
,
bool
matchRoot
=
false
,
bool
skipOffstage
=
true
})
{
@required
Finder
matching
,
bool
matchRoot
=
false
,
bool
skipOffstage
=
true
,
})
{
return
_DescendantFinder
(
of
,
matching
,
matchRoot:
matchRoot
,
skipOffstage:
skipOffstage
);
return
_DescendantFinder
(
of
,
matching
,
matchRoot:
matchRoot
,
skipOffstage:
skipOffstage
);
}
}
...
@@ -289,25 +296,9 @@ abstract class Finder {
...
@@ -289,25 +296,9 @@ abstract class Finder {
/// Whether this finder skips nodes that are offstage.
/// Whether this finder skips nodes that are offstage.
///
///
/// By default, finders skip nodes that are considered "offstage". The term is
/// If this is true, then the elements are walked using
/// very loosely defined and is only meaningful in a debug environment; it is
/// [Element.debugVisitOnstageChildren]. This skips offstage children of
/// not a term that applies in production. A widget is considered "offstage"
/// [Offstage] widgets, as well as children of inactive [Route]s.
/// 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.
final
bool
skipOffstage
;
final
bool
skipOffstage
;
/// Returns all the [Element]s that will be considered by this finder.
/// 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