Commit 27b5fc14 authored by Adam Barth's avatar Adam Barth

Scaffold should wrap its body in a Material

Fixes #1669
parent 88bcfa2d
...@@ -60,8 +60,7 @@ class AddressBookHome extends StatelessComponent { ...@@ -60,8 +60,7 @@ class AddressBookHome extends StatelessComponent {
static final GlobalKey noteKey = new GlobalKey(label: 'note field'); static final GlobalKey noteKey = new GlobalKey(label: 'note field');
Widget buildBody(BuildContext context) { Widget buildBody(BuildContext context) {
return new Material( return new Block([
child: new Block([
new AspectRatio( new AspectRatio(
aspectRatio: 16.0 / 9.0, aspectRatio: 16.0 / 9.0,
child: new Container( child: new Container(
...@@ -74,8 +73,7 @@ class AddressBookHome extends StatelessComponent { ...@@ -74,8 +73,7 @@ class AddressBookHome extends StatelessComponent {
new Field(inputKey: addressKey, icon: "maps/place", placeholder: "Address"), new Field(inputKey: addressKey, icon: "maps/place", placeholder: "Address"),
new Field(inputKey: ringtoneKey, icon: "av/volume_up", placeholder: "Ringtone"), new Field(inputKey: ringtoneKey, icon: "av/volume_up", placeholder: "Ringtone"),
new Field(inputKey: noteKey, icon: "content/add", placeholder: "Add note"), new Field(inputKey: noteKey, icon: "content/add", placeholder: "Add note"),
]) ]);
);
} }
Widget build(BuildContext context) { Widget build(BuildContext context) {
......
...@@ -14,13 +14,11 @@ class FitnessItemList extends StatelessComponent { ...@@ -14,13 +14,11 @@ class FitnessItemList extends StatelessComponent {
final FitnessItemHandler onDismissed; final FitnessItemHandler onDismissed;
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Material( return new ScrollableList<FitnessItem>(
child: new ScrollableList<FitnessItem>(
padding: const EdgeDims.all(4.0), padding: const EdgeDims.all(4.0),
items: items, items: items,
itemExtent: kFitnessItemHeight, itemExtent: kFitnessItemHeight,
itemBuilder: (_, item) => item.toRow(onDismissed: onDismissed) itemBuilder: (_, item) => item.toRow(onDismissed: onDismissed)
)
); );
} }
} }
...@@ -171,14 +169,13 @@ class FeedFragmentState extends State<FeedFragment> { ...@@ -171,14 +169,13 @@ class FeedFragmentState extends State<FeedFragment> {
Widget buildBody() { Widget buildBody() {
TextStyle style = Theme.of(context).text.title; TextStyle style = Theme.of(context).text.title;
if (config.userData == null) if (config.userData == null)
return new Material(); return new Container();
if (config.userData.items.length == 0) if (config.userData.items.length == 0) {
return new Material( return new Row(
child: new Row(
[new Text("No data yet.\nAdd some!", style: style)], [new Text("No data yet.\nAdd some!", style: style)],
justifyContent: FlexJustifyContent.center justifyContent: FlexJustifyContent.center
)
); );
}
switch (_fitnessMode) { switch (_fitnessMode) {
case FitnessMode.feed: case FitnessMode.feed:
return new FitnessItemList( return new FitnessItemList(
...@@ -186,11 +183,9 @@ class FeedFragmentState extends State<FeedFragment> { ...@@ -186,11 +183,9 @@ class FeedFragmentState extends State<FeedFragment> {
onDismissed: _handleItemDismissed onDismissed: _handleItemDismissed
); );
case FitnessMode.chart: case FitnessMode.chart:
return new Material( return new Container(
child: new Container(
padding: const EdgeDims.all(20.0), padding: const EdgeDims.all(20.0),
child: buildChart() child: buildChart()
)
); );
} }
} }
......
...@@ -85,8 +85,7 @@ class MealFragmentState extends State<MealFragment> { ...@@ -85,8 +85,7 @@ class MealFragmentState extends State<MealFragment> {
Widget buildBody() { Widget buildBody() {
Meal meal = new Meal(when: new DateTime.now()); Meal meal = new Meal(when: new DateTime.now());
return new Material( return new ScrollableViewport(
child: new ScrollableViewport(
child: new Container( child: new Container(
padding: const EdgeDims.all(20.0), padding: const EdgeDims.all(20.0),
child: new BlockBody([ child: new BlockBody([
...@@ -98,7 +97,6 @@ class MealFragmentState extends State<MealFragment> { ...@@ -98,7 +97,6 @@ class MealFragmentState extends State<MealFragment> {
), ),
]) ])
) )
)
); );
} }
......
...@@ -172,8 +172,7 @@ class MeasurementFragmentState extends State<MeasurementFragment> { ...@@ -172,8 +172,7 @@ class MeasurementFragmentState extends State<MeasurementFragment> {
Widget buildBody(BuildContext context) { Widget buildBody(BuildContext context) {
Measurement measurement = new Measurement(when: _when); Measurement measurement = new Measurement(when: _when);
// TODO(jackson): Revisit the layout of this pane to be more maintainable // TODO(jackson): Revisit the layout of this pane to be more maintainable
return new Material( return new Container(
child: new Container(
padding: const EdgeDims.all(20.0), padding: const EdgeDims.all(20.0),
child: new Column([ child: new Column([
new GestureDetector( new GestureDetector(
...@@ -193,7 +192,6 @@ class MeasurementFragmentState extends State<MeasurementFragment> { ...@@ -193,7 +192,6 @@ class MeasurementFragmentState extends State<MeasurementFragment> {
onChanged: _handleWeightChanged onChanged: _handleWeightChanged
), ),
], alignItems: FlexAlignItems.stretch) ], alignItems: FlexAlignItems.stretch)
)
); );
} }
......
...@@ -92,8 +92,7 @@ class SettingsFragmentState extends State<SettingsFragment> { ...@@ -92,8 +92,7 @@ class SettingsFragmentState extends State<SettingsFragment> {
} }
Widget buildSettingsPane(BuildContext context) { Widget buildSettingsPane(BuildContext context) {
return new Material( return new ScrollableViewport(
child: new ScrollableViewport(
child: new Container( child: new Container(
padding: const EdgeDims.symmetric(vertical: 20.0), padding: const EdgeDims.symmetric(vertical: 20.0),
child: new BlockBody([ child: new BlockBody([
...@@ -115,7 +114,6 @@ class SettingsFragmentState extends State<SettingsFragment> { ...@@ -115,7 +114,6 @@ class SettingsFragmentState extends State<SettingsFragment> {
), ),
]) ])
) )
)
); );
} }
......
...@@ -12,8 +12,7 @@ class StockList extends StatelessComponent { ...@@ -12,8 +12,7 @@ class StockList extends StatelessComponent {
final StockRowActionCallback onAction; final StockRowActionCallback onAction;
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Material( return new ScrollableList<Stock>(
child: new ScrollableList<Stock>(
items: stocks, items: stocks,
itemExtent: StockRow.kHeight, itemExtent: StockRow.kHeight,
itemBuilder: (BuildContext context, Stock stock) { itemBuilder: (BuildContext context, Stock stock) {
...@@ -23,7 +22,6 @@ class StockList extends StatelessComponent { ...@@ -23,7 +22,6 @@ class StockList extends StatelessComponent {
onLongPressed: onAction onLongPressed: onAction
); );
} }
)
); );
} }
} }
...@@ -83,8 +83,7 @@ class StockSettingsState extends State<StockSettings> { ...@@ -83,8 +83,7 @@ class StockSettingsState extends State<StockSettings> {
Widget buildSettingsPane(BuildContext context) { Widget buildSettingsPane(BuildContext context) {
// TODO(ianh): Once we have the gesture API hooked up, fix https://github.com/domokit/mojo/issues/281 // TODO(ianh): Once we have the gesture API hooked up, fix https://github.com/domokit/mojo/issues/281
// (whereby tapping the widgets below causes both the widget and the menu item to fire their callbacks) // (whereby tapping the widgets below causes both the widget and the menu item to fire their callbacks)
return new Material( return new ScrollableViewport(
child: new ScrollableViewport(
child: new Container( child: new Container(
padding: const EdgeDims.symmetric(vertical: 20.0), padding: const EdgeDims.symmetric(vertical: 20.0),
child: new BlockBody(<Widget>[ child: new BlockBody(<Widget>[
...@@ -112,7 +111,6 @@ class StockSettingsState extends State<StockSettings> { ...@@ -112,7 +111,6 @@ class StockSettingsState extends State<StockSettings> {
), ),
]) ])
) )
)
); );
} }
......
...@@ -32,8 +32,7 @@ class StockSymbolViewerState extends State<StockSymbolViewer> { ...@@ -32,8 +32,7 @@ class StockSymbolViewerState extends State<StockSymbolViewer> {
), ),
center: new Text('${config.stock.name} (${config.stock.symbol})') center: new Text('${config.stock.name} (${config.stock.symbol})')
), ),
body: new Material( body: new Block(<Widget>[
child: new Block(<Widget>[
new Container( new Container(
padding: new EdgeDims.all(20.0), padding: new EdgeDims.all(20.0),
child: new Column(<Widget>[ child: new Column(<Widget>[
...@@ -49,7 +48,6 @@ class StockSymbolViewerState extends State<StockSymbolViewer> { ...@@ -49,7 +48,6 @@ class StockSymbolViewerState extends State<StockSymbolViewer> {
) )
) )
]) ])
)
); );
} }
......
...@@ -34,13 +34,11 @@ class DatePickerDemoState extends State<DatePickerDemo> { ...@@ -34,13 +34,11 @@ class DatePickerDemoState extends State<DatePickerDemo> {
child: new Stack([ child: new Stack([
new Scaffold( new Scaffold(
toolBar: new ToolBar(center: new Text("Date Picker")), toolBar: new ToolBar(center: new Text("Date Picker")),
body: new Material( body: new Row(
child: new Row(
[new Text(_dateTime.toString())], [new Text(_dateTime.toString())],
alignItems: FlexAlignItems.end, alignItems: FlexAlignItems.end,
justifyContent: FlexJustifyContent.center justifyContent: FlexJustifyContent.center
) )
)
), ),
new Dialog( new Dialog(
content: new DatePicker( content: new DatePicker(
......
...@@ -103,8 +103,7 @@ class DragAndDropAppState extends State<DragAndDropApp> { ...@@ -103,8 +103,7 @@ class DragAndDropAppState extends State<DragAndDropApp> {
toolBar: new ToolBar( toolBar: new ToolBar(
center: new Text('Drag and Drop Flutter Demo') center: new Text('Drag and Drop Flutter Demo')
), ),
body: new Material( body: new DefaultTextStyle(
child: new DefaultTextStyle(
style: Theme.of(context).text.body1.copyWith(textAlign: TextAlign.center), style: Theme.of(context).text.body1.copyWith(textAlign: TextAlign.center),
child: new Column([ child: new Column([
new Flexible(child: new Row([ new Flexible(child: new Row([
...@@ -123,7 +122,6 @@ class DragAndDropAppState extends State<DragAndDropApp> { ...@@ -123,7 +122,6 @@ class DragAndDropAppState extends State<DragAndDropApp> {
])), ])),
]) ])
) )
)
); );
} }
} }
......
...@@ -40,8 +40,6 @@ class IndexedStackDemoState extends State<IndexedStackDemo> { ...@@ -40,8 +40,6 @@ class IndexedStackDemoState extends State<IndexedStackDemo> {
toolBar: new ToolBar(center: new Text('IndexedStackDemo Demo')), toolBar: new ToolBar(center: new Text('IndexedStackDemo Demo')),
body: new GestureDetector( body: new GestureDetector(
onTap: _handleTap, onTap: _handleTap,
child: new Container(
decoration: new BoxDecoration(backgroundColor: Theme.of(context).primarySwatch[50]),
child: new Center( child: new Center(
child: new Container( child: new Container(
child: indexedStack, child: indexedStack,
...@@ -50,7 +48,6 @@ class IndexedStackDemoState extends State<IndexedStackDemo> { ...@@ -50,7 +48,6 @@ class IndexedStackDemoState extends State<IndexedStackDemo> {
) )
) )
) )
)
); );
} }
} }
......
...@@ -139,7 +139,6 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> { ...@@ -139,7 +139,6 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> {
toolBar: new ToolBar(center: new Text('Tap a Card')), toolBar: new ToolBar(center: new Text('Tap a Card')),
body: new Container( body: new Container(
padding: const EdgeDims.symmetric(vertical: 12.0, horizontal: 8.0), padding: const EdgeDims.symmetric(vertical: 12.0, horizontal: 8.0),
decoration: new BoxDecoration(backgroundColor: Theme.of(context).primarySwatch[50]),
child: new ScrollableMixedWidgetList( child: new ScrollableMixedWidgetList(
builder: builder, builder: builder,
token: cardModels.length, token: cardModels.length,
......
...@@ -137,10 +137,7 @@ class PageableListAppState extends State<PageableListApp> { ...@@ -137,10 +137,7 @@ class PageableListAppState extends State<PageableListApp> {
); );
return new SizeObserver( return new SizeObserver(
callback: updatePageSize, callback: updatePageSize,
child: new Container( child: list
child: list,
decoration: new BoxDecoration(backgroundColor: Theme.of(context).primarySwatch[50])
)
); );
} }
......
...@@ -82,7 +82,6 @@ class ProgressIndicatorAppState extends State<ProgressIndicatorApp> { ...@@ -82,7 +82,6 @@ class ProgressIndicatorAppState extends State<ProgressIndicatorApp> {
onTap: handleTap, onTap: handleTap,
child: new Container( child: new Container(
padding: const EdgeDims.symmetric(vertical: 12.0, horizontal: 8.0), padding: const EdgeDims.symmetric(vertical: 12.0, horizontal: 8.0),
decoration: new BoxDecoration(backgroundColor: Theme.of(context).cardColor),
child: new BuilderTransition( child: new BuilderTransition(
variables: [valueAnimation.variable], variables: [valueAnimation.variable],
performance: valueAnimation.view, performance: valueAnimation.view,
......
...@@ -60,14 +60,12 @@ class ScaleAppState extends State<ScaleApp> { ...@@ -60,14 +60,12 @@ class ScaleAppState extends State<ScaleApp> {
child: new Scaffold( child: new Scaffold(
toolBar: new ToolBar( toolBar: new ToolBar(
center: new Text('Scale Demo')), center: new Text('Scale Demo')),
body: new Material( body: new GestureDetector(
child: new GestureDetector(
onScaleStart: _handleScaleStart, onScaleStart: _handleScaleStart,
onScaleUpdate: _handleScaleUpdate, onScaleUpdate: _handleScaleUpdate,
child: new CustomPaint(callback: paint, token: "$_zoom $_offset") child: new CustomPaint(callback: paint, token: "$_zoom $_offset")
) )
) )
)
); );
} }
} }
......
...@@ -49,7 +49,6 @@ class ScrollbarAppState extends State<ScrollbarApp> { ...@@ -49,7 +49,6 @@ class ScrollbarAppState extends State<ScrollbarApp> {
return new Scaffold( return new Scaffold(
toolBar: new ToolBar(center: new Text('Scrollbar Demo')), toolBar: new ToolBar(center: new Text('Scrollbar Demo')),
body: new Container( body: new Container(
decoration: new BoxDecoration(backgroundColor: Theme.of(context).primarySwatch[50]),
padding: new EdgeDims.all(12.0), padding: new EdgeDims.all(12.0),
child: new Center(child: new Card(child: scrollable)) child: new Center(child: new Card(child: scrollable))
) )
......
...@@ -68,8 +68,7 @@ class SectorAppState extends State<SectorApp> { ...@@ -68,8 +68,7 @@ class SectorAppState extends State<SectorApp> {
} }
Widget buildBody() { Widget buildBody() {
return new Material( return new Column(<Widget>[
child: new Column(<Widget>[
new Container( new Container(
padding: new EdgeDims.symmetric(horizontal: 8.0, vertical: 25.0), padding: new EdgeDims.symmetric(horizontal: 8.0, vertical: 25.0),
child: new Row(<Widget>[ child: new Row(<Widget>[
...@@ -117,7 +116,6 @@ class SectorAppState extends State<SectorApp> { ...@@ -117,7 +116,6 @@ class SectorAppState extends State<SectorApp> {
), ),
], ],
justifyContent: FlexJustifyContent.spaceBetween justifyContent: FlexJustifyContent.spaceBetween
)
); );
} }
......
...@@ -96,9 +96,8 @@ class TabbedNavigatorAppState extends State<TabbedNavigatorApp> { ...@@ -96,9 +96,8 @@ class TabbedNavigatorAppState extends State<TabbedNavigatorApp> {
Container _buildCard(BuildContext context, TabNavigator tabNavigator) { Container _buildCard(BuildContext context, TabNavigator tabNavigator) {
return new Container( return new Container(
child: new Card(child: new Padding(child: tabNavigator, padding: const EdgeDims.all(8.0))),
padding: const EdgeDims.all(12.0), padding: const EdgeDims.all(12.0),
decoration: new BoxDecoration(backgroundColor: Theme.of(context).primarySwatch[100]) child: new Card(child: new Padding(child: tabNavigator, padding: const EdgeDims.all(8.0)))
); );
} }
......
...@@ -7,6 +7,7 @@ import 'dart:ui' as ui; ...@@ -7,6 +7,7 @@ import 'dart:ui' as ui;
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'constants.dart'; import 'constants.dart';
import 'material.dart';
class Scaffold extends StatelessComponent { class Scaffold extends StatelessComponent {
Scaffold({ Scaffold({
...@@ -38,7 +39,9 @@ class Scaffold extends StatelessComponent { ...@@ -38,7 +39,9 @@ class Scaffold extends StatelessComponent {
if (body != null) { if (body != null) {
children.add(new Positioned( children.add(new Positioned(
top: toolBarHeight, right: 0.0, bottom: statusBarHeight, left: 0.0, top: toolBarHeight, right: 0.0, bottom: statusBarHeight, left: 0.0,
child: new Material(
child: body child: body
)
)); ));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment