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
b32c77a0
Unverified
Commit
b32c77a0
authored
Aug 08, 2018
by
Jonah Williams
Committed by
GitHub
Aug 08, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use scrollPhysics.allowImplicitScrolling to configure scrollable semantics (#20210)
parent
57d8930d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
52 additions
and
5 deletions
+52
-5
semantics.dart
packages/flutter/lib/src/semantics/semantics.dart
+12
-0
scrollable.dart
packages/flutter/lib/src/widgets/scrollable.dart
+29
-3
custom_painter_test.dart
packages/flutter/test/widgets/custom_painter_test.dart
+2
-0
scrollable_semantics_test.dart
packages/flutter/test/widgets/scrollable_semantics_test.dart
+3
-0
semantics_test.dart
packages/flutter/test/widgets/semantics_test.dart
+2
-2
semantics_tester_generateTestSemanticsExpressionForCurrentSemanticsTree_test.dart
...eTestSemanticsExpressionForCurrentSemanticsTree_test.dart
+1
-0
sliver_semantics_test.dart
packages/flutter/test/widgets/sliver_semantics_test.dart
+3
-0
No files found.
packages/flutter/lib/src/semantics/semantics.dart
View file @
b32c77a0
...
...
@@ -3136,6 +3136,18 @@ class SemanticsConfiguration {
_setFlag
(
SemanticsFlag
.
isObscured
,
value
);
}
/// Whether the platform can scroll the semantics node when the user attempts
/// to move focus to an offscreen child.
///
/// For example, a [ListView] widget has implicit scrolling so that users can
/// easily move to the next visible set of children. A [TabBar] widget does
/// not have implicit scrolling, so that users can navigate into the tab
/// body when reaching the end of the tab bar.
bool
get
hasImplicitScrolling
=>
_hasFlag
(
SemanticsFlag
.
hasImplicitScrolling
);
set
hasImplicitScrolling
(
bool
value
)
{
_setFlag
(
SemanticsFlag
.
hasImplicitScrolling
,
value
);
}
/// The currently selected text (or the position of the cursor) within [value]
/// if this node represents a text field.
TextSelection
get
textSelection
=>
_textSelection
;
...
...
packages/flutter/lib/src/widgets/scrollable.dart
View file @
b32c77a0
...
...
@@ -508,6 +508,7 @@ class ScrollableState extends State<Scrollable> with TickerProviderStateMixin
key:
_excludableScrollSemanticsKey
,
child:
result
,
position:
position
,
allowImplicitScrolling:
widget
?.
physics
?.
allowImplicitScrolling
??
false
,
);
}
...
...
@@ -539,25 +540,39 @@ class _ExcludableScrollSemantics extends SingleChildRenderObjectWidget {
const
_ExcludableScrollSemantics
({
Key
key
,
@required
this
.
position
,
@required
this
.
allowImplicitScrolling
,
Widget
child
})
:
assert
(
position
!=
null
),
super
(
key:
key
,
child:
child
);
final
ScrollPosition
position
;
final
bool
allowImplicitScrolling
;
@override
_RenderExcludableScrollSemantics
createRenderObject
(
BuildContext
context
)
=>
new
_RenderExcludableScrollSemantics
(
position:
position
);
_RenderExcludableScrollSemantics
createRenderObject
(
BuildContext
context
)
{
return
new
_RenderExcludableScrollSemantics
(
position:
position
,
allowImplicitScrolling:
allowImplicitScrolling
,
);
}
@override
void
updateRenderObject
(
BuildContext
context
,
_RenderExcludableScrollSemantics
renderObject
)
{
renderObject
.
position
=
position
;
renderObject
..
allowImplicitScrolling
=
allowImplicitScrolling
..
position
=
position
;
}
}
class
_RenderExcludableScrollSemantics
extends
RenderProxyBox
{
_RenderExcludableScrollSemantics
({
@required
ScrollPosition
position
,
@required
bool
allowImplicitScrolling
,
RenderBox
child
,
})
:
_position
=
position
,
assert
(
position
!=
null
),
super
(
child
)
{
})
:
_position
=
position
,
_allowImplicitScrolling
=
allowImplicitScrolling
,
assert
(
position
!=
null
),
super
(
child
)
{
position
.
addListener
(
markNeedsSemanticsUpdate
);
}
...
...
@@ -574,12 +589,23 @@ class _RenderExcludableScrollSemantics extends RenderProxyBox {
markNeedsSemanticsUpdate
();
}
/// Whether this node can be scrolled implicitly.
bool
get
allowImplicitScrolling
=>
_allowImplicitScrolling
;
bool
_allowImplicitScrolling
;
set
allowImplicitScrolling
(
bool
value
)
{
if
(
value
==
_allowImplicitScrolling
)
return
;
_allowImplicitScrolling
=
value
;
markNeedsSemanticsUpdate
();
}
@override
void
describeSemanticsConfiguration
(
SemanticsConfiguration
config
)
{
super
.
describeSemanticsConfiguration
(
config
);
config
.
isSemanticBoundary
=
true
;
if
(
position
.
haveDimensions
)
{
config
..
hasImplicitScrolling
=
allowImplicitScrolling
..
scrollPosition
=
_position
.
pixels
..
scrollExtentMax
=
_position
.
maxScrollExtent
..
scrollExtentMin
=
_position
.
minScrollExtent
;
...
...
packages/flutter/test/widgets/custom_painter_test.dart
View file @
b32c77a0
...
...
@@ -428,6 +428,7 @@ void _defineTests() {
flags
..
remove
(
SemanticsFlag
.
hasImplicitScrolling
)
..
remove
(
SemanticsFlag
.
hasToggledState
)
..
remove
(
SemanticsFlag
.
hasImplicitScrolling
)
..
remove
(
SemanticsFlag
.
isToggled
);
TestSemantics
expectedSemantics
=
new
TestSemantics
.
root
(
children:
<
TestSemantics
>[
...
...
@@ -473,6 +474,7 @@ void _defineTests() {
flags
..
remove
(
SemanticsFlag
.
hasImplicitScrolling
)
..
remove
(
SemanticsFlag
.
hasCheckedState
)
..
remove
(
SemanticsFlag
.
hasImplicitScrolling
)
..
remove
(
SemanticsFlag
.
isChecked
);
expectedSemantics
=
new
TestSemantics
.
root
(
...
...
packages/flutter/test/widgets/scrollable_semantics_test.dart
View file @
b32c77a0
...
...
@@ -342,6 +342,9 @@ void main() {
new
TestSemantics
.
rootChild
(
children:
<
TestSemantics
>[
new
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasImplicitScrolling
,
],
actions:
<
SemanticsAction
>[
SemanticsAction
.
scrollUp
],
children:
<
TestSemantics
>[
new
TestSemantics
(
...
...
packages/flutter/test/widgets/semantics_test.dart
View file @
b32c77a0
...
...
@@ -486,9 +486,9 @@ void main() {
);
final
List
<
SemanticsFlag
>
flags
=
SemanticsFlag
.
values
.
values
.
toList
();
flags
..
remove
(
SemanticsFlag
.
hasImplicitScrolling
)
..
remove
(
SemanticsFlag
.
hasToggledState
)
..
remove
(
SemanticsFlag
.
isToggled
);
..
remove
(
SemanticsFlag
.
isToggled
)
..
remove
(
SemanticsFlag
.
hasImplicitScrolling
);
TestSemantics
expectedSemantics
=
new
TestSemantics
.
root
(
children:
<
TestSemantics
>[
...
...
packages/flutter/test/widgets/semantics_tester_generateTestSemanticsExpressionForCurrentSemanticsTree_test.dart
View file @
b32c77a0
...
...
@@ -116,6 +116,7 @@ void _tests() {
children:
<
TestSemantics
>[
new
TestSemantics
(
id:
6
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasImplicitScrolling
],
children:
<
TestSemantics
>[
new
TestSemantics
(
id:
4
,
...
...
packages/flutter/test/widgets/sliver_semantics_test.dart
View file @
b32c77a0
...
...
@@ -384,6 +384,9 @@ void _tests() {
new
TestSemantics
(
children:
<
TestSemantics
>[
new
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasImplicitScrolling
,
],
children:
<
TestSemantics
>[
new
TestSemantics
(
label:
'Item 4'
,
...
...
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