Scaffold should wrap its body in a Material

Fixes #1669
This commit is contained in:
Adam Barth
2015-10-19 12:08:53 -07:00
parent 88bcfa2d79
commit 27b5fc14a3
19 changed files with 216 additions and 250 deletions

View File

@@ -34,12 +34,10 @@ class DatePickerDemoState extends State<DatePickerDemo> {
child: new Stack([
new Scaffold(
toolBar: new ToolBar(center: new Text("Date Picker")),
body: new Material(
child: new Row(
[new Text(_dateTime.toString())],
alignItems: FlexAlignItems.end,
justifyContent: FlexJustifyContent.center
)
body: new Row(
[new Text(_dateTime.toString())],
alignItems: FlexAlignItems.end,
justifyContent: FlexJustifyContent.center
)
),
new Dialog(

View File

@@ -103,26 +103,24 @@ class DragAndDropAppState extends State<DragAndDropApp> {
toolBar: new ToolBar(
center: new Text('Drag and Drop Flutter Demo')
),
body: new Material(
child: new DefaultTextStyle(
style: Theme.of(context).text.body1.copyWith(textAlign: TextAlign.center),
child: new Column([
new Flexible(child: new Row([
new ExampleDragSource(navigator: config.navigator, name: 'Orange', color: const Color(0xFFFF9000)),
new ExampleDragSource(navigator: config.navigator, name: 'Teal', color: const Color(0xFF00FFFF)),
new ExampleDragSource(navigator: config.navigator, name: 'Yellow', color: const Color(0xFFFFF000)),
],
alignItems: FlexAlignItems.center,
justifyContent: FlexJustifyContent.spaceAround
)),
new Flexible(child: new Row([
new Flexible(child: new ExampleDragTarget()),
new Flexible(child: new ExampleDragTarget()),
new Flexible(child: new ExampleDragTarget()),
new Flexible(child: new ExampleDragTarget()),
])),
])
)
body: new DefaultTextStyle(
style: Theme.of(context).text.body1.copyWith(textAlign: TextAlign.center),
child: new Column([
new Flexible(child: new Row([
new ExampleDragSource(navigator: config.navigator, name: 'Orange', color: const Color(0xFFFF9000)),
new ExampleDragSource(navigator: config.navigator, name: 'Teal', color: const Color(0xFF00FFFF)),
new ExampleDragSource(navigator: config.navigator, name: 'Yellow', color: const Color(0xFFFFF000)),
],
alignItems: FlexAlignItems.center,
justifyContent: FlexJustifyContent.spaceAround
)),
new Flexible(child: new Row([
new Flexible(child: new ExampleDragTarget()),
new Flexible(child: new ExampleDragTarget()),
new Flexible(child: new ExampleDragTarget()),
new Flexible(child: new ExampleDragTarget()),
])),
])
)
);
}

View File

@@ -40,14 +40,11 @@ class IndexedStackDemoState extends State<IndexedStackDemo> {
toolBar: new ToolBar(center: new Text('IndexedStackDemo Demo')),
body: new GestureDetector(
onTap: _handleTap,
child: new Container(
decoration: new BoxDecoration(backgroundColor: Theme.of(context).primarySwatch[50]),
child: new Center(
child: new Container(
child: indexedStack,
padding: const EdgeDims.all(8.0),
decoration: new BoxDecoration(border: new Border.all(color: Theme.of(context).accentColor))
)
child: new Center(
child: new Container(
child: indexedStack,
padding: const EdgeDims.all(8.0),
decoration: new BoxDecoration(border: new Border.all(color: Theme.of(context).accentColor))
)
)
)

View File

@@ -139,7 +139,6 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> {
toolBar: new ToolBar(center: new Text('Tap a Card')),
body: new Container(
padding: const EdgeDims.symmetric(vertical: 12.0, horizontal: 8.0),
decoration: new BoxDecoration(backgroundColor: Theme.of(context).primarySwatch[50]),
child: new ScrollableMixedWidgetList(
builder: builder,
token: cardModels.length,

View File

@@ -137,10 +137,7 @@ class PageableListAppState extends State<PageableListApp> {
);
return new SizeObserver(
callback: updatePageSize,
child: new Container(
child: list,
decoration: new BoxDecoration(backgroundColor: Theme.of(context).primarySwatch[50])
)
child: list
);
}

View File

@@ -82,7 +82,6 @@ class ProgressIndicatorAppState extends State<ProgressIndicatorApp> {
onTap: handleTap,
child: new Container(
padding: const EdgeDims.symmetric(vertical: 12.0, horizontal: 8.0),
decoration: new BoxDecoration(backgroundColor: Theme.of(context).cardColor),
child: new BuilderTransition(
variables: [valueAnimation.variable],
performance: valueAnimation.view,

View File

@@ -60,12 +60,10 @@ class ScaleAppState extends State<ScaleApp> {
child: new Scaffold(
toolBar: new ToolBar(
center: new Text('Scale Demo')),
body: new Material(
child: new GestureDetector(
onScaleStart: _handleScaleStart,
onScaleUpdate: _handleScaleUpdate,
child: new CustomPaint(callback: paint, token: "$_zoom $_offset")
)
body: new GestureDetector(
onScaleStart: _handleScaleStart,
onScaleUpdate: _handleScaleUpdate,
child: new CustomPaint(callback: paint, token: "$_zoom $_offset")
)
)
);

View File

@@ -49,7 +49,6 @@ class ScrollbarAppState extends State<ScrollbarApp> {
return new Scaffold(
toolBar: new ToolBar(center: new Text('Scrollbar Demo')),
body: new Container(
decoration: new BoxDecoration(backgroundColor: Theme.of(context).primarySwatch[50]),
padding: new EdgeDims.all(12.0),
child: new Center(child: new Card(child: scrollable))
)

View File

@@ -68,56 +68,54 @@ class SectorAppState extends State<SectorApp> {
}
Widget buildBody() {
return new Material(
child: new Column(<Widget>[
new Container(
padding: new EdgeDims.symmetric(horizontal: 8.0, vertical: 25.0),
child: new Row(<Widget>[
new RaisedButton(
enabled: _enabledAdd,
child: new IntrinsicWidth(
child: new Row(<Widget>[
new Container(
padding: new EdgeDims.all(4.0),
margin: new EdgeDims.only(right: 10.0),
child: new WidgetToRenderBoxAdapter(sectorAddIcon)
),
new Text('ADD SECTOR'),
])
),
onPressed: addSector
return new Column(<Widget>[
new Container(
padding: new EdgeDims.symmetric(horizontal: 8.0, vertical: 25.0),
child: new Row(<Widget>[
new RaisedButton(
enabled: _enabledAdd,
child: new IntrinsicWidth(
child: new Row(<Widget>[
new Container(
padding: new EdgeDims.all(4.0),
margin: new EdgeDims.only(right: 10.0),
child: new WidgetToRenderBoxAdapter(sectorAddIcon)
),
new Text('ADD SECTOR'),
])
),
new RaisedButton(
enabled: _enabledRemove,
child: new IntrinsicWidth(
child: new Row(<Widget>[
new Container(
padding: new EdgeDims.all(4.0),
margin: new EdgeDims.only(right: 10.0),
child: new WidgetToRenderBoxAdapter(sectorRemoveIcon)
),
new Text('REMOVE SECTOR'),
])
),
onPressed: removeSector
)
],
justifyContent: FlexJustifyContent.spaceAround
)
),
new Flexible(
child: new Container(
margin: new EdgeDims.all(8.0),
decoration: new BoxDecoration(
border: new Border.all(color: new Color(0xFF000000))
onPressed: addSector
),
padding: new EdgeDims.all(8.0),
child: new WidgetToRenderBoxAdapter(sectors)
)
),
],
justifyContent: FlexJustifyContent.spaceBetween
)
new RaisedButton(
enabled: _enabledRemove,
child: new IntrinsicWidth(
child: new Row(<Widget>[
new Container(
padding: new EdgeDims.all(4.0),
margin: new EdgeDims.only(right: 10.0),
child: new WidgetToRenderBoxAdapter(sectorRemoveIcon)
),
new Text('REMOVE SECTOR'),
])
),
onPressed: removeSector
)
],
justifyContent: FlexJustifyContent.spaceAround
)
),
new Flexible(
child: new Container(
margin: new EdgeDims.all(8.0),
decoration: new BoxDecoration(
border: new Border.all(color: new Color(0xFF000000))
),
padding: new EdgeDims.all(8.0),
child: new WidgetToRenderBoxAdapter(sectors)
)
),
],
justifyContent: FlexJustifyContent.spaceBetween
);
}

View File

@@ -96,9 +96,8 @@ class TabbedNavigatorAppState extends State<TabbedNavigatorApp> {
Container _buildCard(BuildContext context, TabNavigator tabNavigator) {
return new Container(
child: new Card(child: new Padding(child: tabNavigator, padding: const EdgeDims.all(8.0))),
padding: const EdgeDims.all(12.0),
decoration: new BoxDecoration(backgroundColor: Theme.of(context).primarySwatch[100])
padding: const EdgeDims.all(12.0),
child: new Card(child: new Padding(child: tabNavigator, padding: const EdgeDims.all(8.0)))
);
}