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
6491cbf7
Commit
6491cbf7
authored
Feb 28, 2017
by
Chris Bracken
Committed by
GitHub
Feb 28, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure PrimaryScrollController is returned when primary: true (#8440)
Also a small formatting fix.
parent
af03ed1c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
1 deletion
+32
-1
scroll_view.dart
packages/flutter/lib/src/widgets/scroll_view.dart
+2
-1
scroll_view_test.dart
packages/flutter/test/widgets/scroll_view_test.dart
+30
-0
No files found.
packages/flutter/lib/src/widgets/scroll_view.dart
View file @
6491cbf7
...
...
@@ -30,7 +30,8 @@ abstract class ScrollView extends StatelessWidget {
assert
(
primary
!=
null
);
assert
(
controller
==
null
||
!
primary
,
'Primary ScrollViews obtain their ScrollController via inheritance from a PrimaryScrollController widget. '
'You cannot both set primary to true and pass an explicit controller.'
);
'You cannot both set primary to true and pass an explicit controller.'
);
}
final
Axis
scrollDirection
;
...
...
packages/flutter/test/widgets/scroll_view_test.dart
View file @
6491cbf7
...
...
@@ -168,4 +168,34 @@ void main() {
expect
(
controller
.
offset
,
equals
(
550.0
));
expect
(
log
,
isEmpty
);
});
testWidgets
(
'CustomScrollView sets PrimaryScrollController when primary'
,
(
WidgetTester
tester
)
async
{
ScrollController
primaryScrollController
=
new
ScrollController
();
await
tester
.
pumpWidget
(
new
PrimaryScrollController
(
controller:
primaryScrollController
,
child:
new
CustomScrollView
(
primary:
true
),
));
Scrollable
scrollable
=
tester
.
widget
(
find
.
byType
(
Scrollable
));
expect
(
scrollable
.
controller
,
primaryScrollController
);
});
testWidgets
(
'ListView sets PrimaryScrollController when primary'
,
(
WidgetTester
tester
)
async
{
ScrollController
primaryScrollController
=
new
ScrollController
();
await
tester
.
pumpWidget
(
new
PrimaryScrollController
(
controller:
primaryScrollController
,
child:
new
ListView
(
primary:
true
),
));
Scrollable
scrollable
=
tester
.
widget
(
find
.
byType
(
Scrollable
));
expect
(
scrollable
.
controller
,
primaryScrollController
);
});
testWidgets
(
'GridView sets PrimaryScrollController when primary'
,
(
WidgetTester
tester
)
async
{
ScrollController
primaryScrollController
=
new
ScrollController
();
await
tester
.
pumpWidget
(
new
PrimaryScrollController
(
controller:
primaryScrollController
,
child:
new
GridView
.
count
(
primary:
true
,
crossAxisCount:
1
),
));
Scrollable
scrollable
=
tester
.
widget
(
find
.
byType
(
Scrollable
));
expect
(
scrollable
.
controller
,
primaryScrollController
);
});
}
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