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
38dae1bf
Unverified
Commit
38dae1bf
authored
Feb 18, 2022
by
Kate Lovett
Committed by
GitHub
Feb 18, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update stretching overscroll clip behavior (#97678)
parent
0eedf420
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
4 deletions
+64
-4
overscroll_indicator.dart
packages/flutter/lib/src/widgets/overscroll_indicator.dart
+5
-4
overscroll_stretch_indicator_test.dart
...utter/test/widgets/overscroll_stretch_indicator_test.dart
+59
-0
No files found.
packages/flutter/lib/src/widgets/overscroll_indicator.dart
View file @
38dae1bf
...
...
@@ -785,10 +785,11 @@ class _StretchingOverscrollIndicatorState extends State<StretchingOverscrollIndi
// Only clip if the viewport dimension is smaller than that of the
// screen size in the main axis. If the viewport takes up the whole
// screen, overflow from transforming the viewport is irrelevant.
if
(
stretch
!=
0.0
&&
viewportDimension
!=
mainAxisSize
)
{
return
ClipRect
(
child:
transform
);
}
return
transform
;
return
ClipRect
(
clipBehavior:
stretch
!=
0.0
&&
viewportDimension
!=
mainAxisSize
?
Clip
.
hardEdge
:
Clip
.
none
,
child:
transform
,
);
},
),
);
...
...
packages/flutter/test/widgets/overscroll_stretch_indicator_test.dart
View file @
38dae1bf
...
...
@@ -6,6 +6,7 @@
// machines.
@Tags
(<
String
>[
'reduced-test-set'
])
import
'package:flutter/rendering.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
...
@@ -392,4 +393,62 @@ void main() {
await
gesture
.
up
();
await
tester
.
pumpAndSettle
();
});
testWidgets
(
'Clip behavior is updated as needed'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/97867
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
MediaQuery
(
data:
const
MediaQueryData
(
size:
Size
(
800.0
,
600.0
)),
child:
ScrollConfiguration
(
behavior:
const
ScrollBehavior
().
copyWith
(
overscroll:
false
),
child:
Column
(
children:
<
Widget
>[
StretchingOverscrollIndicator
(
axisDirection:
AxisDirection
.
down
,
child:
SizedBox
(
height:
300
,
child:
ListView
.
builder
(
itemCount:
20
,
itemBuilder:
(
BuildContext
context
,
int
index
){
return
Padding
(
padding:
const
EdgeInsets
.
all
(
10.0
),
child:
Text
(
'Index
$index
'
),
);
},
),
),
),
Opacity
(
opacity:
0.5
,
child:
Container
(
color:
const
Color
(
0xD0FF0000
),
height:
100
,
),
)
],
)
),
)
));
expect
(
find
.
text
(
'Index 1'
),
findsOneWidget
);
expect
(
tester
.
getCenter
(
find
.
text
(
'Index 1'
)).
dy
,
51.0
);
RenderClipRect
renderClip
=
tester
.
allRenderObjects
.
whereType
<
RenderClipRect
>().
first
;
// Currently not clipping
expect
(
renderClip
.
clipBehavior
,
equals
(
Clip
.
none
));
final
TestGesture
gesture
=
await
tester
.
startGesture
(
tester
.
getCenter
(
find
.
text
(
'Index 1'
)));
// Overscroll the start.
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
200.0
));
await
tester
.
pumpAndSettle
();
expect
(
find
.
text
(
'Index 1'
),
findsOneWidget
);
expect
(
tester
.
getCenter
(
find
.
text
(
'Index 1'
)).
dy
,
greaterThan
(
0
));
renderClip
=
tester
.
allRenderObjects
.
whereType
<
RenderClipRect
>().
first
;
// Now clipping
expect
(
renderClip
.
clipBehavior
,
equals
(
Clip
.
hardEdge
));
await
gesture
.
up
();
await
tester
.
pumpAndSettle
();
});
}
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