Restore Flutter gallery license page scrolling (#5934)

This commit is contained in:
Hans Muller 2016-09-20 15:13:50 -07:00 committed by GitHub
parent 278711d5b1
commit aa9aaf2eb7
3 changed files with 40 additions and 1 deletions

View file

@ -20,6 +20,11 @@ the [Flutter Setup](https://flutter.io/setup/) guide.
The `flutter run --release` command both builds and installs the Flutter app.
## Prerelease checklist
* Verify that the About box's license page scrolls and reveals its long
long stream of license texts.
## Icon
Android launcher icons were generated using Android Asset Studio:

View file

@ -272,6 +272,7 @@ class LazyBlock extends StatelessWidget {
minScrollOffset: minScrollOffset,
scrollOffset: state.scrollOffset
));
state.updateGestureDetector();
},
delegate: delegate
);

View file

@ -53,7 +53,7 @@ void main() {
});
testWidgets('Underflowing LazyBlock contentExtent should track additional children ', (WidgetTester tester) async {
testWidgets('Underflowing LazyBlock contentExtent should track additional children', (WidgetTester tester) async {
await tester.pumpWidget(new LazyBlock(
delegate: new LazyBlockChildren(
children: <Widget>[
@ -155,4 +155,37 @@ void main() {
expect(scrollBehavior.contentExtent, equals(700.0));
});
testWidgets('Overflowing LazyBlock should become scrollable', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/5920
// When a LazyBlock's viewport hasn't overflowed, scrolling is disabled.
// When children are added that cause it to overflow, scrolling should
// be enabled.
await tester.pumpWidget(new LazyBlock(
delegate: new LazyBlockChildren(
children: <Widget>[
new SizedBox(height: 100.0, child: new Text('100')),
]
)
));
StatefulElement statefulElement = tester.element(find.byType(Scrollable));
ScrollableState scrollable = statefulElement.state;
OverscrollWhenScrollableBehavior scrollBehavior = scrollable.scrollBehavior;
expect(scrollBehavior.isScrollable, isFalse);
await tester.pumpWidget(new LazyBlock(
delegate: new LazyBlockChildren(
children: <Widget>[
new SizedBox(height: 100.0, child: new Text('100')),
new SizedBox(height: 200.0, child: new Text('200')),
new SizedBox(height: 400.0, child: new Text('400')),
]
)
));
expect(scrollBehavior.isScrollable, isTrue);
});
}