Commit 89a09822 authored by Adam Barth's avatar Adam Barth

Simplify Scaffold

Rather than using a custom render object, we can just use a Stack.
parent 922aece1
...@@ -81,7 +81,7 @@ class AddressBookHome extends StatelessComponent { ...@@ -81,7 +81,7 @@ class AddressBookHome extends StatelessComponent {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
toolbar: buildToolBar(context), toolBar: buildToolBar(context),
body: buildBody(context), body: buildBody(context),
floatingActionButton: buildFloatingActionButton(context) floatingActionButton: buildFloatingActionButton(context)
); );
......
...@@ -192,7 +192,7 @@ final ThemeData _theme = new ThemeData( ...@@ -192,7 +192,7 @@ final ThemeData _theme = new ThemeData(
class DemoHome extends StatelessComponent { class DemoHome extends StatelessComponent {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
toolbar: new ToolBar(center: new Text('Sky Demos')), toolBar: new ToolBar(center: new Text('Sky Demos')),
body: new Material( body: new Material(
type: MaterialType.canvas, type: MaterialType.canvas,
child: new DemoList() child: new DemoList()
......
...@@ -219,7 +219,7 @@ class FeedFragmentState extends State<FeedFragment> { ...@@ -219,7 +219,7 @@ class FeedFragmentState extends State<FeedFragment> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
toolbar: buildToolBar(), toolBar: buildToolBar(),
body: buildBody(), body: buildBody(),
snackBar: new Placeholder(key: _snackBarPlaceholderKey), snackBar: new Placeholder(key: _snackBarPlaceholderKey),
floatingActionButton: buildFloatingActionButton() floatingActionButton: buildFloatingActionButton()
......
...@@ -105,7 +105,7 @@ class MealFragmentState extends State<MealFragment> { ...@@ -105,7 +105,7 @@ class MealFragmentState extends State<MealFragment> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
toolbar: buildToolBar(), toolBar: buildToolBar(),
body: buildBody() body: buildBody()
); );
} }
......
...@@ -200,7 +200,7 @@ class MeasurementFragmentState extends State<MeasurementFragment> { ...@@ -200,7 +200,7 @@ class MeasurementFragmentState extends State<MeasurementFragment> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
toolbar: buildToolBar(), toolBar: buildToolBar(),
body: buildBody(context), body: buildBody(context),
snackBar: new Placeholder(key: _snackBarPlaceholderKey) snackBar: new Placeholder(key: _snackBarPlaceholderKey)
); );
......
...@@ -122,7 +122,7 @@ class SettingsFragmentState extends State<SettingsFragment> { ...@@ -122,7 +122,7 @@ class SettingsFragmentState extends State<SettingsFragment> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
toolbar: buildToolBar(), toolBar: buildToolBar(),
body: buildSettingsPane(context) body: buildSettingsPane(context)
); );
} }
......
...@@ -182,7 +182,7 @@ class MineDiggerState extends State<MineDigger> { ...@@ -182,7 +182,7 @@ class MineDiggerState extends State<MineDigger> {
return new Title( return new Title(
title: 'Mine Digger', title: 'Mine Digger',
child: new Scaffold( child: new Scaffold(
toolbar: buildToolBar(context), toolBar: buildToolBar(context),
body: new Container( body: new Container(
child: new Center(child: board), child: new Center(child: board),
decoration: new BoxDecoration(backgroundColor: Colors.grey[50]) decoration: new BoxDecoration(backgroundColor: Colors.grey[50])
......
...@@ -237,7 +237,7 @@ class StockHomeState extends State<StockHome> { ...@@ -237,7 +237,7 @@ class StockHomeState extends State<StockHome> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
toolbar: _isSearching ? buildSearchBar() : buildToolBar(), toolBar: _isSearching ? buildSearchBar() : buildToolBar(),
body: buildTabNavigator(), body: buildTabNavigator(),
snackBar: new Placeholder(key: _snackBarPlaceholderKey), snackBar: new Placeholder(key: _snackBarPlaceholderKey),
floatingActionButton: buildFloatingActionButton() floatingActionButton: buildFloatingActionButton()
......
...@@ -119,7 +119,7 @@ class StockSettingsState extends State<StockSettings> { ...@@ -119,7 +119,7 @@ class StockSettingsState extends State<StockSettings> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
toolbar: buildToolBar(context), toolBar: buildToolBar(context),
body: buildSettingsPane(context) body: buildSettingsPane(context)
); );
} }
......
...@@ -25,7 +25,7 @@ class StockSymbolViewerState extends State<StockSymbolViewer> { ...@@ -25,7 +25,7 @@ class StockSymbolViewerState extends State<StockSymbolViewer> {
TextStyle headings = Theme.of(context).text.body2; TextStyle headings = Theme.of(context).text.body2;
return new Scaffold( return new Scaffold(
toolbar: new ToolBar( toolBar: new ToolBar(
left: new IconButton( left: new IconButton(
icon: 'navigation/arrow_back', icon: 'navigation/arrow_back',
onPressed: config.navigator.pop onPressed: config.navigator.pop
......
...@@ -342,7 +342,7 @@ class CardCollectionState extends State<CardCollection> { ...@@ -342,7 +342,7 @@ class CardCollectionState extends State<CardCollection> {
} }
return new Scaffold( return new Scaffold(
toolbar: buildToolBar(), toolBar: buildToolBar(),
body: body body: body
); );
} }
......
...@@ -34,7 +34,7 @@ class DatePickerDemoState extends State<DatePickerDemo> { ...@@ -34,7 +34,7 @@ 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 Material(
child: new Row( child: new Row(
[new Text(_dateTime.toString())], [new Text(_dateTime.toString())],
......
...@@ -101,7 +101,7 @@ class DragAndDropApp extends StatefulComponent { ...@@ -101,7 +101,7 @@ class DragAndDropApp extends StatefulComponent {
class DragAndDropAppState extends State<DragAndDropApp> { class DragAndDropAppState extends State<DragAndDropApp> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
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 Material(
......
...@@ -89,7 +89,7 @@ class EnsureVisibleApp extends App { ...@@ -89,7 +89,7 @@ class EnsureVisibleApp extends App {
child: new Title( child: new Title(
title: 'Cards', title: 'Cards',
child: new Scaffold( child: new Scaffold(
toolbar: new ToolBar(center: new Text('Tap a Card')), toolBar: new ToolBar(center: new Text('Tap a Card')),
body: cardCollection body: cardCollection
) )
) )
......
...@@ -138,7 +138,7 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> { ...@@ -138,7 +138,7 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
List<Widget> layers = <Widget>[ List<Widget> layers = <Widget>[
new Scaffold( new Scaffold(
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]), decoration: new BoxDecoration(backgroundColor: Theme.of(context).primarySwatch[50]),
......
...@@ -149,7 +149,7 @@ class PageableListAppState extends State<PageableListApp> { ...@@ -149,7 +149,7 @@ class PageableListAppState extends State<PageableListApp> {
return new IconTheme( return new IconTheme(
data: const IconThemeData(color: IconThemeColor.white), data: const IconThemeData(color: IconThemeColor.white),
child: new Scaffold( child: new Scaffold(
toolbar: buildToolBar(), toolBar: buildToolBar(),
body: buildBody(context) body: buildBody(context)
) )
); );
......
...@@ -103,7 +103,7 @@ class ProgressIndicatorAppState extends State<ProgressIndicatorApp> { ...@@ -103,7 +103,7 @@ class ProgressIndicatorAppState extends State<ProgressIndicatorApp> {
child: new Title( child: new Title(
title: 'Progress Indicators', title: 'Progress Indicators',
child: new Scaffold( child: new Scaffold(
toolbar: new ToolBar(center: new Text('Progress Indicators')), toolBar: new ToolBar(center: new Text('Progress Indicators')),
body: new DefaultTextStyle( body: new DefaultTextStyle(
style: Theme.of(context).text.title, style: Theme.of(context).text.title,
child: body child: body
......
...@@ -59,7 +59,7 @@ class ScaleAppState extends State<ScaleApp> { ...@@ -59,7 +59,7 @@ class ScaleAppState extends State<ScaleApp> {
return new Theme( return new Theme(
data: new ThemeData.dark(), data: new ThemeData.dark(),
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 Material(
type: MaterialType.canvas, type: MaterialType.canvas,
......
...@@ -124,7 +124,7 @@ class SectorApp extends App { ...@@ -124,7 +124,7 @@ class SectorApp extends App {
child: new Title( child: new Title(
title: 'Sector Layout', title: 'Sector Layout',
child: new Scaffold( child: new Scaffold(
toolbar: new ToolBar( toolBar: new ToolBar(
center: new Text('Sector Layout in a Widget Tree') center: new Text('Sector Layout in a Widget Tree')
), ),
body: buildBody() body: buildBody()
......
...@@ -106,7 +106,7 @@ HAL: This mission is too important for me to allow you to jeopardize it.'''; ...@@ -106,7 +106,7 @@ HAL: This mission is too important for me to allow you to jeopardize it.''';
color: Colors.grey[50], color: Colors.grey[50],
child: interactiveBody child: interactiveBody
), ),
toolbar: new ToolBar( toolBar: new ToolBar(
center: new Text('Hal and Dave') center: new Text('Hal and Dave')
) )
) )
......
...@@ -131,7 +131,7 @@ class TabbedNavigatorAppState extends State<TabbedNavigatorApp> { ...@@ -131,7 +131,7 @@ class TabbedNavigatorAppState extends State<TabbedNavigatorApp> {
); );
return new Scaffold( return new Scaffold(
toolbar: toolbar, toolBar: toolbar,
body: tabNavigator body: tabNavigator
); );
} }
......
...@@ -14,6 +14,7 @@ const double kStatusBarHeight = 50.0; ...@@ -14,6 +14,7 @@ const double kStatusBarHeight = 50.0;
// Mobile Portrait: 56dp // Mobile Portrait: 56dp
// Tablet/Desktop: 64dp // Tablet/Desktop: 64dp
const double kToolBarHeight = 56.0; const double kToolBarHeight = 56.0;
const double kSnackBarHeight = 52.0;
const double kMaterialDrawerHeight = 140.0; const double kMaterialDrawerHeight = 140.0;
const double kScrollbarSize = 10.0; const double kScrollbarSize = 10.0;
......
...@@ -15,7 +15,6 @@ import 'package:sky/src/widgets/placeholder.dart'; ...@@ -15,7 +15,6 @@ import 'package:sky/src/widgets/placeholder.dart';
import 'package:sky/src/widgets/theme.dart'; import 'package:sky/src/widgets/theme.dart';
import 'package:sky/src/widgets/transitions.dart'; import 'package:sky/src/widgets/transitions.dart';
const double _kSnackHeight = 52.0;
const double _kSideMargins = 24.0; const double _kSideMargins = 24.0;
const double _kVerticalPadding = 14.0; const double _kVerticalPadding = 14.0;
const Color _kSnackBackground = const Color(0xFF323232); const Color _kSnackBackground = const Color(0xFF323232);
...@@ -72,14 +71,14 @@ class SnackBar extends StatelessComponent { ...@@ -72,14 +71,14 @@ class SnackBar extends StatelessComponent {
performance: performance, performance: performance,
height: new AnimatedValue<double>( height: new AnimatedValue<double>(
0.0, 0.0,
end: _kSnackHeight, end: kSnackBarHeight,
curve: easeIn, curve: easeIn,
reverseCurve: easeOut reverseCurve: easeOut
), ),
child: new ClipRect( child: new ClipRect(
child: new OverflowBox( child: new OverflowBox(
minHeight: _kSnackHeight, minHeight: kSnackBarHeight,
maxHeight: _kSnackHeight, maxHeight: kSnackBarHeight,
child: new Material( child: new Material(
level: 2, level: 2,
color: _kSnackBackground, color: _kSnackBackground,
......
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