Change Block children to be a named parameter
This commit is contained in:
@@ -107,7 +107,7 @@ class Dialog extends StatelessComponent {
|
||||
color: _getColor(context),
|
||||
type: MaterialType.card,
|
||||
child: new IntrinsicWidth(
|
||||
child: new Block(dialogBody)
|
||||
child: new Block(children: dialogBody)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -125,7 +125,7 @@ class _DropDownMenu<T> extends StatusTransitionComponent {
|
||||
|
||||
Widget child = new Material(
|
||||
type: MaterialType.transparency,
|
||||
child: new Block(children)
|
||||
child: new Block(children: children)
|
||||
);
|
||||
return new FadeTransition(
|
||||
opacity: opacity,
|
||||
|
||||
@@ -86,7 +86,7 @@ class _PopupMenu<T> extends StatelessComponent {
|
||||
child: new IntrinsicWidth(
|
||||
stepWidth: _kMenuWidthStep,
|
||||
child: new Block(
|
||||
children,
|
||||
children: children,
|
||||
padding: const EdgeDims.symmetric(
|
||||
vertical: _kMenuVerticalPadding
|
||||
)
|
||||
|
||||
@@ -155,5 +155,5 @@ class TwoLevelList extends StatelessComponent {
|
||||
final List<Widget> items;
|
||||
final MaterialListType type;
|
||||
|
||||
Widget build(BuildContext context) => new Block(items);
|
||||
Widget build(BuildContext context) => new Block(children: items);
|
||||
}
|
||||
|
||||
@@ -436,8 +436,9 @@ class ScrollableViewportState extends ScrollableState<ScrollableViewport> {
|
||||
/// fixed number of children that you wish to arrange in a block layout and that
|
||||
/// might exceed the height of its container (and therefore need to scroll).
|
||||
class Block extends StatelessComponent {
|
||||
Block(this.children, {
|
||||
Block({
|
||||
Key key,
|
||||
this.children,
|
||||
this.padding,
|
||||
this.initialScrollOffset,
|
||||
this.scrollDirection: Axis.vertical,
|
||||
|
||||
@@ -12,13 +12,15 @@ void main() {
|
||||
test('Cannot scroll a non-overflowing block', () {
|
||||
testWidgets((WidgetTester tester) {
|
||||
tester.pumpWidget(
|
||||
new Block(<Widget>[
|
||||
new Container(
|
||||
height: 200.0, // less than 600, the height of the test area
|
||||
child: new Text('Hello')
|
||||
)
|
||||
],
|
||||
key: blockKey)
|
||||
new Block(
|
||||
key: blockKey,
|
||||
children: <Widget>[
|
||||
new Container(
|
||||
height: 200.0, // less than 600, the height of the test area
|
||||
child: new Text('Hello')
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
tester.pump(); // for SizeObservers
|
||||
|
||||
@@ -39,13 +41,15 @@ void main() {
|
||||
test('Can scroll an overflowing block', () {
|
||||
testWidgets((WidgetTester tester) {
|
||||
tester.pumpWidget(
|
||||
new Block(<Widget>[
|
||||
new Container(
|
||||
height: 2000.0, // more than 600, the height of the test area
|
||||
child: new Text('Hello')
|
||||
)
|
||||
],
|
||||
key: blockKey)
|
||||
new Block(
|
||||
key: blockKey,
|
||||
children: <Widget>[
|
||||
new Container(
|
||||
height: 2000.0, // more than 600, the height of the test area
|
||||
child: new Text('Hello')
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
tester.pump(); // for SizeObservers
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import 'package:test/test.dart';
|
||||
void main() {
|
||||
test('Can be placed in an infinite box', () {
|
||||
testWidgets((WidgetTester tester) {
|
||||
tester.pumpWidget(new Block(<Widget>[new Center()]));
|
||||
tester.pumpWidget(new Block(children: <Widget>[new Center()]));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,16 +12,18 @@ void main() {
|
||||
DateTime currentValue;
|
||||
|
||||
Widget widget = new Material(
|
||||
child: new Block(<Widget>[
|
||||
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;
|
||||
}
|
||||
)
|
||||
])
|
||||
child: new Block(
|
||||
children: <Widget>[
|
||||
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.pumpWidget(widget);
|
||||
|
||||
@@ -14,7 +14,7 @@ Key thirdKey = new Key('third');
|
||||
|
||||
final Map<String, RouteBuilder> routes = <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) => new Material(
|
||||
child: new Block([
|
||||
child: new Block(children: <Widget>[
|
||||
new Container(height: 100.0, width: 100.0),
|
||||
new Card(child: new Hero(tag: 'a', child: new Container(height: 100.0, width: 100.0, key: firstKey))),
|
||||
new Container(height: 100.0, width: 100.0),
|
||||
@@ -22,7 +22,7 @@ final Map<String, RouteBuilder> routes = <String, RouteBuilder>{
|
||||
])
|
||||
),
|
||||
'/two': (RouteArguments args) => new Material(
|
||||
child: new Block([
|
||||
child: new Block(children: <Widget>[
|
||||
new Container(height: 150.0, width: 150.0),
|
||||
new Card(child: new Hero(tag: 'a', child: new Container(height: 150.0, width: 150.0, key: secondKey))),
|
||||
new Container(height: 150.0, width: 150.0),
|
||||
@@ -34,7 +34,7 @@ final Map<String, RouteBuilder> routes = <String, RouteBuilder>{
|
||||
class ThreeRoute extends MaterialPageRoute {
|
||||
ThreeRoute() : super(builder: (BuildContext context) {
|
||||
return new Material(
|
||||
child: new Block([
|
||||
child: new Block(children: <Widget>[
|
||||
new Container(height: 200.0, width: 200.0),
|
||||
new Card(child: new Hero(tag: 'a', child: new Container(height: 200.0, width: 200.0, key: thirdKey))),
|
||||
new Container(height: 200.0, width: 200.0),
|
||||
|
||||
@@ -10,11 +10,11 @@ import 'package:test/test.dart';
|
||||
void main() {
|
||||
test('LinearProgressIndicator changes when its value changes', () {
|
||||
testWidgets((WidgetTester tester) {
|
||||
tester.pumpWidget(new Block(<Widget>[new LinearProgressIndicator(value: 0.0)]));
|
||||
tester.pumpWidget(new Block(children: <Widget>[new LinearProgressIndicator(value: 0.0)]));
|
||||
|
||||
List<Layer> layers1 = tester.layers;
|
||||
|
||||
tester.pumpWidget(new Block(<Widget>[new LinearProgressIndicator(value: 0.5)]));
|
||||
tester.pumpWidget(new Block(children: <Widget>[new LinearProgressIndicator(value: 0.5)]));
|
||||
|
||||
List<Layer> layers2 = tester.layers;
|
||||
expect(layers1, isNot(equals(layers2)));
|
||||
|
||||
Reference in New Issue
Block a user