Convert some Columns into Blocks (#3210)

These columns were secretly re-creating Block in a more complex way. Now we
just use Block directly.
This commit is contained in:
Adam Barth 2016-04-08 10:42:48 -07:00
parent e456d86327
commit 1251f01ec7
3 changed files with 78 additions and 89 deletions

View File

@ -159,95 +159,87 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
) )
] ]
), ),
body: new Padding( body: new Block(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: new ScrollableViewport( children: <Widget>[
child: new Column( new Container(
crossAxisAlignment: CrossAxisAlignment.stretch, padding: const EdgeInsets.symmetric(vertical: 8.0),
mainAxisAlignment: MainAxisAlignment.collapse, decoration: new BoxDecoration(
border: new Border(bottom: new BorderSide(color: theme.dividerColor))
),
child: new Align(
alignment: FractionalOffset.bottomLeft,
child: new Text('Event name', style: theme.textTheme.display2)
)
),
new Container(
padding: const EdgeInsets.symmetric(vertical: 8.0),
decoration: new BoxDecoration(
border: new Border(bottom: new BorderSide(color: theme.dividerColor))
),
child: new Align(
alignment: FractionalOffset.bottomLeft,
child: new Text('Location', style: theme.textTheme.title.copyWith(color: Colors.black54))
)
),
new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
new Container( new Text('From', style: theme.textTheme.caption),
padding: const EdgeInsets.symmetric(vertical: 8.0), new DateTimeItem(
decoration: new BoxDecoration( dateTime: _fromDateTime,
border: new Border(bottom: new BorderSide(color: theme.dividerColor)) onChanged: (DateTime value) {
), setState(() {
child: new Align( _fromDateTime = value;
alignment: FractionalOffset.bottomLeft, _saveNeeded = true;
child: new Text('Event name', style: theme.textTheme.display2) });
) }
),
new Container(
padding: const EdgeInsets.symmetric(vertical: 8.0),
decoration: new BoxDecoration(
border: new Border(bottom: new BorderSide(color: theme.dividerColor))
),
child: new Align(
alignment: FractionalOffset.bottomLeft,
child: new Text('Location', style: theme.textTheme.title.copyWith(color: Colors.black54))
)
),
new Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
new Text('From', style: theme.textTheme.caption),
new DateTimeItem(
dateTime: _fromDateTime,
onChanged: (DateTime value) {
setState(() {
_fromDateTime = value;
_saveNeeded = true;
});
}
)
]
),
new Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
new Text('To', style: theme.textTheme.caption),
new DateTimeItem(
dateTime: _toDateTime,
onChanged: (DateTime value) {
setState(() {
_toDateTime = value;
_saveNeeded = true;
});
}
)
]
),
new Container(
decoration: new BoxDecoration(
border: new Border(bottom: new BorderSide(color: theme.dividerColor))
),
child: new Row(
children: <Widget> [
new Checkbox(
value: _allDayValue,
onChanged: (bool value) {
setState(() {
_allDayValue = value;
_saveNeeded = true;
});
}
),
new Text('All-day')
]
)
) )
] ]
.map((Widget child) { ),
return new Container( new Column(
padding: const EdgeInsets.symmetric(vertical: 8.0), crossAxisAlignment: CrossAxisAlignment.start,
height: 96.0, children: <Widget>[
child: child new Text('To', style: theme.textTheme.caption),
); new DateTimeItem(
}) dateTime: _toDateTime,
.toList() onChanged: (DateTime value) {
setState(() {
_toDateTime = value;
_saveNeeded = true;
});
}
)
]
),
new Container(
decoration: new BoxDecoration(
border: new Border(bottom: new BorderSide(color: theme.dividerColor))
),
child: new Row(
children: <Widget> [
new Checkbox(
value: _allDayValue,
onChanged: (bool value) {
setState(() {
_allDayValue = value;
_saveNeeded = true;
});
}
),
new Text('All-day')
]
)
) )
) ]
.map((Widget child) {
return new Container(
padding: const EdgeInsets.symmetric(vertical: 8.0),
height: 96.0,
child: child
);
})
.toList()
) )
); );
} }

View File

@ -38,9 +38,7 @@ class ListDemoState extends State<ListDemo> {
decoration: new BoxDecoration( decoration: new BoxDecoration(
border: new Border(top: new BorderSide(color: Colors.black26)) border: new Border(top: new BorderSide(color: Colors.black26))
), ),
child: new Column( child: new Block(
mainAxisAlignment: MainAxisAlignment.collapse,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[ children: <Widget>[
new ListItem( new ListItem(
dense: true, dense: true,

View File

@ -19,8 +19,7 @@ class TooltipDemo extends StatelessWidget {
), ),
body: new Builder( body: new Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
return new Column( return new Block(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[ children: <Widget>[
new Text(_introText, style: theme.textTheme.subhead), new Text(_introText, style: theme.textTheme.subhead),
new Row( new Row(