mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Change the default MaterialType to canvas
Canvas is by far the most popular type of material by call site (and makes for a faster default because it doesn't have a RRect clip).
This commit is contained in:
parent
f9a7ed047d
commit
09665c0d7f
@ -193,7 +193,6 @@ class DemoHome extends StatelessComponent {
|
|||||||
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,
|
|
||||||
child: new DemoList()
|
child: new DemoList()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -15,7 +15,6 @@ class FitnessItemList extends StatelessComponent {
|
|||||||
|
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new Material(
|
return new Material(
|
||||||
type: MaterialType.canvas,
|
|
||||||
child: new ScrollableList<FitnessItem>(
|
child: new ScrollableList<FitnessItem>(
|
||||||
padding: const EdgeDims.all(4.0),
|
padding: const EdgeDims.all(4.0),
|
||||||
items: items,
|
items: items,
|
||||||
@ -172,10 +171,9 @@ 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(type: MaterialType.canvas);
|
return new Material();
|
||||||
if (config.userData.items.length == 0)
|
if (config.userData.items.length == 0)
|
||||||
return new Material(
|
return new Material(
|
||||||
type: MaterialType.canvas,
|
|
||||||
child: 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
|
||||||
@ -189,7 +187,6 @@ class FeedFragmentState extends State<FeedFragment> {
|
|||||||
);
|
);
|
||||||
case FitnessMode.chart:
|
case FitnessMode.chart:
|
||||||
return new Material(
|
return new Material(
|
||||||
type: MaterialType.canvas,
|
|
||||||
child: new Container(
|
child: new Container(
|
||||||
padding: const EdgeDims.all(20.0),
|
padding: const EdgeDims.all(20.0),
|
||||||
child: buildChart()
|
child: buildChart()
|
||||||
|
@ -86,7 +86,6 @@ 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 Material(
|
||||||
type: MaterialType.canvas,
|
|
||||||
child: new ScrollableViewport(
|
child: new ScrollableViewport(
|
||||||
child: new Container(
|
child: new Container(
|
||||||
padding: const EdgeDims.all(20.0),
|
padding: const EdgeDims.all(20.0),
|
||||||
|
@ -173,7 +173,6 @@ class MeasurementFragmentState extends State<MeasurementFragment> {
|
|||||||
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 Material(
|
||||||
type: MaterialType.canvas,
|
|
||||||
child: new Container(
|
child: new Container(
|
||||||
padding: const EdgeDims.all(20.0),
|
padding: const EdgeDims.all(20.0),
|
||||||
child: new Column([
|
child: new Column([
|
||||||
|
@ -93,7 +93,6 @@ class SettingsFragmentState extends State<SettingsFragment> {
|
|||||||
|
|
||||||
Widget buildSettingsPane(BuildContext context) {
|
Widget buildSettingsPane(BuildContext context) {
|
||||||
return new Material(
|
return new Material(
|
||||||
type: MaterialType.canvas,
|
|
||||||
child: 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),
|
||||||
|
@ -13,7 +13,6 @@ class StockList extends StatelessComponent {
|
|||||||
|
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new Material(
|
return new Material(
|
||||||
type: MaterialType.canvas,
|
|
||||||
child: new ScrollableList<Stock>(
|
child: new ScrollableList<Stock>(
|
||||||
items: stocks,
|
items: stocks,
|
||||||
itemExtent: StockRow.kHeight,
|
itemExtent: StockRow.kHeight,
|
||||||
|
@ -84,7 +84,6 @@ class StockSettingsState extends State<StockSettings> {
|
|||||||
// 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 Material(
|
||||||
type: MaterialType.canvas,
|
|
||||||
child: 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),
|
||||||
|
@ -33,7 +33,6 @@ 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 Material(
|
||||||
type: MaterialType.canvas,
|
|
||||||
child: new Block([
|
child: new Block([
|
||||||
new Container(
|
new Container(
|
||||||
padding: new EdgeDims.all(20.0),
|
padding: new EdgeDims.all(20.0),
|
||||||
|
@ -61,7 +61,6 @@ class ScaleAppState extends State<ScaleApp> {
|
|||||||
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,
|
|
||||||
child: new GestureDetector(
|
child: new GestureDetector(
|
||||||
onScaleStart: _handleScaleStart,
|
onScaleStart: _handleScaleStart,
|
||||||
onScaleUpdate: _handleScaleUpdate,
|
onScaleUpdate: _handleScaleUpdate,
|
||||||
|
@ -65,7 +65,6 @@ class SectorApp extends MaterialApp {
|
|||||||
|
|
||||||
Widget buildBody() {
|
Widget buildBody() {
|
||||||
return new Material(
|
return new Material(
|
||||||
type: MaterialType.canvas,
|
|
||||||
child: new Column([
|
child: new Column([
|
||||||
new Container(
|
new Container(
|
||||||
padding: new EdgeDims.symmetric(horizontal: 8.0, vertical: 25.0),
|
padding: new EdgeDims.symmetric(horizontal: 8.0, vertical: 25.0),
|
||||||
|
@ -118,6 +118,7 @@ class Dialog extends StatelessComponent {
|
|||||||
child: new Material(
|
child: new Material(
|
||||||
level: 4,
|
level: 4,
|
||||||
color: _getColor(context),
|
color: _getColor(context),
|
||||||
|
type: MaterialType.card,
|
||||||
child: new IntrinsicWidth(
|
child: new IntrinsicWidth(
|
||||||
child: new Block(dialogBody)
|
child: new Block(dialogBody)
|
||||||
)
|
)
|
||||||
|
@ -23,7 +23,7 @@ class Material extends StatelessComponent {
|
|||||||
Material({
|
Material({
|
||||||
Key key,
|
Key key,
|
||||||
this.child,
|
this.child,
|
||||||
this.type: MaterialType.card,
|
this.type: MaterialType.canvas,
|
||||||
this.level: 0,
|
this.level: 0,
|
||||||
this.color,
|
this.color,
|
||||||
this.textStyle
|
this.textStyle
|
||||||
|
@ -79,7 +79,6 @@ class SnackBar extends StatelessComponent {
|
|||||||
child: new Material(
|
child: new Material(
|
||||||
level: 2,
|
level: 2,
|
||||||
color: _kSnackBackground,
|
color: _kSnackBackground,
|
||||||
type: MaterialType.canvas,
|
|
||||||
child: new Container(
|
child: new Container(
|
||||||
margin: const EdgeDims.symmetric(horizontal: _kSideMargins),
|
margin: const EdgeDims.symmetric(horizontal: _kSideMargins),
|
||||||
child: new DefaultTextStyle(
|
child: new DefaultTextStyle(
|
||||||
|
Loading…
Reference in New Issue
Block a user