mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

Adds a HomogeneousViewport class that works like MixedViewport but handles only children that have all the same height. Converts ScrollableWidgetList to use that, so that we don't waste a frame looking at the size of the contents each time we change size. This allows a number of seemingly pointless double-pumps in the tests to be removed. Other changes that were necessary to support the above: - RenderBlock now supports minExtent (think 'min-height' in CSS) - RenderBlock now supports itemExtent (forces the height of each child to be the same, so that the itemExtent passed to the fixed- height scrollables are all authoritative instead of a source of bugs when they don't match) - RenderBlockViewport now supports horizontal scrolling - improved the style of the isInfinite assert in box.dart - fixed the position of a comment in mixed_viewport.dart - added a test - made the logic for how many items to show be more precise
37 lines
939 B
Dart
37 lines
939 B
Dart
import 'package:sky/widgets.dart';
|
|
import 'package:test/test.dart';
|
|
|
|
import 'widget_tester.dart';
|
|
|
|
void main() {
|
|
test('Can select a day', () {
|
|
WidgetTester tester = new WidgetTester();
|
|
|
|
DateTime currentValue;
|
|
|
|
Widget builder() {
|
|
return new Block([
|
|
new DatePicker(
|
|
selectedDate: new DateTime.utc(2015, 6, 9, 7, 12),
|
|
firstDate: new DateTime.utc(2013),
|
|
lastDate: new DateTime.utc(2018),
|
|
onChanged: (DateTime dateTime) {
|
|
currentValue = dateTime;
|
|
}
|
|
)
|
|
]);
|
|
}
|
|
|
|
tester.pumpFrame(builder);
|
|
|
|
expect(currentValue, isNull);
|
|
tester.tap(tester.findText('2015'));
|
|
tester.pumpFrame(builder);
|
|
tester.tap(tester.findText('2014'));
|
|
tester.pumpFrame(builder);
|
|
expect(currentValue, equals(new DateTime(2014, 6, 9)));
|
|
tester.tap(tester.findText('30'));
|
|
expect(currentValue, equals(new DateTime(2013, 1, 30)));
|
|
});
|
|
}
|