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
8b122987
Commit
8b122987
authored
Feb 11, 2016
by
Hans Muller
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1768 from abarth/scroll_padding
ScrollableList was applying padding twice
parents
4363cf8a
40151689
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
2 deletions
+43
-2
scrollable_list.dart
packages/flutter/lib/src/widgets/scrollable_list.dart
+2
-2
scrollable_list_vertical_test.dart
...es/flutter/test/widget/scrollable_list_vertical_test.dart
+41
-0
No files found.
packages/flutter/lib/src/widgets/scrollable_list.dart
View file @
8b122987
...
...
@@ -193,8 +193,8 @@ class _VirtualListViewportElement extends VirtualViewportElement<_VirtualListVie
_startOffsetBase
=
0.0
;
_startOffsetLimit
=
double
.
INFINITY
;
}
else
{
int
startItem
=
math
.
max
(
0
,
(
widget
.
startOffset
+
leadingPadding
)
~/
itemExtent
);
int
limitItem
=
math
.
max
(
0
,
((
widget
.
startOffset
+
leadingPadding
+
containerExtent
)
/
itemExtent
).
ceil
());
int
startItem
=
math
.
max
(
0
,
(
widget
.
startOffset
-
leadingPadding
)
~/
itemExtent
);
int
limitItem
=
math
.
max
(
0
,
((
widget
.
startOffset
-
leadingPadding
+
containerExtent
)
/
itemExtent
).
ceil
());
if
(!
widget
.
itemsWrap
&&
length
!=
null
)
{
startItem
=
math
.
min
(
length
,
startItem
);
...
...
packages/flutter/test/widget/scrollable_list_vertical_test.dart
View file @
8b122987
...
...
@@ -65,4 +65,45 @@ void main() {
expect
(
tester
.
findText
(
'5'
),
isNull
);
});
});
test
(
'Drag vertically'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
tester
.
pumpWidget
(
new
ScrollableList
(
itemExtent:
290.0
,
padding:
new
EdgeDims
.
only
(
top:
250.0
),
scrollDirection:
Axis
.
vertical
,
children:
items
.
map
((
int
item
)
{
return
new
Container
(
child:
new
Text
(
'
$item
'
)
);
})
)
);
tester
.
pump
();
// screen is 600px high, and has the following items:
// 250..540 = 0
// 540..830 = 1
expect
(
tester
.
findText
(
'0'
),
isNotNull
);
expect
(
tester
.
findText
(
'1'
),
isNotNull
);
expect
(
tester
.
findText
(
'2'
),
isNull
);
expect
(
tester
.
findText
(
'3'
),
isNull
);
expect
(
tester
.
findText
(
'4'
),
isNull
);
expect
(
tester
.
findText
(
'5'
),
isNull
);
tester
.
scroll
(
tester
.
findText
(
'0'
),
const
Offset
(
0.0
,
-
300.0
));
tester
.
pump
();
// screen is 600px high, and has the following items:
// -50..240 = 0
// 240..530 = 1
// 530..820 = 2
expect
(
tester
.
findText
(
'0'
),
isNotNull
);
expect
(
tester
.
findText
(
'1'
),
isNotNull
);
expect
(
tester
.
findText
(
'2'
),
isNotNull
);
expect
(
tester
.
findText
(
'3'
),
isNull
);
expect
(
tester
.
findText
(
'4'
),
isNull
);
expect
(
tester
.
findText
(
'5'
),
isNull
);
});
});
}
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