mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Pass correct physics instance to Scrollable semantics (#24416)
This commit is contained in:
parent
c793d43ee0
commit
9d81c67a3f
@ -527,7 +527,7 @@ class ScrollableState extends State<Scrollable> with TickerProviderStateMixin
|
||||
key: _scrollSemanticsKey,
|
||||
child: result,
|
||||
position: position,
|
||||
allowImplicitScrolling: widget?.physics?.allowImplicitScrolling ?? false,
|
||||
allowImplicitScrolling: widget?.physics?.allowImplicitScrolling ?? _physics.allowImplicitScrolling,
|
||||
semanticChildCount: widget.semanticChildCount,
|
||||
);
|
||||
}
|
||||
|
@ -873,6 +873,9 @@ void main() {
|
||||
label: 'Alert',
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasImplicitScrolling,
|
||||
],
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
label: 'The title',
|
||||
@ -883,6 +886,9 @@ void main() {
|
||||
],
|
||||
),
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasImplicitScrolling,
|
||||
],
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[
|
||||
|
@ -92,12 +92,18 @@ void main() {
|
||||
label: 'Alert',
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasImplicitScrolling,
|
||||
],
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(label: 'The Title'),
|
||||
TestSemantics(label: 'Content'),
|
||||
],
|
||||
),
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasImplicitScrolling,
|
||||
],
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isButton],
|
||||
|
@ -788,6 +788,9 @@ void main() {
|
||||
TestSemantics(
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasImplicitScrolling,
|
||||
],
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
label: 'one',
|
||||
|
@ -509,6 +509,9 @@ void main() {
|
||||
textDirection: TextDirection.ltr,
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasImplicitScrolling,
|
||||
],
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
actions: <SemanticsAction>[SemanticsAction.tap],
|
||||
|
@ -1465,6 +1465,7 @@ void main() {
|
||||
TestSemantics(
|
||||
id: 3,
|
||||
rect: TestSemantics.fullScreen,
|
||||
flags: <SemanticsFlag>[SemanticsFlag.hasImplicitScrolling],
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
id: 4,
|
||||
@ -1728,6 +1729,7 @@ void main() {
|
||||
TestSemantics(
|
||||
id: 3,
|
||||
rect: TestSemantics.fullScreen,
|
||||
flags: <SemanticsFlag>[SemanticsFlag.hasImplicitScrolling],
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
id: 4,
|
||||
|
@ -1990,6 +1990,7 @@ void main() {
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
id: 8,
|
||||
flags: <SemanticsFlag>[SemanticsFlag.hasImplicitScrolling],
|
||||
actions: <SemanticsAction>[SemanticsAction.scrollLeft],
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
@ -2050,6 +2051,7 @@ void main() {
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
id: 8,
|
||||
flags: <SemanticsFlag>[SemanticsFlag.hasImplicitScrolling],
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
id: 4,
|
||||
|
@ -500,4 +500,37 @@ void main() {
|
||||
|
||||
expect(find.byType(Viewport), isNot(paints..clipRect()));
|
||||
});
|
||||
|
||||
testWidgets('ListView.horizontal has implicit scrolling by default', (WidgetTester tester) async {
|
||||
final SemanticsHandle handle = tester.ensureSemantics();
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: Center(
|
||||
child: Container(
|
||||
height: 200.0,
|
||||
child: ListView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemExtent: 100.0,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
height: 100.0,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
expect(tester.getSemantics(find.byType(Scrollable)), matchesSemantics(
|
||||
children: <Matcher>[
|
||||
matchesSemantics(
|
||||
children: <Matcher>[
|
||||
matchesSemantics(hasImplicitScrolling: true)
|
||||
],
|
||||
),
|
||||
],
|
||||
));
|
||||
handle.dispose();
|
||||
});
|
||||
}
|
||||
|
@ -65,6 +65,9 @@ void main() {
|
||||
TestSemantics(
|
||||
scrollIndex: 15,
|
||||
scrollChildren: 30,
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasImplicitScrolling,
|
||||
],
|
||||
actions: <SemanticsAction>[
|
||||
SemanticsAction.scrollUp,
|
||||
SemanticsAction.scrollDown,
|
||||
@ -234,6 +237,9 @@ void main() {
|
||||
TestSemantics(
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasImplicitScrolling,
|
||||
],
|
||||
actions: <SemanticsAction>[
|
||||
SemanticsAction.scrollUp,
|
||||
SemanticsAction.scrollDown,
|
||||
@ -360,8 +366,13 @@ void main() {
|
||||
TestSemantics(
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
actions: <SemanticsAction>[SemanticsAction.scrollUp,
|
||||
SemanticsAction.scrollDown],
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasImplicitScrolling,
|
||||
],
|
||||
actions: <SemanticsAction>[
|
||||
SemanticsAction.scrollUp,
|
||||
SemanticsAction.scrollDown,
|
||||
],
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isHidden],
|
||||
@ -492,6 +503,9 @@ void main() {
|
||||
TestSemantics(
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasImplicitScrolling,
|
||||
],
|
||||
actions: <SemanticsAction>[
|
||||
SemanticsAction.scrollUp,
|
||||
SemanticsAction.scrollDown,
|
||||
@ -624,6 +638,9 @@ void main() {
|
||||
textDirection: TextDirection.ltr,
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasImplicitScrolling,
|
||||
],
|
||||
actions: <SemanticsAction>[
|
||||
SemanticsAction.scrollUp,
|
||||
SemanticsAction.scrollDown,
|
||||
@ -760,6 +777,9 @@ void main() {
|
||||
TestSemantics(
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasImplicitScrolling,
|
||||
],
|
||||
actions: <SemanticsAction>[
|
||||
SemanticsAction.scrollUp,
|
||||
SemanticsAction.scrollDown,
|
||||
|
@ -201,6 +201,9 @@ void main() {
|
||||
TestSemantics(
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasImplicitScrolling,
|
||||
],
|
||||
actions: <SemanticsAction>[
|
||||
SemanticsAction.scrollUp,
|
||||
],
|
||||
@ -244,6 +247,9 @@ void main() {
|
||||
TestSemantics(
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasImplicitScrolling,
|
||||
],
|
||||
actions: <SemanticsAction>[
|
||||
SemanticsAction.scrollUp,
|
||||
SemanticsAction.scrollDown,
|
||||
@ -303,6 +309,9 @@ void main() {
|
||||
TestSemantics(
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasImplicitScrolling,
|
||||
],
|
||||
actions: <SemanticsAction>[
|
||||
SemanticsAction.scrollDown,
|
||||
],
|
||||
|
@ -79,6 +79,9 @@ void _tests() {
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
id: 9,
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasImplicitScrolling,
|
||||
],
|
||||
actions: <SemanticsAction>[SemanticsAction.scrollUp],
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
@ -222,6 +225,9 @@ void _tests() {
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
id: 9,
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasImplicitScrolling,
|
||||
],
|
||||
actions: <SemanticsAction>[
|
||||
SemanticsAction.scrollUp,
|
||||
SemanticsAction.scrollDown,
|
||||
@ -327,6 +333,9 @@ void _tests() {
|
||||
TestSemantics(
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasImplicitScrolling,
|
||||
],
|
||||
actions: <SemanticsAction>[
|
||||
SemanticsAction.scrollUp,
|
||||
SemanticsAction.scrollDown,
|
||||
@ -715,6 +724,9 @@ void _tests() {
|
||||
TestSemantics(
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasImplicitScrolling,
|
||||
],
|
||||
actions: <SemanticsAction>[
|
||||
SemanticsAction.scrollUp,
|
||||
SemanticsAction.scrollDown,
|
||||
@ -825,8 +837,13 @@ void _tests() {
|
||||
TestSemantics(
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
actions: <SemanticsAction>[SemanticsAction.scrollUp,
|
||||
SemanticsAction.scrollDown],
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasImplicitScrolling,
|
||||
],
|
||||
actions: <SemanticsAction>[
|
||||
SemanticsAction.scrollUp,
|
||||
SemanticsAction.scrollDown,
|
||||
],
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isHidden],
|
||||
@ -1031,6 +1048,9 @@ void _tests() {
|
||||
TestSemantics(
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasImplicitScrolling,
|
||||
],
|
||||
actions: <SemanticsAction>[
|
||||
SemanticsAction.scrollUp,
|
||||
SemanticsAction.scrollDown,
|
||||
|
Loading…
Reference in New Issue
Block a user