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
9bd6ff33
Unverified
Commit
9bd6ff33
authored
Oct 07, 2022
by
xubaolin
Committed by
GitHub
Oct 07, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix a CupertinoDatePicker bug (#112697)
parent
529184bc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
3 deletions
+45
-3
list_wheel_viewport.dart
packages/flutter/lib/src/rendering/list_wheel_viewport.dart
+7
-3
list_wheel_scroll_view_test.dart
...ges/flutter/test/widgets/list_wheel_scroll_view_test.dart
+38
-0
No files found.
packages/flutter/lib/src/rendering/list_wheel_viewport.dart
View file @
9bd6ff33
...
...
@@ -681,10 +681,14 @@ class RenderListWheelViewport
/// by [childManager].
@override
void
performLayout
()
{
// Apply the dimensions first in case it changes the scroll offset which
// determines what should be shown.
offset
.
applyViewportDimension
(
_viewportExtent
);
offset
.
applyContentDimensions
(
_minEstimatedScrollExtent
,
_maxEstimatedScrollExtent
);
// Apply the content dimensions first if it has exact dimensions in case it
// changes the scroll offset which determines what should be shown. Such as
// if the child count decrease, we should correct the pixels first, otherwise,
// it may be shown blank null children.
if
(
childManager
.
childCount
!=
null
)
{
offset
.
applyContentDimensions
(
_minEstimatedScrollExtent
,
_maxEstimatedScrollExtent
);
}
// The height, in pixel, that children will be visible and might be laid out
// and painted.
...
...
packages/flutter/test/widgets/list_wheel_scroll_view_test.dart
View file @
9bd6ff33
...
...
@@ -288,6 +288,44 @@ void main() {
});
group
(
'layout'
,
()
{
testWidgets
(
'Flings with high velocity should not break the children lower and upper limits'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/112526
final
FixedExtentScrollController
controller
=
FixedExtentScrollController
();
Widget
buildFrame
()
{
return
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
ListWheelScrollView
.
useDelegate
(
physics:
const
FixedExtentScrollPhysics
(),
controller:
controller
,
itemExtent:
400.0
,
onSelectedItemChanged:
(
_
)
{
},
childDelegate:
ListWheelChildBuilderDelegate
(
builder:
(
BuildContext
context
,
int
index
)
{
if
(
index
<
0
||
index
>
5
)
{
return
null
;
}
return
SizedBox
(
width:
400.0
,
height:
400.0
,
child:
Text
(
index
.
toString
()),
);
},
),
),
);
}
await
tester
.
pumpWidget
(
buildFrame
());
expect
(
tester
.
renderObject
(
find
.
text
(
'0'
)).
attached
,
true
);
expect
(
tester
.
renderObject
(
find
.
text
(
'1'
)).
attached
,
true
);
expect
(
find
.
text
(
'2'
),
findsNothing
);
expect
(
controller
.
selectedItem
,
0
);
// Flings with high velocity and stop at the child boundary.
await
tester
.
fling
(
find
.
byType
(
ListWheelScrollView
),
const
Offset
(
0.0
,
40000.0
),
8000.0
);
expect
(
controller
.
selectedItem
,
0
);
},
variant:
TargetPlatformVariant
(
TargetPlatform
.
values
.
toSet
()));
// Regression test for https://github.com/flutter/flutter/issues/90953
testWidgets
(
'ListWheelScrollView childDelegate update test 2'
,
(
WidgetTester
tester
)
async
{
final
FixedExtentScrollController
controller
=
FixedExtentScrollController
(
initialItem:
2
);
...
...
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