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
6f2ca402
Unverified
Commit
6f2ca402
authored
Jun 09, 2021
by
xubaolin
Committed by
GitHub
Jun 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix a ListWheelScrollView childDelegate update bug (#82675)
parent
cc297140
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
6 deletions
+61
-6
list_wheel_scroll_view.dart
packages/flutter/lib/src/widgets/list_wheel_scroll_view.dart
+3
-1
picker_test.dart
packages/flutter/test/cupertino/picker_test.dart
+26
-4
list_wheel_scroll_view_test.dart
...ges/flutter/test/widgets/list_wheel_scroll_view_test.dart
+32
-1
No files found.
packages/flutter/lib/src/widgets/list_wheel_scroll_view.dart
View file @
6f2ca402
...
@@ -843,8 +843,10 @@ class ListWheelElement extends RenderObjectElement implements ListWheelChildMana
...
@@ -843,8 +843,10 @@ class ListWheelElement extends RenderObjectElement implements ListWheelChildMana
final
ListWheelChildDelegate
newDelegate
=
newWidget
.
childDelegate
;
final
ListWheelChildDelegate
newDelegate
=
newWidget
.
childDelegate
;
final
ListWheelChildDelegate
oldDelegate
=
oldWidget
.
childDelegate
;
final
ListWheelChildDelegate
oldDelegate
=
oldWidget
.
childDelegate
;
if
(
newDelegate
!=
oldDelegate
&&
if
(
newDelegate
!=
oldDelegate
&&
(
newDelegate
.
runtimeType
!=
oldDelegate
.
runtimeType
||
newDelegate
.
shouldRebuild
(
oldDelegate
)))
(
newDelegate
.
runtimeType
!=
oldDelegate
.
runtimeType
||
newDelegate
.
shouldRebuild
(
oldDelegate
)))
{
performRebuild
();
performRebuild
();
renderObject
.
markNeedsLayout
();
}
}
}
@override
@override
...
...
packages/flutter/test/cupertino/picker_test.dart
View file @
6f2ca402
...
@@ -48,9 +48,32 @@ void main() {
...
@@ -48,9 +48,32 @@ void main() {
});
});
group
(
'layout'
,
()
{
group
(
'layout'
,
()
{
// Regression test for https://github.com/flutter/flutter/issues/22999
testWidgets
(
'CupertinoPicker.builder test'
,
(
WidgetTester
tester
)
async
{
Widget
buildFrame
(
int
childCount
)
{
return
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
CupertinoPicker
.
builder
(
itemExtent:
50.0
,
onSelectedItemChanged:
(
_
)
{
},
itemBuilder:
(
BuildContext
context
,
int
index
)
{
return
Text
(
'
$index
'
);
},
childCount:
childCount
,
),
);
}
await
tester
.
pumpWidget
(
buildFrame
(
1
));
expect
(
tester
.
renderObject
(
find
.
text
(
'0'
)).
attached
,
true
);
await
tester
.
pumpWidget
(
buildFrame
(
2
));
expect
(
tester
.
renderObject
(
find
.
text
(
'0'
)).
attached
,
true
);
expect
(
tester
.
renderObject
(
find
.
text
(
'1'
)).
attached
,
true
);
});
testWidgets
(
'selected item is in the middle'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'selected item is in the middle'
,
(
WidgetTester
tester
)
async
{
final
FixedExtentScrollController
controller
=
final
FixedExtentScrollController
controller
=
FixedExtentScrollController
(
initialItem:
1
);
FixedExtentScrollController
(
initialItem:
1
);
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
...
@@ -285,8 +308,7 @@ void main() {
...
@@ -285,8 +308,7 @@ void main() {
);
);
testWidgets
(
'a drag in between items settles back'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'a drag in between items settles back'
,
(
WidgetTester
tester
)
async
{
final
FixedExtentScrollController
controller
=
final
FixedExtentScrollController
controller
=
FixedExtentScrollController
(
initialItem:
10
);
FixedExtentScrollController
(
initialItem:
10
);
final
List
<
int
>
selectedItems
=
<
int
>[];
final
List
<
int
>
selectedItems
=
<
int
>[];
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
...
...
packages/flutter/test/widgets/list_wheel_scroll_view_test.dart
View file @
6f2ca402
...
@@ -77,7 +77,6 @@ void main() {
...
@@ -77,7 +77,6 @@ void main() {
expect
(
tester
.
getSize
(
find
.
byType
(
ListWheelScrollView
)),
const
Size
(
800.0
,
600.0
));
expect
(
tester
.
getSize
(
find
.
byType
(
ListWheelScrollView
)),
const
Size
(
800.0
,
600.0
));
});
});
testWidgets
(
'ListWheelScrollView needs positive magnification'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'ListWheelScrollView needs positive magnification'
,
(
WidgetTester
tester
)
async
{
expect
(
expect
(
()
{
()
{
...
@@ -283,6 +282,38 @@ void main() {
...
@@ -283,6 +282,38 @@ void main() {
});
});
group
(
'layout'
,
()
{
group
(
'layout'
,
()
{
// Regression test for https://github.com/flutter/flutter/issues/58144
testWidgets
(
'ListWheelScrollView childDelegate update test'
,
(
WidgetTester
tester
)
async
{
final
FixedExtentScrollController
controller
=
FixedExtentScrollController
();
Widget
buildFrame
(
int
childCount
)
{
return
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
ListWheelScrollView
.
useDelegate
(
controller:
controller
,
itemExtent:
100.0
,
onSelectedItemChanged:
(
_
)
{
},
childDelegate:
ListWheelChildBuilderDelegate
(
childCount:
childCount
,
builder:
(
BuildContext
context
,
int
index
)
{
return
SizedBox
(
width:
400.0
,
height:
100.0
,
child:
Text
(
index
.
toString
()),
);
},
),
),
);
}
await
tester
.
pumpWidget
(
buildFrame
(
1
));
expect
(
tester
.
renderObject
(
find
.
text
(
'0'
)).
attached
,
true
);
await
tester
.
pumpWidget
(
buildFrame
(
2
));
expect
(
tester
.
renderObject
(
find
.
text
(
'0'
)).
attached
,
true
);
expect
(
tester
.
renderObject
(
find
.
text
(
'1'
)).
attached
,
true
);
});
testWidgets
(
"ListWheelScrollView takes parent's size with small children"
,
(
WidgetTester
tester
)
async
{
testWidgets
(
"ListWheelScrollView takes parent's size with small children"
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
...
...
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