Merge pull request #2648 from abarth/rename_fixit2
Execute rename fixit (Part 2)
This commit is contained in:
commit
db261ff80f
@ -135,8 +135,8 @@ class CardCollectionState extends State<CardCollection> {
|
||||
buildDrawerColorRadioItem("Teal", Colors.teal, _primaryColor, _selectColor),
|
||||
new Divider(),
|
||||
buildDrawerDirectionRadioItem("Dismiss horizontally", DismissDirection.horizontal, _dismissDirection, _changeDismissDirection, icon: Icons.code),
|
||||
buildDrawerDirectionRadioItem("Dismiss left", DismissDirection.left, _dismissDirection, _changeDismissDirection, icon: Icons.arrow_back),
|
||||
buildDrawerDirectionRadioItem("Dismiss right", DismissDirection.right, _dismissDirection, _changeDismissDirection, icon: Icons.arrow_forward),
|
||||
buildDrawerDirectionRadioItem("Dismiss left", DismissDirection.endToStart, _dismissDirection, _changeDismissDirection, icon: Icons.arrow_back),
|
||||
buildDrawerDirectionRadioItem("Dismiss right", DismissDirection.startToEnd, _dismissDirection, _changeDismissDirection, icon: Icons.arrow_forward),
|
||||
new Divider(),
|
||||
buildFontRadioItem("Left-align text", new TextStyle(textAlign: TextAlign.left), _textStyle, _changeTextStyle, icon: Icons.format_align_left, enabled: !_editable),
|
||||
buildFontRadioItem("Center-align text", new TextStyle(textAlign: TextAlign.center), _textStyle, _changeTextStyle, icon: Icons.format_align_center, enabled: !_editable),
|
||||
@ -272,9 +272,9 @@ class CardCollectionState extends State<CardCollection> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildToolBar(BuildContext context) {
|
||||
return new ToolBar(
|
||||
right: <Widget>[
|
||||
Widget _buildAppBar(BuildContext context) {
|
||||
return new AppBar(
|
||||
actions: <Widget>[
|
||||
new Text(_dismissDirectionText(_dismissDirection))
|
||||
],
|
||||
flexibleSpace: (_) {
|
||||
@ -325,8 +325,8 @@ class CardCollectionState extends State<CardCollection> {
|
||||
children: <Widget>[
|
||||
new Text(cardModel.inputValue.text)
|
||||
],
|
||||
alignItems: FlexAlignItems.stretch,
|
||||
justifyContent: FlexJustifyContent.center
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
mainAxisAlignment: MainAxisAlignment.center
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -338,22 +338,24 @@ class CardCollectionState extends State<CardCollection> {
|
||||
case DismissDirection.horizontal:
|
||||
backgroundMessage = "Swipe in either direction";
|
||||
break;
|
||||
case DismissDirection.left:
|
||||
case DismissDirection.endToStart:
|
||||
backgroundMessage = "Swipe left to dismiss";
|
||||
break;
|
||||
case DismissDirection.right:
|
||||
case DismissDirection.startToEnd:
|
||||
backgroundMessage = "Swipe right to dismiss";
|
||||
break;
|
||||
default:
|
||||
backgroundMessage = "Unsupported dismissDirection";
|
||||
}
|
||||
|
||||
// TODO(abarth): This icon is wrong in RTL.
|
||||
Widget leftArrowIcon = new Icon(icon: Icons.arrow_back, size: 36.0);
|
||||
if (_dismissDirection == DismissDirection.right)
|
||||
if (_dismissDirection == DismissDirection.startToEnd)
|
||||
leftArrowIcon = new Opacity(opacity: 0.1, child: leftArrowIcon);
|
||||
|
||||
// TODO(abarth): This icon is wrong in RTL.
|
||||
Widget rightArrowIcon = new Icon(icon: Icons.arrow_forward, size: 36.0);
|
||||
if (_dismissDirection == DismissDirection.left)
|
||||
if (_dismissDirection == DismissDirection.endToStart)
|
||||
rightArrowIcon = new Opacity(opacity: 0.1, child: rightArrowIcon);
|
||||
|
||||
// The background Widget appears behind the Dismissable card when the card
|
||||
@ -451,7 +453,7 @@ class CardCollectionState extends State<CardCollection> {
|
||||
primarySwatch: _primaryColor
|
||||
),
|
||||
child: new Scaffold(
|
||||
toolBar: _buildToolBar(context),
|
||||
appBar: _buildAppBar(context),
|
||||
drawer: _buildDrawer(),
|
||||
body: body
|
||||
)
|
||||
@ -462,8 +464,8 @@ class CardCollectionState extends State<CardCollection> {
|
||||
void main() {
|
||||
runApp(new MaterialApp(
|
||||
title: 'Cards',
|
||||
routes: <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) => new CardCollection(),
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) => new CardCollection(),
|
||||
}
|
||||
));
|
||||
}
|
||||
|
@ -223,8 +223,8 @@ class DragAndDropAppState extends State<DragAndDropApp> {
|
||||
}
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(
|
||||
center: new Text('Drag and Drop Flutter Demo')
|
||||
appBar: new AppBar(
|
||||
title: new Text('Drag and Drop Flutter Demo')
|
||||
),
|
||||
body: new Column(
|
||||
children: <Widget>[
|
||||
@ -250,8 +250,8 @@ class DragAndDropAppState extends State<DragAndDropApp> {
|
||||
child: new Text('above')
|
||||
),
|
||||
],
|
||||
alignItems: FlexAlignItems.center,
|
||||
justifyContent: FlexJustifyContent.spaceAround
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround
|
||||
)
|
||||
),
|
||||
new Flexible(
|
||||
@ -271,7 +271,7 @@ class DragAndDropAppState extends State<DragAndDropApp> {
|
||||
new MovableBall(2, position, moveBall),
|
||||
new MovableBall(3, position, moveBall),
|
||||
],
|
||||
justifyContent: FlexJustifyContent.spaceAround
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround
|
||||
)
|
||||
),
|
||||
]
|
||||
@ -283,8 +283,8 @@ class DragAndDropAppState extends State<DragAndDropApp> {
|
||||
void main() {
|
||||
runApp(new MaterialApp(
|
||||
title: 'Drag and Drop Flutter Demo',
|
||||
routes: <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) => new DragAndDropApp()
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) => new DragAndDropApp()
|
||||
}
|
||||
));
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ class Launcher extends StatelessWidget {
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return new Row(
|
||||
justifyContent: FlexJustifyContent.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: items
|
||||
);
|
||||
}
|
||||
@ -238,6 +238,6 @@ class _WindowManagerState extends State<WindowManager> {
|
||||
void main() {
|
||||
runApp(new MaterialApp(
|
||||
title: 'Mozart',
|
||||
routes: <String, RouteBuilder>{ '/': (_) => new WindowManager() }
|
||||
routes: <String, WidgetBuilder>{ '/': (_) => new WindowManager() }
|
||||
));
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> {
|
||||
Widget build(BuildContext context) {
|
||||
List<Widget> layers = <Widget>[
|
||||
new Scaffold(
|
||||
toolBar: new ToolBar(center: new Text('Tap a Card')),
|
||||
appBar: new AppBar(title: new Text('Tap a Card')),
|
||||
body: new Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 8.0),
|
||||
child: new ScrollableMixedWidgetList(
|
||||
@ -179,8 +179,8 @@ void main() {
|
||||
accentColor: Colors.redAccent[200]
|
||||
),
|
||||
title: 'Cards',
|
||||
routes: <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) => new OverlayGeometryApp()
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) => new OverlayGeometryApp()
|
||||
}
|
||||
));
|
||||
}
|
||||
|
@ -105,10 +105,10 @@ class PageableListAppState extends State<PageableListApp> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildToolBar() {
|
||||
return new ToolBar(
|
||||
center: new Text('PageableList'),
|
||||
right: <Widget>[
|
||||
Widget _buildAppBar() {
|
||||
return new AppBar(
|
||||
title: new Text('PageableList'),
|
||||
actions: <Widget>[
|
||||
new Text(scrollDirection == Axis.horizontal ? "horizontal" : "vertical")
|
||||
]
|
||||
);
|
||||
@ -126,7 +126,7 @@ class PageableListAppState extends State<PageableListApp> {
|
||||
return new IconTheme(
|
||||
data: const IconThemeData(color: Colors.white),
|
||||
child: new Scaffold(
|
||||
toolBar: _buildToolBar(),
|
||||
appBar: _buildAppBar(),
|
||||
drawer: _buildDrawer(),
|
||||
body: _buildBody(context)
|
||||
)
|
||||
@ -142,8 +142,8 @@ void main() {
|
||||
primarySwatch: Colors.blue,
|
||||
accentColor: Colors.redAccent[200]
|
||||
),
|
||||
routes: <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) => new PageableListApp(),
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) => new PageableListApp(),
|
||||
}
|
||||
));
|
||||
}
|
||||
|
@ -12,11 +12,11 @@ void main() {
|
||||
runApp(
|
||||
new MaterialApp(
|
||||
title: "Hardware Key Demo",
|
||||
routes: <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) {
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) {
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(
|
||||
center: new Text("Hardware Key Demo")
|
||||
appBar: new AppBar(
|
||||
title: new Text("Hardware Key Demo")
|
||||
),
|
||||
body: new Material(
|
||||
child: new RawKeyboardDemo(
|
||||
@ -67,7 +67,7 @@ class _HardwareKeyDemoState extends State<RawKeyboardDemo> {
|
||||
new Text('${_event.type}', style: Typography.black.body2),
|
||||
new Text('${_event.keyData.keyCode}', style: Typography.black.display4)
|
||||
],
|
||||
justifyContent: FlexJustifyContent.center
|
||||
mainAxisAlignment: MainAxisAlignment.center
|
||||
);
|
||||
}
|
||||
return new RawKeyboardListener(
|
||||
|
@ -12,11 +12,11 @@ import 'src/solid_color_box.dart';
|
||||
void main() {
|
||||
RenderFlex table = new RenderFlex(direction: FlexDirection.vertical);
|
||||
|
||||
void addAlignmentRow(FlexAlignItems alignItems) {
|
||||
void addAlignmentRow(CrossAxisAlignment crossAxisAlignment) {
|
||||
TextStyle style = const TextStyle(color: const Color(0xFF000000));
|
||||
RenderParagraph paragraph = new RenderParagraph(new TextSpan(style: style, text: '$alignItems'));
|
||||
RenderParagraph paragraph = new RenderParagraph(new TextSpan(style: style, text: '$crossAxisAlignment'));
|
||||
table.add(new RenderPadding(child: paragraph, padding: new EdgeInsets.only(top: 20.0)));
|
||||
RenderFlex row = new RenderFlex(alignItems: alignItems, textBaseline: TextBaseline.alphabetic);
|
||||
RenderFlex row = new RenderFlex(crossAxisAlignment: crossAxisAlignment, textBaseline: TextBaseline.alphabetic);
|
||||
style = new TextStyle(fontSize: 15.0, color: const Color(0xFF000000));
|
||||
row.add(new RenderDecoratedBox(
|
||||
decoration: new BoxDecoration(backgroundColor: const Color(0x7FFFCCCC)),
|
||||
@ -27,7 +27,7 @@ void main() {
|
||||
decoration: new BoxDecoration(backgroundColor: const Color(0x7FCCFFCC)),
|
||||
child: new RenderParagraph(new TextSpan(style: style, text: 'foo foo foo'))
|
||||
));
|
||||
RenderFlex subrow = new RenderFlex(alignItems: alignItems, textBaseline: TextBaseline.alphabetic);
|
||||
RenderFlex subrow = new RenderFlex(crossAxisAlignment: crossAxisAlignment, textBaseline: TextBaseline.alphabetic);
|
||||
style = new TextStyle(fontSize: 25.0, color: const Color(0xFF000000));
|
||||
subrow.add(new RenderDecoratedBox(
|
||||
decoration: new BoxDecoration(backgroundColor: const Color(0x7FCCCCFF)),
|
||||
@ -40,13 +40,13 @@ void main() {
|
||||
rowParentData.flex = 1;
|
||||
}
|
||||
|
||||
addAlignmentRow(FlexAlignItems.start);
|
||||
addAlignmentRow(FlexAlignItems.end);
|
||||
addAlignmentRow(FlexAlignItems.center);
|
||||
addAlignmentRow(FlexAlignItems.stretch);
|
||||
addAlignmentRow(FlexAlignItems.baseline);
|
||||
addAlignmentRow(CrossAxisAlignment.start);
|
||||
addAlignmentRow(CrossAxisAlignment.end);
|
||||
addAlignmentRow(CrossAxisAlignment.center);
|
||||
addAlignmentRow(CrossAxisAlignment.stretch);
|
||||
addAlignmentRow(CrossAxisAlignment.baseline);
|
||||
|
||||
void addJustificationRow(FlexJustifyContent justify) {
|
||||
void addJustificationRow(MainAxisAlignment justify) {
|
||||
const TextStyle style = const TextStyle(color: const Color(0xFF000000));
|
||||
RenderParagraph paragraph = new RenderParagraph(new TextSpan(style: style, text: '$justify'));
|
||||
table.add(new RenderPadding(child: paragraph, padding: new EdgeInsets.only(top: 20.0)));
|
||||
@ -54,17 +54,17 @@ void main() {
|
||||
row.add(new RenderSolidColorBox(const Color(0xFFFFCCCC), desiredSize: new Size(80.0, 60.0)));
|
||||
row.add(new RenderSolidColorBox(const Color(0xFFCCFFCC), desiredSize: new Size(64.0, 60.0)));
|
||||
row.add(new RenderSolidColorBox(const Color(0xFFCCCCFF), desiredSize: new Size(160.0, 60.0)));
|
||||
row.justifyContent = justify;
|
||||
row.mainAxisAlignment = justify;
|
||||
table.add(row);
|
||||
final FlexParentData rowParentData = row.parentData;
|
||||
rowParentData.flex = 1;
|
||||
}
|
||||
|
||||
addJustificationRow(FlexJustifyContent.start);
|
||||
addJustificationRow(FlexJustifyContent.end);
|
||||
addJustificationRow(FlexJustifyContent.center);
|
||||
addJustificationRow(FlexJustifyContent.spaceBetween);
|
||||
addJustificationRow(FlexJustifyContent.spaceAround);
|
||||
addJustificationRow(MainAxisAlignment.start);
|
||||
addJustificationRow(MainAxisAlignment.end);
|
||||
addJustificationRow(MainAxisAlignment.center);
|
||||
addJustificationRow(MainAxisAlignment.spaceBetween);
|
||||
addJustificationRow(MainAxisAlignment.spaceAround);
|
||||
|
||||
RenderDecoratedBox root = new RenderDecoratedBox(
|
||||
decoration: new BoxDecoration(backgroundColor: const Color(0xFFFFFFFF)),
|
||||
|
@ -201,7 +201,7 @@ class _GestureDemoState extends State<GestureDemo> {
|
||||
]
|
||||
),
|
||||
],
|
||||
alignItems: FlexAlignItems.start
|
||||
crossAxisAlignment: CrossAxisAlignment.start
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -214,11 +214,11 @@ class _GestureDemoState extends State<GestureDemo> {
|
||||
void main() {
|
||||
runApp(new MaterialApp(
|
||||
theme: new ThemeData.dark(),
|
||||
routes: <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) {
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) {
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(
|
||||
center: new Text('Gestures Demo')),
|
||||
appBar: new AppBar(
|
||||
title: new Text('Gestures Demo')),
|
||||
body: new GestureDemo()
|
||||
);
|
||||
}
|
||||
|
@ -97,11 +97,11 @@ final List<String> _kNames = _initNames();
|
||||
void main() {
|
||||
runApp(new MaterialApp(
|
||||
title: 'Media Query Example',
|
||||
routes: <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) {
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) {
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(
|
||||
center: new Text('Media Query Example')
|
||||
appBar: new AppBar(
|
||||
title: new Text('Media Query Example')
|
||||
),
|
||||
body: new Material(child: new AdaptiveContainer(names: _kNames))
|
||||
);
|
||||
|
@ -126,7 +126,7 @@ class SectorAppState extends State<SectorApp> {
|
||||
)
|
||||
),
|
||||
],
|
||||
justifyContent: FlexJustifyContent.spaceAround
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround
|
||||
)
|
||||
),
|
||||
new Flexible(
|
||||
@ -143,7 +143,7 @@ class SectorAppState extends State<SectorApp> {
|
||||
)
|
||||
),
|
||||
],
|
||||
justifyContent: FlexJustifyContent.spaceBetween
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween
|
||||
);
|
||||
}
|
||||
|
||||
@ -151,11 +151,11 @@ class SectorAppState extends State<SectorApp> {
|
||||
return new MaterialApp(
|
||||
theme: new ThemeData.light(),
|
||||
title: 'Sector Layout',
|
||||
routes: <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) {
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) {
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(
|
||||
center: new Text('Sector Layout in a Widget Tree')
|
||||
appBar: new AppBar(
|
||||
title: new Text('Sector Layout in a Widget Tree')
|
||||
),
|
||||
body: buildBody()
|
||||
);
|
||||
|
@ -58,13 +58,13 @@ void attachWidgetTreeToRenderTree(RenderProxyBox container) {
|
||||
),
|
||||
new CircularProgressIndicator(value: value),
|
||||
],
|
||||
justifyContent: FlexJustifyContent.spaceAround
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround
|
||||
)
|
||||
)
|
||||
),
|
||||
new Rectangle(const Color(0xFFFFFF00)),
|
||||
],
|
||||
justifyContent: FlexJustifyContent.spaceBetween
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween
|
||||
)
|
||||
)
|
||||
).attachToRenderTree(element);
|
||||
|
@ -107,8 +107,8 @@ class _StyledTextDemoState extends State<StyledTextDemo> {
|
||||
padding: new EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: new Column(
|
||||
children: children,
|
||||
justifyContent: FlexJustifyContent.center,
|
||||
alignItems: FlexAlignItems.start
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start
|
||||
)
|
||||
)
|
||||
);
|
||||
@ -118,11 +118,11 @@ class _StyledTextDemoState extends State<StyledTextDemo> {
|
||||
void main() {
|
||||
runApp(new MaterialApp(
|
||||
theme: new ThemeData.light(),
|
||||
routes: <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) {
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) {
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(
|
||||
center: new Text('Hal and Dave')),
|
||||
appBar: new AppBar(
|
||||
title: new Text('Hal and Dave')),
|
||||
body: new Material(
|
||||
color: Colors.grey[50],
|
||||
child: new StyledTextDemo()
|
||||
|
@ -179,7 +179,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
|
||||
builder: (BuildContext context) {
|
||||
final TextStyle textStyle = Theme.of(context).textTheme.caption.copyWith(fontSize: 16.0);
|
||||
return new Column(
|
||||
alignItems: FlexAlignItems.stretch,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: <Widget>[
|
||||
demo.builder(context),
|
||||
new Padding(
|
||||
@ -196,8 +196,8 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
|
||||
return new TabBarSelection<_ButtonDemo>(
|
||||
values: demos,
|
||||
child: new Scaffold(
|
||||
toolBar: new ToolBar(
|
||||
center: new Text("Buttons"),
|
||||
appBar: new AppBar(
|
||||
title: new Text("Buttons"),
|
||||
tabBar: new TabBar<_ButtonDemo>(
|
||||
isScrollable: true,
|
||||
labels: new Map<_ButtonDemo, TabLabel>.fromIterable(demos, value: (_ButtonDemo demo) => demo.tabLabel)
|
||||
|
@ -82,8 +82,8 @@ class TravelDestinationItem extends StatelessWidget {
|
||||
child: new Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: new Column(
|
||||
justifyContent: FlexJustifyContent.start,
|
||||
alignItems: FlexAlignItems.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
// three line description
|
||||
new Text(destination.description[0], style: descriptionStyle),
|
||||
@ -92,8 +92,8 @@ class TravelDestinationItem extends StatelessWidget {
|
||||
// share, explore buttons
|
||||
new Flexible(
|
||||
child: new Row(
|
||||
justifyContent: FlexJustifyContent.start,
|
||||
alignItems: FlexAlignItems.end,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
new Padding(
|
||||
padding: const EdgeInsets.only(right: 16.0),
|
||||
@ -117,8 +117,8 @@ class TravelDestinationItem extends StatelessWidget {
|
||||
class CardsDemo extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(
|
||||
center: new Text("Travel Stream")
|
||||
appBar: new AppBar(
|
||||
title: new Text("Travel Stream")
|
||||
),
|
||||
body: new Block(
|
||||
padding: const EdgeInsets.only(top: 8.0, left: 8.0, right: 8.0),
|
||||
|
@ -36,7 +36,7 @@ class _ChipDemoState extends State<ChipDemo> {
|
||||
}
|
||||
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(center: new Text("Chips")),
|
||||
appBar: new AppBar(title: new Text("Chips")),
|
||||
body: new Block(
|
||||
children: chips.map((Widget widget) {
|
||||
return new Container(
|
||||
|
@ -60,8 +60,8 @@ class ColorItem extends StatelessWidget {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
decoration: new BoxDecoration(backgroundColor: color),
|
||||
child: new Row(
|
||||
justifyContent: FlexJustifyContent.spaceBetween,
|
||||
alignItems: FlexAlignItems.center,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
new Text('$prefix$index'),
|
||||
new Text(colorString())
|
||||
@ -111,9 +111,9 @@ class ColorsDemo extends StatelessWidget {
|
||||
return new TabBarSelection<ColorSwatch>(
|
||||
values: colorSwatches,
|
||||
child: new Scaffold(
|
||||
toolBar: new ToolBar(
|
||||
appBar: new AppBar(
|
||||
elevation: 0,
|
||||
center: new Text("Colors"),
|
||||
title: new Text("Colors"),
|
||||
tabBar: new TabBar<ColorSwatch>(
|
||||
isScrollable: true,
|
||||
labels: new Map<ColorSwatch, TabLabel>.fromIterable(colorSwatches, value: (ColorSwatch swatch) {
|
||||
|
@ -31,7 +31,7 @@ class _DatePickerDemoState extends State<DatePickerDemo> {
|
||||
Widget build(BuildContext context) {
|
||||
return
|
||||
new Scaffold(
|
||||
toolBar: new ToolBar(center: new Text("Date Picker")),
|
||||
appBar: new AppBar(title: new Text("Date Picker")),
|
||||
body: new Column(
|
||||
children: <Widget>[
|
||||
new Text(new DateFormat.yMMMd().format(_selectedDate)),
|
||||
@ -40,7 +40,7 @@ class _DatePickerDemoState extends State<DatePickerDemo> {
|
||||
child: new Text('SELECT DATE')
|
||||
),
|
||||
],
|
||||
justifyContent: FlexJustifyContent.center
|
||||
mainAxisAlignment: MainAxisAlignment.center
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -34,8 +34,8 @@ class DialogDemoItem extends StatelessWidget {
|
||||
child: new Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: new Row(
|
||||
justifyContent: FlexJustifyContent.start,
|
||||
alignItems: FlexAlignItems.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
new Icon(
|
||||
size: 36.0,
|
||||
@ -80,8 +80,8 @@ class DialogDemoState extends State<DialogDemo> {
|
||||
|
||||
return new Scaffold(
|
||||
key: scaffoldKey,
|
||||
toolBar: new ToolBar(
|
||||
center: new Text('Dialogs')
|
||||
appBar: new AppBar(
|
||||
title: new Text('Dialogs')
|
||||
),
|
||||
body: new Block(
|
||||
padding: const EdgeInsets.symmetric(vertical: 24.0, horizontal: 72.0),
|
||||
|
@ -20,7 +20,7 @@ class _DropDownDemoState extends State<DropDownDemo> {
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(center: new Text("Dropdown Button")),
|
||||
appBar: new AppBar(title: new Text("Dropdown Button")),
|
||||
body: new Center(
|
||||
child: new DropDownButton<String>(
|
||||
items: buildItems(),
|
||||
|
@ -18,8 +18,8 @@ class FitnessDemo extends StatelessWidget {
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(
|
||||
center: new Text("Fitness")
|
||||
appBar: new AppBar(
|
||||
title: new Text("Fitness")
|
||||
),
|
||||
body: new _FitnessDemoContents()
|
||||
);
|
||||
@ -93,7 +93,7 @@ class _FitnessDemoContentsState extends State<_FitnessDemoContents> {
|
||||
|
||||
return new Material(
|
||||
child: new Column(
|
||||
justifyContent: FlexJustifyContent.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
new Flexible(
|
||||
child: new Container(
|
||||
@ -108,7 +108,7 @@ class _FitnessDemoContentsState extends State<_FitnessDemoContents> {
|
||||
new Padding(
|
||||
padding: new EdgeInsets.only(top: 20.0, bottom: 20.0),
|
||||
child: new Row(
|
||||
justifyContent: FlexJustifyContent.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
_createInfoPanelCell(Icons.accessibility, '$count', 'COUNT'),
|
||||
_createInfoPanelCell(Icons.timer, _formatSeconds(time), 'TIME'),
|
||||
|
@ -47,7 +47,7 @@ class _ContactItem extends StatelessWidget {
|
||||
|
||||
List<Widget> rowChildren = <Widget>[
|
||||
new Column(
|
||||
alignItems: FlexAlignItems.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: columnChildren
|
||||
)
|
||||
];
|
||||
@ -60,7 +60,7 @@ class _ContactItem extends StatelessWidget {
|
||||
return new Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||
child: new Row(
|
||||
justifyContent: FlexJustifyContent.spaceBetween,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: rowChildren
|
||||
)
|
||||
);
|
||||
@ -85,8 +85,8 @@ class FlexibleSpaceDemoState extends State<FlexibleSpaceDemo> {
|
||||
appBarHeight: appBarHeight,
|
||||
scrollableKey: scrollableKey,
|
||||
appBarBehavior: AppBarBehavior.scroll,
|
||||
toolBar: new ToolBar(
|
||||
right: <Widget>[
|
||||
appBar: new AppBar(
|
||||
actions: <Widget>[
|
||||
new IconButton(
|
||||
icon: Icons.create,
|
||||
tooltip: 'Search'
|
||||
|
@ -53,7 +53,7 @@ class DateTimeItem extends StatelessWidget {
|
||||
});
|
||||
},
|
||||
child: new Row(
|
||||
justifyContent: FlexJustifyContent.spaceBetween,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
new Text(new DateFormat('EEE, MMM d yyyy').format(date)),
|
||||
new Icon(icon: Icons.arrow_drop_down, color: Colors.black54),
|
||||
@ -141,13 +141,13 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
|
||||
final ThemeData theme = Theme.of(context);
|
||||
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(
|
||||
left: new IconButton(
|
||||
appBar: new AppBar(
|
||||
leading: new IconButton(
|
||||
icon: Icons.clear,
|
||||
onPressed: () { handleDismissButton(context); }
|
||||
),
|
||||
center: new Text('New Event'),
|
||||
right: <Widget> [
|
||||
title: new Text('New Event'),
|
||||
actions: <Widget> [
|
||||
new FlatButton(
|
||||
child: new Text('SAVE', style: theme.textTheme.body1.copyWith(color: Colors.white)),
|
||||
onPressed: () {
|
||||
@ -160,8 +160,8 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: new ScrollableViewport(
|
||||
child: new Column(
|
||||
alignItems: FlexAlignItems.stretch,
|
||||
justifyContent: FlexJustifyContent.collapse,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
mainAxisAlignment: MainAxisAlignment.collapse,
|
||||
children: <Widget>[
|
||||
new Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
@ -184,8 +184,8 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
|
||||
)
|
||||
),
|
||||
new Column(
|
||||
alignItems: FlexAlignItems.stretch,
|
||||
justifyContent: FlexJustifyContent.end,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
new Text('From', style: theme.textTheme.caption),
|
||||
new DateTimeItem(
|
||||
@ -200,8 +200,8 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
|
||||
]
|
||||
),
|
||||
new Column(
|
||||
alignItems: FlexAlignItems.stretch,
|
||||
justifyContent: FlexJustifyContent.end,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
new Text('To', style: theme.textTheme.caption),
|
||||
new DateTimeItem(
|
||||
|
@ -41,8 +41,8 @@ class GridDemoPhotoItem extends StatelessWidget {
|
||||
Navigator.push(context, new MaterialPageRoute<Null>(
|
||||
builder: (BuildContext context) {
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(
|
||||
center: new Text(photo.title)
|
||||
appBar: new AppBar(
|
||||
title: new Text(photo.title)
|
||||
),
|
||||
body: new Material(
|
||||
child: new AssetImage(
|
||||
@ -72,7 +72,7 @@ class GridDemoPhotoItem extends StatelessWidget {
|
||||
return new GridTile(
|
||||
header: new GridTileBar(
|
||||
backgroundColor: Colors.black.withAlpha(0x08),
|
||||
left: new Icon(icon: Icons.info, color: Colors.white70),
|
||||
leading: new Icon(icon: Icons.info, color: Colors.white70),
|
||||
title: new Text(photo.title)
|
||||
),
|
||||
child: image
|
||||
@ -83,8 +83,8 @@ class GridDemoPhotoItem extends StatelessWidget {
|
||||
footer: new GridTileBar(
|
||||
backgroundColor: Colors.black.withAlpha(0x08),
|
||||
title: new Text(photo.title),
|
||||
caption: new Text(photo.caption),
|
||||
right: new Icon(icon: Icons.info, color: Colors.white70)
|
||||
subtitle: new Text(photo.caption),
|
||||
trailing: new Icon(icon: Icons.info, color: Colors.white70)
|
||||
),
|
||||
child: image
|
||||
);
|
||||
@ -172,9 +172,9 @@ class GridListDemoState extends State<GridListDemo> {
|
||||
Widget build(BuildContext context) {
|
||||
final Orientation orientation = MediaQuery.of(context).orientation;
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(
|
||||
center: new Text('Grid List'),
|
||||
right: <Widget>[
|
||||
appBar: new AppBar(
|
||||
title: new Text('Grid List'),
|
||||
actions: <Widget>[
|
||||
new IconButton(
|
||||
icon: Icons.more_vert,
|
||||
onPressed: () { showTileStyleMenu(context); },
|
||||
|
@ -66,8 +66,8 @@ class IconsDemoState extends State<IconsDemo> {
|
||||
final TextStyle textStyle = theme.textTheme.subhead.copyWith(color: theme.textTheme.caption.color);
|
||||
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(
|
||||
center: new Text('Icons')
|
||||
appBar: new AppBar(
|
||||
title: new Text('Icons')
|
||||
),
|
||||
body: new IconTheme(
|
||||
data: new IconThemeData(opacity: iconOpacity),
|
||||
@ -76,13 +76,13 @@ class IconsDemoState extends State<IconsDemo> {
|
||||
child: new Column(
|
||||
children: <Widget>[
|
||||
new Row(
|
||||
justifyContent: FlexJustifyContent.spaceBetween,
|
||||
alignItems: FlexAlignItems.center,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
new Flexible(
|
||||
flex: 0,
|
||||
child: new Column(
|
||||
alignItems: FlexAlignItems.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
new Text('Size', style: textStyle),
|
||||
buildSizeLabel(18, textStyle),
|
||||
@ -94,7 +94,7 @@ class IconsDemoState extends State<IconsDemo> {
|
||||
),
|
||||
new Flexible(
|
||||
child: new Column(
|
||||
alignItems: FlexAlignItems.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
new Text('Enabled', style: textStyle),
|
||||
buildIconButton(18.0, Icons.face, true),
|
||||
@ -106,7 +106,7 @@ class IconsDemoState extends State<IconsDemo> {
|
||||
),
|
||||
new Flexible(
|
||||
child: new Column(
|
||||
alignItems: FlexAlignItems.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
new Text('Disabled', style: textStyle),
|
||||
buildIconButton(18.0, Icons.face, false),
|
||||
@ -123,7 +123,7 @@ class IconsDemoState extends State<IconsDemo> {
|
||||
child: new IconTheme(
|
||||
data: new IconThemeData(opacity: 1.0),
|
||||
child: new Row(
|
||||
justifyContent: FlexJustifyContent.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
new Icon(
|
||||
icon: Icons.brightness_7,
|
||||
|
@ -61,10 +61,10 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
|
||||
_dismissDirection = DismissDirection.horizontal;
|
||||
break;
|
||||
case LeaveBehindDemoAction.leftSwipe:
|
||||
_dismissDirection = DismissDirection.left;
|
||||
_dismissDirection = DismissDirection.endToStart;
|
||||
break;
|
||||
case LeaveBehindDemoAction.rightSwipe:
|
||||
_dismissDirection = DismissDirection.right;
|
||||
_dismissDirection = DismissDirection.startToEnd;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -87,7 +87,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
|
||||
setState(() {
|
||||
leaveBehindItems.remove(item);
|
||||
});
|
||||
final String action = (direction == DismissDirection.left) ? 'archived' : 'deleted';
|
||||
final String action = (direction == DismissDirection.endToStart) ? 'archived' : 'deleted';
|
||||
_scaffoldKey.currentState.showSnackBar(new SnackBar(
|
||||
content: new Text('You $action item ${item.index}'),
|
||||
action: new SnackBarAction(
|
||||
@ -99,13 +99,13 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
|
||||
background: new Container(
|
||||
decoration: new BoxDecoration(backgroundColor: theme.primaryColor),
|
||||
child: new ListItem(
|
||||
left: new Icon(icon: Icons.delete, color: Colors.white, size: 36.0)
|
||||
leading: new Icon(icon: Icons.delete, color: Colors.white, size: 36.0)
|
||||
)
|
||||
),
|
||||
secondaryBackground: new Container(
|
||||
decoration: new BoxDecoration(backgroundColor: theme.primaryColor),
|
||||
child: new ListItem(
|
||||
right: new Icon(icon: Icons.archive, color: Colors.white, size: 36.0)
|
||||
trailing: new Icon(icon: Icons.archive, color: Colors.white, size: 36.0)
|
||||
)
|
||||
),
|
||||
child: new Container(
|
||||
@ -114,8 +114,8 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
|
||||
border: new Border(bottom: new BorderSide(color: theme.dividerColor))
|
||||
),
|
||||
child: new ListItem(
|
||||
primary: new Text(item.name),
|
||||
secondary: new Text('${item.subject}\n${item.body}'),
|
||||
title: new Text(item.name),
|
||||
subtitle: new Text('${item.subject}\n${item.body}'),
|
||||
isThreeLine: true
|
||||
)
|
||||
)
|
||||
@ -125,9 +125,9 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
key: _scaffoldKey,
|
||||
toolBar: new ToolBar(
|
||||
center: new Text('Swipe Items to Dismiss'),
|
||||
right: <Widget>[
|
||||
appBar: new AppBar(
|
||||
title: new Text('Swipe Items to Dismiss'),
|
||||
actions: <Widget>[
|
||||
new PopupMenuButton<LeaveBehindDemoAction>(
|
||||
onSelected: handleDemoAction,
|
||||
items: <PopupMenuEntry<LeaveBehindDemoAction>>[
|
||||
@ -143,12 +143,12 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
|
||||
),
|
||||
new CheckedPopupMenuItem<LeaveBehindDemoAction>(
|
||||
value: LeaveBehindDemoAction.leftSwipe,
|
||||
checked: _dismissDirection == DismissDirection.left,
|
||||
checked: _dismissDirection == DismissDirection.endToStart,
|
||||
child: new Text('Only swipe left')
|
||||
),
|
||||
new CheckedPopupMenuItem<LeaveBehindDemoAction>(
|
||||
value: LeaveBehindDemoAction.rightSwipe,
|
||||
checked: _dismissDirection == DismissDirection.right,
|
||||
checked: _dismissDirection == DismissDirection.startToEnd,
|
||||
child: new Text('Only swipe right')
|
||||
)
|
||||
]
|
||||
|
@ -44,13 +44,13 @@ class ListDemoState extends State<ListDemo> {
|
||||
border: new Border(top: new BorderSide(color: Colors.black26, width: 1.0))
|
||||
),
|
||||
child: new Column(
|
||||
justifyContent: FlexJustifyContent.collapse,
|
||||
alignItems: FlexAlignItems.stretch,
|
||||
mainAxisAlignment: MainAxisAlignment.collapse,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: <Widget>[
|
||||
new ListItem(
|
||||
dense: true,
|
||||
primary: new Text('One-line'),
|
||||
right: new Radio<ListDemoItemSize>(
|
||||
title: new Text('One-line'),
|
||||
trailing: new Radio<ListDemoItemSize>(
|
||||
value: ListDemoItemSize.oneLine,
|
||||
groupValue: _itemSize,
|
||||
onChanged: changeItemSize
|
||||
@ -58,8 +58,8 @@ class ListDemoState extends State<ListDemo> {
|
||||
),
|
||||
new ListItem(
|
||||
dense: true,
|
||||
primary: new Text('Two-line'),
|
||||
right: new Radio<ListDemoItemSize>(
|
||||
title: new Text('Two-line'),
|
||||
trailing: new Radio<ListDemoItemSize>(
|
||||
value: ListDemoItemSize.twoLine,
|
||||
groupValue: _itemSize,
|
||||
onChanged: changeItemSize
|
||||
@ -67,8 +67,8 @@ class ListDemoState extends State<ListDemo> {
|
||||
),
|
||||
new ListItem(
|
||||
dense: true,
|
||||
primary: new Text('Three-line'),
|
||||
right: new Radio<ListDemoItemSize>(
|
||||
title: new Text('Three-line'),
|
||||
trailing: new Radio<ListDemoItemSize>(
|
||||
value: ListDemoItemSize.threeLine,
|
||||
groupValue: _itemSize,
|
||||
onChanged: changeItemSize
|
||||
@ -76,8 +76,8 @@ class ListDemoState extends State<ListDemo> {
|
||||
),
|
||||
new ListItem(
|
||||
dense: true,
|
||||
primary: new Text('Show Avatar'),
|
||||
right: new Checkbox(
|
||||
title: new Text('Show Avatar'),
|
||||
trailing: new Checkbox(
|
||||
value: _showAvatars,
|
||||
onChanged: (bool value) {
|
||||
setState(() {
|
||||
@ -89,8 +89,8 @@ class ListDemoState extends State<ListDemo> {
|
||||
),
|
||||
new ListItem(
|
||||
dense: true,
|
||||
primary: new Text('Show Icon'),
|
||||
right: new Checkbox(
|
||||
title: new Text('Show Icon'),
|
||||
trailing: new Checkbox(
|
||||
value: _showIcons,
|
||||
onChanged: (bool value) {
|
||||
setState(() {
|
||||
@ -102,8 +102,8 @@ class ListDemoState extends State<ListDemo> {
|
||||
),
|
||||
new ListItem(
|
||||
dense: true,
|
||||
primary: new Text('Show Dividers'),
|
||||
right: new Checkbox(
|
||||
title: new Text('Show Dividers'),
|
||||
trailing: new Checkbox(
|
||||
value: _showDividers,
|
||||
onChanged: (bool value) {
|
||||
setState(() {
|
||||
@ -115,8 +115,8 @@ class ListDemoState extends State<ListDemo> {
|
||||
),
|
||||
new ListItem(
|
||||
dense: true,
|
||||
primary: new Text('Dense Layout'),
|
||||
right: new Checkbox(
|
||||
title: new Text('Dense Layout'),
|
||||
trailing: new Checkbox(
|
||||
value: _dense,
|
||||
onChanged: (bool value) {
|
||||
setState(() {
|
||||
@ -146,10 +146,10 @@ class ListDemoState extends State<ListDemo> {
|
||||
return new ListItem(
|
||||
isThreeLine: _itemSize == ListDemoItemSize.threeLine,
|
||||
dense: _dense,
|
||||
left: _showAvatars ? new CircleAvatar(child: new Text(item)) : null,
|
||||
primary: new Text('This item represents $item'),
|
||||
secondary: secondary,
|
||||
right: _showIcons ? new Icon(icon: Icons.info, color: Theme.of(context).disabledColor) : null
|
||||
leading: _showAvatars ? new CircleAvatar(child: new Text(item)) : null,
|
||||
title: new Text('This item represents $item'),
|
||||
subtitle: secondary,
|
||||
trailing: _showIcons ? new Icon(icon: Icons.info, color: Theme.of(context).disabledColor) : null
|
||||
);
|
||||
}
|
||||
|
||||
@ -174,9 +174,9 @@ class ListDemoState extends State<ListDemo> {
|
||||
|
||||
return new Scaffold(
|
||||
key: scaffoldKey,
|
||||
toolBar: new ToolBar(
|
||||
center: new Text('Scrolling List\n$itemSizeText$layoutText'),
|
||||
right: <Widget>[
|
||||
appBar: new AppBar(
|
||||
title: new Text('Scrolling List\n$itemSizeText$layoutText'),
|
||||
actions: <Widget>[
|
||||
new IconButton(
|
||||
icon: Icons.sort_by_alpha,
|
||||
tooltip: 'Sort',
|
||||
|
@ -56,15 +56,15 @@ class MenuDemoState extends State<MenuDemo> {
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
key: _scaffoldKey,
|
||||
toolBar: new ToolBar(
|
||||
center: new Text('Menus'),
|
||||
right: <Widget>[
|
||||
appBar: new AppBar(
|
||||
title: new Text('Menus'),
|
||||
actions: <Widget>[
|
||||
new PopupMenuButton<String>(
|
||||
onSelected: showMenuSelection,
|
||||
items: <PopupMenuItem<String>>[
|
||||
new PopupMenuItem<String>(
|
||||
value: 'ToolBar Menu',
|
||||
child: new Text('ToolBar Menu')
|
||||
value: 'AppBar Menu',
|
||||
child: new Text('AppBar Menu')
|
||||
),
|
||||
new PopupMenuItem<String>(
|
||||
value: 'Right Here',
|
||||
@ -85,8 +85,8 @@ class MenuDemoState extends State<MenuDemo> {
|
||||
// a simple menu with one disabled item. Typically the contents
|
||||
// of this "contextual menu" would reflect the app's state.
|
||||
new ListItem(
|
||||
primary: new Text('An item with a context menu button'),
|
||||
right: new PopupMenuButton<String>(
|
||||
title: new Text('An item with a context menu button'),
|
||||
trailing: new PopupMenuButton<String>(
|
||||
onSelected: showMenuSelection,
|
||||
items: <PopupMenuItem<String>>[
|
||||
new PopupMenuItem<String>(
|
||||
@ -108,37 +108,37 @@ class MenuDemoState extends State<MenuDemo> {
|
||||
// a menu whose items have text labels and icons and a divider
|
||||
// That separates the first three items from the last one.
|
||||
new ListItem(
|
||||
primary: new Text('An item with a sectioned menu'),
|
||||
right: new PopupMenuButton<String>(
|
||||
title: new Text('An item with a sectioned menu'),
|
||||
trailing: new PopupMenuButton<String>(
|
||||
onSelected: showMenuSelection,
|
||||
items: <PopupMenuEntry<String>>[
|
||||
new PopupMenuItem<String>(
|
||||
value: 'Preview',
|
||||
child: new ListItem(
|
||||
left: new Icon(icon: Icons.visibility),
|
||||
primary: new Text('Preview')
|
||||
leading: new Icon(icon: Icons.visibility),
|
||||
title: new Text('Preview')
|
||||
)
|
||||
),
|
||||
new PopupMenuItem<String>(
|
||||
value: 'Share',
|
||||
child: new ListItem(
|
||||
left: new Icon(icon: Icons.person_add),
|
||||
primary: new Text('Share')
|
||||
leading: new Icon(icon: Icons.person_add),
|
||||
title: new Text('Share')
|
||||
)
|
||||
),
|
||||
new PopupMenuItem<String>(
|
||||
value: 'Get Link',
|
||||
child: new ListItem(
|
||||
left: new Icon(icon: Icons.link),
|
||||
primary: new Text('Get Link')
|
||||
leading: new Icon(icon: Icons.link),
|
||||
title: new Text('Get Link')
|
||||
)
|
||||
),
|
||||
new PopupMenuDivider(),
|
||||
new PopupMenuItem<String>(
|
||||
value: 'Remove',
|
||||
child: new ListItem(
|
||||
left: new Icon(icon: Icons.delete),
|
||||
primary: new Text('Remove')
|
||||
leading: new Icon(icon: Icons.delete),
|
||||
title: new Text('Remove')
|
||||
)
|
||||
)
|
||||
]
|
||||
@ -151,8 +151,8 @@ class MenuDemoState extends State<MenuDemo> {
|
||||
initialValue: _simpleValue,
|
||||
onSelected: showMenuSelection,
|
||||
child: new ListItem(
|
||||
primary: new Text('An item with a simple menu'),
|
||||
secondary: new Text(_simpleValue)
|
||||
title: new Text('An item with a simple menu'),
|
||||
subtitle: new Text(_simpleValue)
|
||||
),
|
||||
items: <PopupMenuItem<String>>[
|
||||
new PopupMenuItem<String>(
|
||||
@ -172,8 +172,8 @@ class MenuDemoState extends State<MenuDemo> {
|
||||
// Pressing the PopupMenuButton on the right of this item shows a menu
|
||||
// whose items have checked icons that reflect this app's state.
|
||||
new ListItem(
|
||||
primary: new Text('An item with a checklist menu'),
|
||||
right: new PopupMenuButton<String>(
|
||||
title: new Text('An item with a checklist menu'),
|
||||
trailing: new PopupMenuButton<String>(
|
||||
onSelected: showCheckedMenuSelections,
|
||||
items: <PopupMenuItem<String>>[
|
||||
new CheckedPopupMenuItem<String>(
|
||||
|
@ -13,7 +13,7 @@ class ModalBottomSheetDemo extends StatelessWidget {
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(center: new Text("Modal Bottom Sheet")),
|
||||
appBar: new AppBar(title: new Text("Modal Bottom Sheet")),
|
||||
body: new Center(
|
||||
child: new Container(
|
||||
width: 200.0,
|
||||
|
@ -23,7 +23,7 @@ class PageSelectorDemo extends StatelessWidget {
|
||||
];
|
||||
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(center: new Text('Page Selector')),
|
||||
appBar: new AppBar(title: new Text('Page Selector')),
|
||||
body: new TabBarSelection<IconData>(
|
||||
values: icons,
|
||||
child: new Builder(
|
||||
@ -49,7 +49,7 @@ class PageSelectorDemo extends StatelessWidget {
|
||||
tooltip: 'Forward'
|
||||
)
|
||||
],
|
||||
justifyContent: FlexJustifyContent.spaceBetween
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween
|
||||
)
|
||||
),
|
||||
new Flexible(
|
||||
|
@ -28,7 +28,7 @@ class PersistentBottomSheetDemo extends StatelessWidget {
|
||||
|
||||
Widget build(BuildContext notUsed) { // Can't find the Scaffold from this context.
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(center: new Text("Persistent Bottom Sheet")),
|
||||
appBar: new AppBar(title: new Text("Persistent Bottom Sheet")),
|
||||
floatingActionButton: new FloatingActionButton(
|
||||
child: new Icon(icon: Icons.add),
|
||||
backgroundColor: Colors.redAccent[200]
|
||||
|
@ -77,13 +77,13 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> {
|
||||
children: indicators
|
||||
.map((Widget c) => new Container(child: c, margin: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 20.0)))
|
||||
.toList(),
|
||||
justifyContent: FlexJustifyContent.center
|
||||
mainAxisAlignment: MainAxisAlignment.center
|
||||
);
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(center: new Text('Progress Indicators')),
|
||||
appBar: new AppBar(title: new Text('Progress Indicators')),
|
||||
body: new DefaultTextStyle(
|
||||
style: Theme.of(context).textTheme.title,
|
||||
child: new GestureDetector(
|
||||
|
@ -28,7 +28,7 @@ class _BarGraphic extends StatelessWidget {
|
||||
child: new DefaultTextStyle(
|
||||
style: Theme.of(context).textTheme.body1.copyWith(color: Colors.white),
|
||||
child: new Row(
|
||||
justifyContent: FlexJustifyContent.spaceBetween,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
new Text(leftText),
|
||||
new Text(rightText)
|
||||
@ -48,8 +48,8 @@ class _StatusBarGraphic extends _BarGraphic {
|
||||
);
|
||||
}
|
||||
|
||||
class _ToolBarGraphic extends _BarGraphic {
|
||||
_ToolBarGraphic() : super(
|
||||
class _AppBarGraphic extends _BarGraphic {
|
||||
_AppBarGraphic() : super(
|
||||
height: 48.0,
|
||||
color: Colors.blue[400],
|
||||
leftText: 'Tool Bar',
|
||||
@ -92,7 +92,7 @@ class _TechniqueItem extends StatelessWidget {
|
||||
child: new Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: new Row(
|
||||
justifyContent: FlexJustifyContent.spaceBetween,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children :<Widget>[
|
||||
new Text(titleText),
|
||||
new Column(children: barGraphics)
|
||||
@ -113,7 +113,7 @@ const String _introText =
|
||||
class ScrollingTechniquesDemo extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(center: new Text('Scrolling Techniques')),
|
||||
appBar: new AppBar(title: new Text('Scrolling Techniques')),
|
||||
body: new Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: new Block(
|
||||
@ -127,7 +127,7 @@ class ScrollingTechniquesDemo extends StatelessWidget {
|
||||
titleText: 'Standard',
|
||||
barGraphics: <Widget>[
|
||||
new _StatusBarGraphic(),
|
||||
new _ToolBarGraphic()
|
||||
new _AppBarGraphic()
|
||||
]
|
||||
),
|
||||
new _TechniqueItem(
|
||||
@ -135,7 +135,7 @@ class ScrollingTechniquesDemo extends StatelessWidget {
|
||||
builder: (BuildContext context) => new FlexibleSpaceDemo(),
|
||||
barGraphics: <Widget>[
|
||||
new _StatusBarGraphic(),
|
||||
new _ToolBarGraphic(),
|
||||
new _AppBarGraphic(),
|
||||
new _TabBarGraphic()
|
||||
]
|
||||
),
|
||||
@ -144,7 +144,7 @@ class ScrollingTechniquesDemo extends StatelessWidget {
|
||||
builder: (BuildContext context) => new FlexibleSpaceDemo(),
|
||||
barGraphics: <Widget>[
|
||||
new _StatusBarGraphic(),
|
||||
new _ToolBarGraphic(),
|
||||
new _AppBarGraphic(),
|
||||
new _FlexibleSpaceGraphic()
|
||||
]
|
||||
)
|
||||
|
@ -13,7 +13,7 @@ class _SliderDemoState extends State<SliderDemo> {
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(center: new Text("Sliders")),
|
||||
appBar: new AppBar(title: new Text("Sliders")),
|
||||
body: new Block(children: <Widget>[
|
||||
new Container(
|
||||
height: 100.0,
|
||||
@ -35,7 +35,7 @@ class _SliderDemoState extends State<SliderDemo> {
|
||||
child: new Text(_value.round().toString().padLeft(3, '0'))
|
||||
),
|
||||
],
|
||||
justifyContent: FlexJustifyContent.collapse
|
||||
mainAxisAlignment: MainAxisAlignment.collapse
|
||||
)
|
||||
)
|
||||
),
|
||||
@ -51,7 +51,7 @@ class _SliderDemoState extends State<SliderDemo> {
|
||||
child: new Text((_value / 100.0).toStringAsFixed(2))
|
||||
),
|
||||
],
|
||||
justifyContent: FlexJustifyContent.collapse
|
||||
mainAxisAlignment: MainAxisAlignment.collapse
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -58,8 +58,8 @@ class SnackBarDemo extends StatelessWidget {
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(
|
||||
center: new Text('SnackBar')
|
||||
appBar: new AppBar(
|
||||
title: new Text('SnackBar')
|
||||
),
|
||||
body: new Builder(
|
||||
// Create an inner BuildContext so that the snackBar onPressed methods
|
||||
|
@ -28,8 +28,8 @@ class TabsDemo extends StatelessWidget {
|
||||
return new TabBarSelection<IconData>(
|
||||
values: icons,
|
||||
child: new Scaffold(
|
||||
toolBar: new ToolBar(
|
||||
center: new Text("Scrollable Tabs"),
|
||||
appBar: new AppBar(
|
||||
title: new Text("Scrollable Tabs"),
|
||||
tabBar: new TabBar<IconData>(
|
||||
isScrollable: true,
|
||||
labels: new Map<IconData, TabLabel>.fromIterable(
|
||||
|
@ -94,8 +94,8 @@ class _TabsFabDemoState extends State<TabsFabDemo> {
|
||||
onChanged: _handleTabSelection,
|
||||
child: new Scaffold(
|
||||
key: scaffoldKey,
|
||||
toolBar: new ToolBar(
|
||||
center: new Text("FAB per Tab"),
|
||||
appBar: new AppBar(
|
||||
title: new Text("FAB per Tab"),
|
||||
tabBar: new TabBar<_Page>(
|
||||
labels: new Map<_Page, TabLabel>.fromIterable(pages, value: (_Page page) => page.tabLabel)
|
||||
)
|
||||
|
@ -62,8 +62,8 @@ class TextFieldDemoState extends State<TextFieldDemo> {
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
key: _scaffoldKey,
|
||||
toolBar: new ToolBar(
|
||||
center: new Text('Text Fields')
|
||||
appBar: new AppBar(
|
||||
title: new Text('Text Fields')
|
||||
),
|
||||
body: new Block(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
@ -85,7 +85,7 @@ class TextFieldDemoState extends State<TextFieldDemo> {
|
||||
onSubmitted: _handleInputSubmitted
|
||||
),
|
||||
new Row(
|
||||
alignItems: FlexAlignItems.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Flexible(
|
||||
child: new Input(
|
||||
|
@ -27,7 +27,7 @@ class _TimePickerDemoState extends State<TimePickerDemo> {
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(center: new Text("Time Picker")),
|
||||
appBar: new AppBar(title: new Text("Time Picker")),
|
||||
body: new Column(
|
||||
children: <Widget>[
|
||||
new Text('$_selectedTime'),
|
||||
@ -36,7 +36,7 @@ class _TimePickerDemoState extends State<TimePickerDemo> {
|
||||
child: new Text('SELECT TIME')
|
||||
),
|
||||
],
|
||||
justifyContent: FlexJustifyContent.center
|
||||
mainAxisAlignment: MainAxisAlignment.center
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class _ToggleControlsDemoState extends State<ToggleControlsDemo> {
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(center: new Text("Selection Controls")),
|
||||
appBar: new AppBar(title: new Text("Selection Controls")),
|
||||
body: new Column(
|
||||
children: <Widget>[
|
||||
new Row(
|
||||
@ -42,7 +42,7 @@ class _ToggleControlsDemoState extends State<ToggleControlsDemo> {
|
||||
new Checkbox(value: false), // Disabled
|
||||
new Checkbox(value: true), // Disabled
|
||||
],
|
||||
justifyContent: FlexJustifyContent.spaceAround
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround
|
||||
),
|
||||
new Row(
|
||||
children: <int>[0, 1, 2].map((int i) {
|
||||
@ -52,13 +52,13 @@ class _ToggleControlsDemoState extends State<ToggleControlsDemo> {
|
||||
onChanged: _setRadioValue
|
||||
);
|
||||
}).toList(),
|
||||
justifyContent: FlexJustifyContent.spaceAround
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround
|
||||
),
|
||||
new Row(
|
||||
children: <int>[0, 1].map((int i) {
|
||||
return new Radio<int>(value: i, groupValue: 0); // Disabled
|
||||
}).toList(),
|
||||
justifyContent: FlexJustifyContent.spaceAround
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround
|
||||
),
|
||||
new Row(
|
||||
children: <Widget>[
|
||||
@ -66,10 +66,10 @@ class _ToggleControlsDemoState extends State<ToggleControlsDemo> {
|
||||
new Switch(value: false), // Disabled
|
||||
new Switch(value: true), // Disabled
|
||||
],
|
||||
justifyContent: FlexJustifyContent.spaceAround
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround
|
||||
),
|
||||
],
|
||||
justifyContent: FlexJustifyContent.spaceAround
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -13,13 +13,13 @@ class TooltipDemo extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final ThemeData theme = Theme.of(context);
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(
|
||||
center: new Text('Tooltip')
|
||||
appBar: new AppBar(
|
||||
title: new Text('Tooltip')
|
||||
),
|
||||
body: new Builder(
|
||||
builder: (BuildContext context) {
|
||||
return new Column(
|
||||
alignItems: FlexAlignItems.stretch,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: <Widget>[
|
||||
new Text(_introText, style: theme.textTheme.subhead),
|
||||
new Row(
|
||||
|
@ -7,23 +7,23 @@ import 'package:flutter/material.dart';
|
||||
class TwoLevelListDemo extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(center: new Text('Expand/Collapse List Control')),
|
||||
appBar: new AppBar(title: new Text('Expand/Collapse List Control')),
|
||||
body: new Padding(
|
||||
padding: const EdgeInsets.all(0.0),
|
||||
child: new TwoLevelList(
|
||||
type: MaterialListType.oneLine,
|
||||
items: <Widget>[
|
||||
new TwoLevelListItem(center: new Text('Top')),
|
||||
new TwoLevelListItem(title: new Text('Top')),
|
||||
new TwoLevelSublist(
|
||||
center: new Text('Sublist'),
|
||||
children: <Widget>[
|
||||
new TwoLevelListItem(center: new Text('One')),
|
||||
new TwoLevelListItem(center: new Text('Two')),
|
||||
new TwoLevelListItem(center: new Text('Free')),
|
||||
new TwoLevelListItem(center: new Text('Four'))
|
||||
new TwoLevelListItem(title: new Text('One')),
|
||||
new TwoLevelListItem(title: new Text('Two')),
|
||||
new TwoLevelListItem(title: new Text('Free')),
|
||||
new TwoLevelListItem(title: new Text('Four'))
|
||||
]
|
||||
),
|
||||
new TwoLevelListItem(center: new Text('Bottom'))
|
||||
new TwoLevelListItem(title: new Text('Bottom'))
|
||||
]
|
||||
)
|
||||
)
|
||||
|
@ -22,7 +22,7 @@ class TextStyleItem extends StatelessWidget {
|
||||
return new Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 16.0),
|
||||
child: new Row(
|
||||
alignItems: FlexAlignItems.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new SizedBox(
|
||||
width: 64.0,
|
||||
@ -62,7 +62,7 @@ class TypographyDemo extends StatelessWidget {
|
||||
}
|
||||
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(center: new Text('Typography')),
|
||||
appBar: new AppBar(title: new Text('Typography')),
|
||||
body: new Block(children: styleItems)
|
||||
);
|
||||
}
|
||||
|
@ -61,8 +61,8 @@ class _WeatherDemoState extends State<WeatherDemo> {
|
||||
Widget build(BuildContext context) {
|
||||
if (!assetsLoaded) {
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(
|
||||
center: new Text("Weather")
|
||||
appBar: new AppBar(
|
||||
title: new Text("Weather")
|
||||
),
|
||||
body: new Container(
|
||||
decoration: new BoxDecoration(
|
||||
@ -73,8 +73,8 @@ class _WeatherDemoState extends State<WeatherDemo> {
|
||||
}
|
||||
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(
|
||||
center: new Text("Weather")
|
||||
appBar: new AppBar(
|
||||
title: new Text("Weather")
|
||||
),
|
||||
body: new Material(
|
||||
child: new Stack(
|
||||
@ -83,7 +83,7 @@ class _WeatherDemoState extends State<WeatherDemo> {
|
||||
new Align(
|
||||
alignment: new FractionalOffset(0.5, 0.8),
|
||||
child: new Row(
|
||||
justifyContent: FlexJustifyContent.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
new WeatherButton(
|
||||
onPressed: () {
|
||||
|
@ -28,7 +28,7 @@ class GalleryAppState extends State<GalleryApp> {
|
||||
title: 'Flutter Material Gallery',
|
||||
theme: lightTheme ? new ThemeData.light() : new ThemeData.dark(),
|
||||
routes: {
|
||||
'/': (RouteArguments args) => new GalleryHome()
|
||||
'/': (BuildContext context) => new GalleryHome()
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ class GalleryHomeState extends State<GalleryHome> {
|
||||
return new Scaffold(
|
||||
appBarHeight: 128.0,
|
||||
drawer: new GalleryDrawer(),
|
||||
toolBar: new ToolBar(
|
||||
appBar: new AppBar(
|
||||
flexibleSpace: (BuildContext context) {
|
||||
return new Container(
|
||||
padding: const EdgeInsets.only(left: 16.0, bottom: 24.0),
|
||||
|
@ -39,7 +39,7 @@ class GallerySection extends StatelessWidget {
|
||||
appBarHeight: appBarHeight,
|
||||
appBarBehavior: AppBarBehavior.scroll,
|
||||
scrollableKey: scrollableKey,
|
||||
toolBar: new ToolBar(
|
||||
appBar: new AppBar(
|
||||
flexibleSpace: (BuildContext context) => new FlexibleSpaceBar(title: new Text(title))
|
||||
),
|
||||
body: new Material(
|
||||
@ -49,7 +49,7 @@ class GallerySection extends StatelessWidget {
|
||||
type: MaterialListType.oneLine,
|
||||
children: (demos ?? const <GalleryDemo>[]).map((GalleryDemo demo) {
|
||||
return new ListItem(
|
||||
primary: new Text(demo.title),
|
||||
title: new Text(demo.title),
|
||||
onTap: () { showDemo(demo, context, theme); }
|
||||
);
|
||||
})
|
||||
|
@ -114,9 +114,9 @@ class StocksAppState extends State<StocksApp> {
|
||||
debugShowMaterialGrid: _configuration.debugShowGrid,
|
||||
showPerformanceOverlay: _configuration.showPerformanceOverlay,
|
||||
showSemanticsDebugger: _configuration.showSemanticsDebugger,
|
||||
routes: <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) => new StockHome(_stocks, _symbols, _configuration, configurationUpdater),
|
||||
'/settings': (RouteArguments args) => new StockSettings(_configuration, configurationUpdater)
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) => new StockHome(_stocks, _symbols, _configuration, configurationUpdater),
|
||||
'/settings': (BuildContext context) => new StockSettings(_configuration, configurationUpdater)
|
||||
},
|
||||
onGenerateRoute: _getRoute,
|
||||
onLocaleChanged: _onLocaleChanged
|
||||
|
@ -206,11 +206,11 @@ class StockHomeState extends State<StockHome> {
|
||||
Navigator.popAndPushNamed(context, '/settings');
|
||||
}
|
||||
|
||||
Widget buildToolBar() {
|
||||
return new ToolBar(
|
||||
Widget buildAppBar() {
|
||||
return new AppBar(
|
||||
elevation: 0,
|
||||
center: new Text(StockStrings.of(context).title()),
|
||||
right: <Widget>[
|
||||
title: new Text(StockStrings.of(context).title()),
|
||||
actions: <Widget>[
|
||||
new IconButton(
|
||||
icon: Icons.search,
|
||||
onPressed: _handleSearchBegin,
|
||||
@ -303,14 +303,14 @@ class StockHomeState extends State<StockHome> {
|
||||
|
||||
// TODO(abarth): Should we factor this into a SearchBar in the framework?
|
||||
Widget buildSearchBar() {
|
||||
return new ToolBar(
|
||||
left: new IconButton(
|
||||
return new AppBar(
|
||||
leading: new IconButton(
|
||||
icon: Icons.arrow_back,
|
||||
color: Theme.of(context).accentColor,
|
||||
onPressed: _handleSearchEnd,
|
||||
tooltip: 'Back'
|
||||
),
|
||||
center: new Input(
|
||||
title: new Input(
|
||||
value: _searchQuery,
|
||||
autofocus: true,
|
||||
hintText: 'Search stocks',
|
||||
@ -341,7 +341,7 @@ class StockHomeState extends State<StockHome> {
|
||||
values: <StockHomeTab>[StockHomeTab.market, StockHomeTab.portfolio],
|
||||
child: new Scaffold(
|
||||
key: _scaffoldKey,
|
||||
toolBar: _isSearching ? buildSearchBar() : buildToolBar(),
|
||||
appBar: _isSearching ? buildSearchBar() : buildAppBar(),
|
||||
floatingActionButton: buildFloatingActionButton(),
|
||||
drawer: _buildDrawer(context),
|
||||
body: new TabBarView<StockHomeTab>(
|
||||
|
@ -102,7 +102,7 @@ class StockRow extends StatelessWidget {
|
||||
)
|
||||
),
|
||||
],
|
||||
alignItems: FlexAlignItems.baseline,
|
||||
crossAxisAlignment: CrossAxisAlignment.baseline,
|
||||
textBaseline: DefaultTextStyle.of(context).textBaseline
|
||||
)
|
||||
),
|
||||
|
@ -94,9 +94,9 @@ class StockSettingsState extends State<StockSettings> {
|
||||
config.updater(value);
|
||||
}
|
||||
|
||||
Widget buildToolBar(BuildContext context) {
|
||||
return new ToolBar(
|
||||
center: new Text('Settings')
|
||||
Widget buildAppBar(BuildContext context) {
|
||||
return new AppBar(
|
||||
title: new Text('Settings')
|
||||
);
|
||||
}
|
||||
|
||||
@ -247,7 +247,7 @@ class StockSettingsState extends State<StockSettings> {
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
toolBar: buildToolBar(context),
|
||||
appBar: buildAppBar(context),
|
||||
body: buildSettingsPane(context)
|
||||
);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class StockSymbolView extends StatelessWidget {
|
||||
child: new StockArrow(percentChange: stock.percentChange)
|
||||
),
|
||||
],
|
||||
justifyContent: FlexJustifyContent.spaceBetween
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween
|
||||
),
|
||||
new Text('Last Sale', style: headings),
|
||||
new Text('$lastSale ($changeInPrice)'),
|
||||
@ -60,7 +60,7 @@ class StockSymbolView extends StatelessWidget {
|
||||
)
|
||||
),
|
||||
],
|
||||
justifyContent: FlexJustifyContent.collapse
|
||||
mainAxisAlignment: MainAxisAlignment.collapse
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -73,8 +73,8 @@ class StockSymbolPage extends StatelessWidget {
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(
|
||||
center: new Text(stock.name)
|
||||
appBar: new AppBar(
|
||||
title: new Text(stock.name)
|
||||
),
|
||||
body: new Block(
|
||||
children: <Widget>[
|
||||
|
@ -8,6 +8,7 @@
|
||||
library material;
|
||||
|
||||
export 'src/material/app.dart';
|
||||
export 'src/material/app_bar.dart';
|
||||
export 'src/material/bottom_sheet.dart';
|
||||
export 'src/material/button.dart';
|
||||
export 'src/material/card.dart';
|
||||
@ -56,7 +57,6 @@ export 'src/material/theme_data.dart';
|
||||
export 'src/material/time_picker.dart';
|
||||
export 'src/material/time_picker_dialog.dart';
|
||||
export 'src/material/toggleable.dart';
|
||||
export 'src/material/tool_bar.dart';
|
||||
export 'src/material/tooltip.dart';
|
||||
export 'src/material/two_level_list.dart';
|
||||
export 'src/material/typography.dart';
|
||||
|
@ -28,7 +28,7 @@ class MaterialApp extends WidgetsApp {
|
||||
Key key,
|
||||
String title,
|
||||
ThemeData theme,
|
||||
Map<String, RouteBuilder> routes: const <String, RouteBuilder>{},
|
||||
Map<String, WidgetBuilder> routes: const <String, WidgetBuilder>{},
|
||||
RouteFactory onGenerateRoute,
|
||||
LocaleChangedCallback onLocaleChanged,
|
||||
this.debugShowMaterialGrid: false,
|
||||
@ -43,12 +43,10 @@ class MaterialApp extends WidgetsApp {
|
||||
color: theme?.primaryColor ?? Colors.blue[500], // blue[500] is the primary color of the default theme
|
||||
routes: routes,
|
||||
onGenerateRoute: (RouteSettings settings) {
|
||||
RouteBuilder builder = routes[settings.name];
|
||||
WidgetBuilder builder = routes[settings.name];
|
||||
if (builder != null) {
|
||||
return new MaterialPageRoute<Null>(
|
||||
builder: (BuildContext context) {
|
||||
return builder(new RouteArguments(context: context));
|
||||
},
|
||||
builder: builder,
|
||||
settings: settings
|
||||
);
|
||||
}
|
||||
|
@ -11,12 +11,12 @@ import 'material.dart';
|
||||
import 'theme.dart';
|
||||
import 'typography.dart';
|
||||
|
||||
class ToolBar extends StatelessWidget {
|
||||
ToolBar({
|
||||
class AppBar extends StatelessWidget {
|
||||
AppBar({
|
||||
Key key,
|
||||
this.left,
|
||||
this.center,
|
||||
this.right,
|
||||
this.leading,
|
||||
this.title,
|
||||
this.actions,
|
||||
this.flexibleSpace,
|
||||
this.foregroundOpacity: 1.0,
|
||||
this.tabBar,
|
||||
@ -29,9 +29,9 @@ class ToolBar extends StatelessWidget {
|
||||
assert((tabBar != null) ? flexibleSpace == null : true);
|
||||
}
|
||||
|
||||
final Widget left;
|
||||
final Widget center;
|
||||
final List<Widget> right;
|
||||
final Widget leading;
|
||||
final Widget title;
|
||||
final List<Widget> actions;
|
||||
final WidgetBuilder flexibleSpace;
|
||||
final double foregroundOpacity;
|
||||
final Widget tabBar;
|
||||
@ -40,7 +40,7 @@ class ToolBar extends StatelessWidget {
|
||||
final TextTheme textTheme;
|
||||
final EdgeInsets padding;
|
||||
|
||||
ToolBar copyWith({
|
||||
AppBar copyWith({
|
||||
Key key,
|
||||
Widget left,
|
||||
Widget center,
|
||||
@ -52,11 +52,11 @@ class ToolBar extends StatelessWidget {
|
||||
TextTheme textTheme,
|
||||
EdgeInsets padding
|
||||
}) {
|
||||
return new ToolBar(
|
||||
return new AppBar(
|
||||
key: key ?? this.key,
|
||||
left: left ?? this.left,
|
||||
center: center ?? this.center,
|
||||
right: right ?? this.right,
|
||||
leading: left ?? this.leading,
|
||||
title: center ?? this.title,
|
||||
actions: right ?? this.actions,
|
||||
flexibleSpace: flexibleSpace ?? this.flexibleSpace,
|
||||
foregroundOpacity: foregroundOpacity ?? this.foregroundOpacity,
|
||||
tabBar: tabBar ?? this.tabBar,
|
||||
@ -98,18 +98,18 @@ class ToolBar extends StatelessWidget {
|
||||
}
|
||||
|
||||
final List<Widget> toolBarRow = <Widget>[];
|
||||
if (left != null)
|
||||
toolBarRow.add(left);
|
||||
if (leading != null)
|
||||
toolBarRow.add(leading);
|
||||
toolBarRow.add(
|
||||
new Flexible(
|
||||
child: new Padding(
|
||||
padding: new EdgeInsets.only(left: 24.0),
|
||||
child: center != null ? new DefaultTextStyle(style: centerStyle, child: center) : null
|
||||
child: title != null ? new DefaultTextStyle(style: centerStyle, child: title) : null
|
||||
)
|
||||
)
|
||||
);
|
||||
if (right != null)
|
||||
toolBarRow.addAll(right);
|
||||
if (actions != null)
|
||||
toolBarRow.addAll(actions);
|
||||
|
||||
EdgeInsets combinedPadding = new EdgeInsets.symmetric(horizontal: 8.0);
|
||||
if (padding != null)
|
||||
@ -117,7 +117,7 @@ class ToolBar extends StatelessWidget {
|
||||
|
||||
// If the toolBar's height shrinks below toolBarHeight, it will be clipped and bottom
|
||||
// justified. This is so that the toolbar appears to move upwards as its height is reduced.
|
||||
final double toolBarHeight = kToolBarHeight + combinedPadding.top + combinedPadding.bottom;
|
||||
final double toolBarHeight = kAppBarHeight + combinedPadding.top + combinedPadding.bottom;
|
||||
final Widget toolBar = new ConstrainedBox(
|
||||
constraints: new BoxConstraints(maxHeight: toolBarHeight),
|
||||
child: new Padding(
|
||||
@ -142,7 +142,7 @@ class ToolBar extends StatelessWidget {
|
||||
Widget appBar = toolBar;
|
||||
if (tabBar != null) {
|
||||
appBar = new Column(
|
||||
justifyContent: FlexJustifyContent.collapse,
|
||||
mainAxisAlignment: MainAxisAlignment.collapse,
|
||||
children: <Widget>[toolBar, tabBar]
|
||||
);
|
||||
} else if (flexibleSpace != null) {
|
@ -87,7 +87,7 @@ class Chip extends StatelessWidget {
|
||||
),
|
||||
child: new Row(
|
||||
children: children,
|
||||
justifyContent: FlexJustifyContent.collapse
|
||||
mainAxisAlignment: MainAxisAlignment.collapse
|
||||
)
|
||||
)
|
||||
);
|
||||
|
@ -9,8 +9,8 @@ import 'package:flutter/widgets.dart';
|
||||
// Mobile Landscape: 48dp
|
||||
// Mobile Portrait: 56dp
|
||||
// Tablet/Desktop: 64dp
|
||||
const double kToolBarHeight = 56.0;
|
||||
const double kExtendedToolBarHeight = 128.0;
|
||||
const double kAppBarHeight = 56.0;
|
||||
const double kExtendedAppBarHeight = 128.0;
|
||||
|
||||
const double kTextTabBarHeight = 48.0;
|
||||
const double kIconTabBarHeight = 48.0;
|
||||
|
@ -98,7 +98,7 @@ class _DatePickerState extends State<DatePicker> {
|
||||
child: picker
|
||||
)
|
||||
],
|
||||
alignItems: FlexAlignItems.stretch
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch
|
||||
);
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ class DayPicker extends StatelessWidget {
|
||||
new Text(new DateFormat("MMMM y").format(displayedMonth), style: monthStyle),
|
||||
new Flex(
|
||||
children: headers,
|
||||
justifyContent: FlexJustifyContent.spaceAround
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround
|
||||
)
|
||||
];
|
||||
int year = displayedMonth.year;
|
||||
|
@ -90,7 +90,7 @@ class Dialog extends StatelessWidget {
|
||||
child: new Container(
|
||||
child: new Row(
|
||||
children: actions,
|
||||
justifyContent: FlexJustifyContent.end
|
||||
mainAxisAlignment: MainAxisAlignment.end
|
||||
)
|
||||
)
|
||||
));
|
||||
|
@ -304,7 +304,7 @@ class _DropDownButtonState<T> extends State<DropDownButton<T>> {
|
||||
padding: const EdgeInsets.only(top: 6.0)
|
||||
)
|
||||
],
|
||||
justifyContent: FlexJustifyContent.collapse
|
||||
mainAxisAlignment: MainAxisAlignment.collapse
|
||||
)
|
||||
)
|
||||
);
|
||||
|
@ -27,7 +27,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
|
||||
final double appBarHeight = Scaffold.of(context).appBarHeight;
|
||||
final Animation<double> animation = Scaffold.of(context).appBarAnimation;
|
||||
final EdgeInsets toolBarPadding = MediaQuery.of(context)?.padding ?? EdgeInsets.zero;
|
||||
final double toolBarHeight = kToolBarHeight + toolBarPadding.top;
|
||||
final double toolBarHeight = kAppBarHeight + toolBarPadding.top;
|
||||
final List<Widget> children = <Widget>[];
|
||||
|
||||
// background image
|
||||
@ -63,7 +63,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
|
||||
color: titleStyle.color.withAlpha(new Tween<double>(begin: 255.0, end: 0.0).evaluate(opacityCurve).toInt())
|
||||
);
|
||||
final double yAlignStart = 1.0;
|
||||
final double yAlignEnd = (toolBarPadding.top + kToolBarHeight / 2.0) / toolBarHeight;
|
||||
final double yAlignEnd = (toolBarPadding.top + kAppBarHeight / 2.0) / toolBarHeight;
|
||||
final double scaleAndAlignEnd = (appBarHeight - toolBarHeight) / appBarHeight;
|
||||
final CurvedAnimation scaleAndAlignCurve = new CurvedAnimation(
|
||||
parent: animation,
|
||||
|
@ -13,16 +13,23 @@ import 'typography.dart';
|
||||
/// Typically used to stack a one or two line header or footer on a Grid tile.
|
||||
/// The layout is based on the "Grid Lists" section of the Material Design spec:
|
||||
/// https://www.google.com/design/spec/components/grid-lists.html#grid-lists-specs
|
||||
/// For a one-line header specify title and to add a second line specify caption.
|
||||
/// Use left or right to add an icon.
|
||||
/// For a one-line header specify [title] and to add a second line specify [subtitle].
|
||||
/// Use [leading] or [trailing] to add an icon.
|
||||
class GridTileBar extends StatelessWidget {
|
||||
GridTileBar({ Key key, this.backgroundColor, this.left, this.right, this.title, this.caption }) : super(key: key);
|
||||
GridTileBar({
|
||||
Key key,
|
||||
this.backgroundColor,
|
||||
this.leading,
|
||||
this.title,
|
||||
this.subtitle,
|
||||
this.trailing
|
||||
}) : super(key: key);
|
||||
|
||||
final Color backgroundColor;
|
||||
final Widget left;
|
||||
final Widget right;
|
||||
final Widget leading;
|
||||
final Widget title;
|
||||
final Widget caption;
|
||||
final Widget subtitle;
|
||||
final Widget trailing;
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
BoxDecoration decoration;
|
||||
@ -30,23 +37,23 @@ class GridTileBar extends StatelessWidget {
|
||||
decoration = new BoxDecoration(backgroundColor: backgroundColor);
|
||||
|
||||
EdgeInsets padding;
|
||||
if (left != null && right != null)
|
||||
if (leading != null && trailing != null)
|
||||
padding = const EdgeInsets.symmetric(vertical: 16.0, horizontal: 8.0);
|
||||
else if (left != null)
|
||||
else if (leading != null)
|
||||
padding = const EdgeInsets.only(left: 8.0, right: 16.0, top: 16.0, bottom: 16.0);
|
||||
else // right != null || (left == null && right == null)
|
||||
else // trailing != null || (leading == null && trailing == null)
|
||||
padding = const EdgeInsets.only(left: 16.0, right: 8.0, top: 16.0, bottom: 16.0);
|
||||
|
||||
final List<Widget> children = <Widget>[];
|
||||
|
||||
if (left != null)
|
||||
children.add(new Padding(padding: const EdgeInsets.only(right: 8.0), child: left));
|
||||
if (leading != null)
|
||||
children.add(new Padding(padding: const EdgeInsets.only(right: 8.0), child: leading));
|
||||
|
||||
if (title != null && caption != null) {
|
||||
if (title != null && subtitle != null) {
|
||||
children.add(
|
||||
new Flexible(
|
||||
child: new Column(
|
||||
alignItems: FlexAlignItems.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new DefaultTextStyle(
|
||||
style: Typography.white.subhead,
|
||||
@ -54,25 +61,25 @@ class GridTileBar extends StatelessWidget {
|
||||
),
|
||||
new DefaultTextStyle(
|
||||
style: Typography.white.caption,
|
||||
child: caption
|
||||
child: subtitle
|
||||
)
|
||||
]
|
||||
)
|
||||
)
|
||||
);
|
||||
} else if (title != null || caption != null) {
|
||||
} else if (title != null || subtitle != null) {
|
||||
children.add(
|
||||
new Flexible(
|
||||
child: new DefaultTextStyle(
|
||||
style: Typography.white.subhead,
|
||||
child: title ?? caption
|
||||
child: title ?? subtitle
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (right != null)
|
||||
children.add(new Padding(padding: const EdgeInsets.only(left: 8.0), child: right));
|
||||
if (trailing != null)
|
||||
children.add(new Padding(padding: const EdgeInsets.only(left: 8.0), child: trailing));
|
||||
|
||||
return new Container(
|
||||
padding: padding,
|
||||
@ -80,7 +87,7 @@ class GridTileBar extends StatelessWidget {
|
||||
child: new IconTheme(
|
||||
data: new IconThemeData(color: Colors.white),
|
||||
child: new Row(
|
||||
alignItems: FlexAlignItems.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: children
|
||||
)
|
||||
)
|
||||
|
@ -188,7 +188,7 @@ class _InputState extends State<Input> {
|
||||
double iconSize = config.isDense ? 18.0 : 24.0;
|
||||
double iconTop = topPadding + (textStyle.fontSize - iconSize) / 2.0;
|
||||
child = new Row(
|
||||
alignItems: FlexAlignItems.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
new Container(
|
||||
margin: new EdgeInsets.only(right: 16.0, top: iconTop),
|
||||
|
@ -9,32 +9,32 @@ import 'ink_well.dart';
|
||||
import 'theme.dart';
|
||||
|
||||
/// Material List items are one to three lines of text optionally flanked by icons.
|
||||
/// Icons are defined with the [left] and [right] parameters. The first line of text
|
||||
/// is not optional and is specified with [primary]. The value of [secondary] will
|
||||
/// Icons are defined with the [leading] and [trailing] parameters. The first line of text
|
||||
/// is not optional and is specified with [title]. The value of [subtitle] will
|
||||
/// occupy the space allocated for an aditional line of text, or two lines if
|
||||
/// isThreeLine: true is specified. If dense: true is specified then the overall
|
||||
/// height of this list item and the size of the DefaultTextStyles that wrap
|
||||
/// the [primary] and [secondary] widget are reduced.
|
||||
/// the [title] and [subtitle] widget are reduced.
|
||||
class ListItem extends StatelessWidget {
|
||||
ListItem({
|
||||
Key key,
|
||||
this.left,
|
||||
this.primary,
|
||||
this.secondary,
|
||||
this.right,
|
||||
this.leading,
|
||||
this.title,
|
||||
this.subtitle,
|
||||
this.trailing,
|
||||
this.isThreeLine: false,
|
||||
this.dense: false,
|
||||
this.enabled: true,
|
||||
this.onTap,
|
||||
this.onLongPress
|
||||
}) : super(key: key) {
|
||||
assert(isThreeLine ? secondary != null : true);
|
||||
assert(isThreeLine ? subtitle != null : true);
|
||||
}
|
||||
|
||||
final Widget left;
|
||||
final Widget primary;
|
||||
final Widget secondary;
|
||||
final Widget right;
|
||||
final Widget leading;
|
||||
final Widget title;
|
||||
final Widget subtitle;
|
||||
final Widget trailing;
|
||||
final bool isThreeLine;
|
||||
final bool dense;
|
||||
final bool enabled;
|
||||
@ -86,7 +86,7 @@ class ListItem extends StatelessWidget {
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
assert(debugCheckHasMaterial(context));
|
||||
final bool isTwoLine = !isThreeLine && secondary != null;
|
||||
final bool isTwoLine = !isThreeLine && subtitle != null;
|
||||
final bool isOneLine = !isThreeLine && !isTwoLine;
|
||||
double itemHeight;
|
||||
if (isOneLine)
|
||||
@ -103,31 +103,31 @@ class ListItem extends StatelessWidget {
|
||||
// Overall, the list item is a Row() with these children.
|
||||
final List<Widget> children = <Widget>[];
|
||||
|
||||
if (left != null) {
|
||||
if (leading != null) {
|
||||
children.add(new Container(
|
||||
margin: new EdgeInsets.only(right: 16.0, top: iconMarginTop),
|
||||
width: 40.0,
|
||||
child: new Align(
|
||||
alignment: new FractionalOffset(0.0, isThreeLine ? 0.0 : 0.5),
|
||||
child: left
|
||||
child: leading
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
final Widget primaryLine = new DefaultTextStyle(
|
||||
style: primaryTextStyle(context),
|
||||
child: primary ?? new Container()
|
||||
child: title ?? new Container()
|
||||
);
|
||||
Widget center = primaryLine;
|
||||
if (isTwoLine || isThreeLine) {
|
||||
center = new Column(
|
||||
justifyContent: FlexJustifyContent.collapse,
|
||||
alignItems: FlexAlignItems.start,
|
||||
mainAxisAlignment: MainAxisAlignment.collapse,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
primaryLine,
|
||||
new DefaultTextStyle(
|
||||
style: secondaryTextStyle(context),
|
||||
child: secondary
|
||||
child: subtitle
|
||||
)
|
||||
]
|
||||
);
|
||||
@ -136,12 +136,12 @@ class ListItem extends StatelessWidget {
|
||||
child: center
|
||||
));
|
||||
|
||||
if (right != null) {
|
||||
if (trailing != null) {
|
||||
children.add(new Container(
|
||||
margin: new EdgeInsets.only(left: 16.0, top: iconMarginTop),
|
||||
child: new Align(
|
||||
alignment: new FractionalOffset(1.0, isThreeLine ? 0.0 : 0.5),
|
||||
child: right
|
||||
child: trailing
|
||||
)
|
||||
));
|
||||
}
|
||||
@ -153,7 +153,7 @@ class ListItem extends StatelessWidget {
|
||||
height: itemHeight,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: new Row(
|
||||
alignItems: FlexAlignItems.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: children
|
||||
)
|
||||
)
|
||||
|
@ -150,11 +150,11 @@ class _CheckedPopupMenuItemState<T> extends _PopupMenuItemState<CheckedPopupMenu
|
||||
Widget buildChild() {
|
||||
return new ListItem(
|
||||
enabled: config.enabled,
|
||||
left: new FadeTransition(
|
||||
leading: new FadeTransition(
|
||||
opacity: _opacity,
|
||||
child: new Icon(icon: _controller.isDismissed ? null : Icons.done)
|
||||
),
|
||||
primary: config.child
|
||||
title: config.child
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import 'app_bar.dart';
|
||||
import 'bottom_sheet.dart';
|
||||
import 'constants.dart';
|
||||
import 'drawer.dart';
|
||||
@ -15,7 +16,6 @@ import 'icons.dart';
|
||||
import 'icon_button.dart';
|
||||
import 'material.dart';
|
||||
import 'snack_bar.dart';
|
||||
import 'tool_bar.dart';
|
||||
|
||||
const double _kFloatingActionButtonMargin = 16.0; // TODO(hmuller): should be device dependent
|
||||
const Duration _kFloatingActionButtonSegue = const Duration(milliseconds: 400);
|
||||
@ -27,7 +27,7 @@ enum AppBarBehavior {
|
||||
|
||||
enum _ScaffoldSlot {
|
||||
body,
|
||||
toolBar,
|
||||
appBar,
|
||||
bottomSheet,
|
||||
snackBar,
|
||||
floatingActionButton,
|
||||
@ -42,18 +42,18 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
|
||||
void performLayout(Size size) {
|
||||
BoxConstraints looseConstraints = new BoxConstraints.loose(size);
|
||||
|
||||
// This part of the layout has the same effect as putting the toolbar and
|
||||
// This part of the layout has the same effect as putting the app bar and
|
||||
// body in a column and making the body flexible. What's different is that
|
||||
// in this case the toolbar appears -after- the body in the stacking order,
|
||||
// so the toolbar's shadow is drawn on top of the body.
|
||||
// in this case the app bar appears -after- the body in the stacking order,
|
||||
// so the app bar's shadow is drawn on top of the body.
|
||||
|
||||
final BoxConstraints fullWidthConstraints = looseConstraints.tighten(width: size.width);
|
||||
double contentTop = padding.top;
|
||||
double contentBottom = size.height - padding.bottom;
|
||||
|
||||
if (hasChild(_ScaffoldSlot.toolBar)) {
|
||||
contentTop = layoutChild(_ScaffoldSlot.toolBar, fullWidthConstraints).height;
|
||||
positionChild(_ScaffoldSlot.toolBar, Offset.zero);
|
||||
if (hasChild(_ScaffoldSlot.appBar)) {
|
||||
contentTop = layoutChild(_ScaffoldSlot.appBar, fullWidthConstraints).height;
|
||||
positionChild(_ScaffoldSlot.appBar, Offset.zero);
|
||||
}
|
||||
|
||||
if (hasChild(_ScaffoldSlot.body)) {
|
||||
@ -183,7 +183,7 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr
|
||||
class Scaffold extends StatefulWidget {
|
||||
Scaffold({
|
||||
Key key,
|
||||
this.toolBar,
|
||||
this.appBar,
|
||||
this.body,
|
||||
this.floatingActionButton,
|
||||
this.drawer,
|
||||
@ -192,10 +192,10 @@ class Scaffold extends StatefulWidget {
|
||||
this.appBarHeight
|
||||
}) : super(key: key) {
|
||||
assert((appBarBehavior == AppBarBehavior.scroll) ? scrollableKey != null : true);
|
||||
assert((appBarBehavior == AppBarBehavior.scroll) ? appBarHeight != null && appBarHeight > kToolBarHeight : true);
|
||||
assert((appBarBehavior == AppBarBehavior.scroll) ? appBarHeight != null && appBarHeight > kAppBarHeight : true);
|
||||
}
|
||||
|
||||
final ToolBar toolBar;
|
||||
final AppBar appBar;
|
||||
final Widget body;
|
||||
final Widget floatingActionButton;
|
||||
final Widget drawer;
|
||||
@ -375,12 +375,12 @@ class ScaffoldState extends State<Scaffold> {
|
||||
|
||||
bool _shouldShowBackArrow;
|
||||
|
||||
Widget _getModifiedToolBar({ EdgeInsets padding, double foregroundOpacity: 1.0, int elevation }) {
|
||||
ToolBar toolBar = config.toolBar;
|
||||
if (toolBar == null)
|
||||
Widget _getModifiedAppBar({ EdgeInsets padding, double foregroundOpacity: 1.0, int elevation }) {
|
||||
AppBar appBar = config.appBar;
|
||||
if (appBar == null)
|
||||
return null;
|
||||
EdgeInsets toolBarPadding = new EdgeInsets.only(top: padding.top);
|
||||
Widget left = toolBar.left;
|
||||
EdgeInsets appBarPadding = new EdgeInsets.only(top: padding.top);
|
||||
Widget left = appBar.leading;
|
||||
if (left == null) {
|
||||
if (config.drawer != null) {
|
||||
left = new IconButton(
|
||||
@ -399,9 +399,9 @@ class ScaffoldState extends State<Scaffold> {
|
||||
}
|
||||
}
|
||||
}
|
||||
return toolBar.copyWith(
|
||||
elevation: elevation ?? toolBar.elevation ?? 4,
|
||||
padding: toolBarPadding,
|
||||
return appBar.copyWith(
|
||||
elevation: elevation ?? appBar.elevation ?? 4,
|
||||
padding: appBarPadding,
|
||||
foregroundOpacity: foregroundOpacity,
|
||||
left: left
|
||||
);
|
||||
@ -421,9 +421,9 @@ class ScaffoldState extends State<Scaffold> {
|
||||
return false;
|
||||
}
|
||||
|
||||
double _toolBarOpacity(double progress) {
|
||||
// The value of progress is 1.0 if the entire (padded) toolbar is visible, 0.0
|
||||
// if the toolbar's height is zero.
|
||||
double _appBarOpacity(double progress) {
|
||||
// The value of progress is 1.0 if the entire (padded) app bar is visible, 0.0
|
||||
// if the app bar's height is zero.
|
||||
return new Tween<double>(begin: 0.0, end: 1.0).evaluate(new CurvedAnimation(
|
||||
parent: new AnimationController()..value = progress.clamp(0.0, 1.0),
|
||||
curve: new Interval(0.50, 1.0)
|
||||
@ -431,35 +431,35 @@ class ScaffoldState extends State<Scaffold> {
|
||||
}
|
||||
|
||||
Widget _buildScrollableAppBar(BuildContext context) {
|
||||
final EdgeInsets toolBarPadding = MediaQuery.of(context)?.padding ?? EdgeInsets.zero;
|
||||
final double toolBarHeight = kToolBarHeight + toolBarPadding.top;
|
||||
final EdgeInsets appBarPadding = MediaQuery.of(context)?.padding ?? EdgeInsets.zero;
|
||||
final double appBarHeight = kAppBarHeight + appBarPadding.top;
|
||||
Widget appBar;
|
||||
|
||||
if (_scrollOffset <= appBarHeight && _scrollOffset >= appBarHeight - toolBarHeight) {
|
||||
// scrolled to the top, only the toolbar is (partially) visible
|
||||
if (_scrollOffset <= appBarHeight && _scrollOffset >= appBarHeight - appBarHeight) {
|
||||
// scrolled to the top, only the app bar is (partially) visible
|
||||
final double height = math.max(_floatingAppBarHeight, appBarHeight - _scrollOffset);
|
||||
final double opacity = _toolBarOpacity(1.0 - ((toolBarHeight - height) / toolBarHeight));
|
||||
final double opacity = _appBarOpacity(1.0 - ((appBarHeight - height) / appBarHeight));
|
||||
_appBarController.value = (appBarHeight - height) / appBarHeight;
|
||||
appBar = new SizedBox(
|
||||
height: height,
|
||||
child: _getModifiedToolBar(padding: toolBarPadding, foregroundOpacity: opacity)
|
||||
child: _getModifiedAppBar(padding: appBarPadding, foregroundOpacity: opacity)
|
||||
);
|
||||
} else if (_scrollOffset > appBarHeight) {
|
||||
// scrolled down, show the "floating" toolbar
|
||||
_floatingAppBarHeight = (_floatingAppBarHeight + _scrollOffsetDelta).clamp(0.0, toolBarHeight);
|
||||
final double toolBarOpacity = _toolBarOpacity(_floatingAppBarHeight / toolBarHeight);
|
||||
// scrolled down, show the "floating" app bar
|
||||
_floatingAppBarHeight = (_floatingAppBarHeight + _scrollOffsetDelta).clamp(0.0, appBarHeight);
|
||||
final double appBarOpacity = _appBarOpacity(_floatingAppBarHeight / appBarHeight);
|
||||
_appBarController.value = (appBarHeight - _floatingAppBarHeight) / appBarHeight;
|
||||
appBar = new SizedBox(
|
||||
height: _floatingAppBarHeight,
|
||||
child: _getModifiedToolBar(padding: toolBarPadding, foregroundOpacity: toolBarOpacity)
|
||||
child: _getModifiedAppBar(padding: appBarPadding, foregroundOpacity: appBarOpacity)
|
||||
);
|
||||
} else {
|
||||
// _scrollOffset < appBarHeight - toolBarHeight, scrolled to the top, flexible space is visible
|
||||
// _scrollOffset < appBarHeight - appBarHeight, scrolled to the top, flexible space is visible
|
||||
final double height = appBarHeight - _scrollOffset.clamp(0.0, appBarHeight);
|
||||
_appBarController.value = (appBarHeight - height) / appBarHeight;
|
||||
appBar = new SizedBox(
|
||||
height: height,
|
||||
child: _getModifiedToolBar(padding: toolBarPadding, elevation: 0)
|
||||
child: _getModifiedAppBar(padding: appBarPadding, elevation: 0)
|
||||
);
|
||||
_floatingAppBarHeight = 0.0;
|
||||
}
|
||||
@ -484,13 +484,13 @@ class ScaffoldState extends State<Scaffold> {
|
||||
final List<LayoutId> children = new List<LayoutId>();
|
||||
_addIfNonNull(children, config.body, _ScaffoldSlot.body);
|
||||
if (config.appBarBehavior == AppBarBehavior.anchor) {
|
||||
Widget toolBar = new ConstrainedBox(
|
||||
child: _getModifiedToolBar(padding: padding),
|
||||
constraints: new BoxConstraints(maxHeight: config.appBarHeight ?? kExtendedToolBarHeight + padding.top)
|
||||
Widget appBar = new ConstrainedBox(
|
||||
child: _getModifiedAppBar(padding: padding),
|
||||
constraints: new BoxConstraints(maxHeight: config.appBarHeight ?? kExtendedAppBarHeight + padding.top)
|
||||
);
|
||||
_addIfNonNull(children, toolBar, _ScaffoldSlot.toolBar);
|
||||
_addIfNonNull(children, appBar, _ScaffoldSlot.appBar);
|
||||
}
|
||||
// Otherwise the ToolBar will be part of a [toolbar, body] Stack. See AppBarBehavior.scroll below.
|
||||
// Otherwise the AppBar will be part of a [app bar, body] Stack. See AppBarBehavior.scroll below.
|
||||
|
||||
if (_currentBottomSheet != null ||
|
||||
(_dismissedBottomSheets != null && _dismissedBottomSheets.isNotEmpty)) {
|
||||
|
@ -132,7 +132,7 @@ class SnackBar extends StatelessWidget {
|
||||
opacity: fadeAnimation,
|
||||
child: new Row(
|
||||
children: children,
|
||||
alignItems: FlexAlignItems.center
|
||||
crossAxisAlignment: CrossAxisAlignment.center
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -346,8 +346,8 @@ class _Tab extends StatelessWidget {
|
||||
),
|
||||
_buildLabelText()
|
||||
],
|
||||
justifyContent: FlexJustifyContent.center,
|
||||
alignItems: FlexAlignItems.center
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center
|
||||
);
|
||||
}
|
||||
|
||||
@ -1010,7 +1010,7 @@ class TabPageSelector<T> extends StatelessWidget {
|
||||
label: 'Page ${selection.index + 1} of ${selection.values.length}',
|
||||
child: new Row(
|
||||
children: selection.values.map((T tab) => _buildTabIndicator(selection, tab, animation, selectedColor, previousColor)).toList(),
|
||||
justifyContent: FlexJustifyContent.collapse
|
||||
mainAxisAlignment: MainAxisAlignment.collapse
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ class _TimePickerState extends State<TimePicker> {
|
||||
)
|
||||
)
|
||||
],
|
||||
alignItems: FlexAlignItems.stretch
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -223,12 +223,12 @@ class _TimePickerHeader extends StatelessWidget {
|
||||
child: new Text('PM', style: pmStyle)
|
||||
),
|
||||
],
|
||||
justifyContent: FlexJustifyContent.end
|
||||
mainAxisAlignment: MainAxisAlignment.end
|
||||
)
|
||||
)
|
||||
)
|
||||
],
|
||||
justifyContent: FlexJustifyContent.end
|
||||
mainAxisAlignment: MainAxisAlignment.end
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -17,18 +17,18 @@ const Duration _kExpand = const Duration(milliseconds: 200);
|
||||
class TwoLevelListItem extends StatelessWidget {
|
||||
TwoLevelListItem({
|
||||
Key key,
|
||||
this.left,
|
||||
this.center,
|
||||
this.right,
|
||||
this.leading,
|
||||
this.title,
|
||||
this.trailing,
|
||||
this.onTap,
|
||||
this.onLongPress
|
||||
}) : super(key: key) {
|
||||
assert(center != null);
|
||||
assert(title != null);
|
||||
}
|
||||
|
||||
final Widget left;
|
||||
final Widget center;
|
||||
final Widget right;
|
||||
final Widget leading;
|
||||
final Widget title;
|
||||
final Widget trailing;
|
||||
final GestureTapCallback onTap;
|
||||
final GestureLongPressCallback onLongPress;
|
||||
|
||||
@ -39,9 +39,9 @@ class TwoLevelListItem extends StatelessWidget {
|
||||
return new SizedBox(
|
||||
height: kListItemExtent[parentList.type],
|
||||
child: new ListItem(
|
||||
left: left,
|
||||
primary: center,
|
||||
right: right,
|
||||
leading: leading,
|
||||
title: title,
|
||||
trailing: trailing,
|
||||
onTap: onTap,
|
||||
onLongPress: onLongPress
|
||||
)
|
||||
@ -108,12 +108,12 @@ class _TwoLevelSublistState extends State<TwoLevelSublist> {
|
||||
children: <Widget>[
|
||||
new TwoLevelListItem(
|
||||
onTap: _handleOnTap,
|
||||
left: config.left,
|
||||
center: new DefaultTextStyle(
|
||||
leading: config.left,
|
||||
title: new DefaultTextStyle(
|
||||
style: Theme.of(context).textTheme.subhead.copyWith(color: _headerColor.evaluate(_easeInAnimation)),
|
||||
child: config.center
|
||||
),
|
||||
right: new RotationTransition(
|
||||
trailing: new RotationTransition(
|
||||
turns: _iconTurns,
|
||||
child: new Icon(
|
||||
icon: Icons.expand_more,
|
||||
|
@ -29,7 +29,7 @@ enum FlexDirection {
|
||||
}
|
||||
|
||||
/// How the children should be placed along the main axis in a flex layout
|
||||
enum FlexJustifyContent {
|
||||
enum MainAxisAlignment {
|
||||
/// Place the children as close to the start of the main axis as possible
|
||||
start,
|
||||
/// Place the children as close to the end of the main axis as possible
|
||||
@ -45,7 +45,7 @@ enum FlexJustifyContent {
|
||||
}
|
||||
|
||||
/// How the children should be placed along the cross axis in a flex layout
|
||||
enum FlexAlignItems {
|
||||
enum CrossAxisAlignment {
|
||||
/// Place the children as close to the start of the cross axis as possible
|
||||
start,
|
||||
/// Place the children as close to the end of the cross axis as possible
|
||||
@ -70,23 +70,23 @@ typedef double _ChildSizingFunction(RenderBox child, BoxConstraints constraints)
|
||||
/// children. Otherwise, the flex expands to the maximum max-axis size and the
|
||||
/// remaining space along is divided among the flexible children according to
|
||||
/// their flex factors. Any remaining free space (i.e., if there aren't any
|
||||
/// flexible children) is allocated according to the [justifyContent] property.
|
||||
/// flexible children) is allocated according to the [mainAxisAlignment] property.
|
||||
///
|
||||
/// In the cross axis, children determine their own size. The flex then sizes
|
||||
/// its cross axis to fix the largest of its children. The children are then
|
||||
/// positioned along the cross axis according to the [alignItems] property.
|
||||
/// positioned along the cross axis according to the [crossAxisAlignment] property.
|
||||
class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, FlexParentData>,
|
||||
RenderBoxContainerDefaultsMixin<RenderBox, FlexParentData> {
|
||||
|
||||
RenderFlex({
|
||||
List<RenderBox> children,
|
||||
FlexDirection direction: FlexDirection.horizontal,
|
||||
FlexJustifyContent justifyContent: FlexJustifyContent.start,
|
||||
FlexAlignItems alignItems: FlexAlignItems.center,
|
||||
MainAxisAlignment mainAxisAlignment: MainAxisAlignment.start,
|
||||
CrossAxisAlignment crossAxisAlignment: CrossAxisAlignment.center,
|
||||
TextBaseline textBaseline
|
||||
}) : _direction = direction,
|
||||
_justifyContent = justifyContent,
|
||||
_alignItems = alignItems,
|
||||
_mainAxisAlignment = mainAxisAlignment,
|
||||
_crossAxisAlignment = crossAxisAlignment,
|
||||
_textBaseline = textBaseline {
|
||||
addAll(children);
|
||||
}
|
||||
@ -102,21 +102,21 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
||||
}
|
||||
|
||||
/// How the children should be placed along the main axis
|
||||
FlexJustifyContent get justifyContent => _justifyContent;
|
||||
FlexJustifyContent _justifyContent;
|
||||
void set justifyContent (FlexJustifyContent value) {
|
||||
if (_justifyContent != value) {
|
||||
_justifyContent = value;
|
||||
MainAxisAlignment get mainAxisAlignment => _mainAxisAlignment;
|
||||
MainAxisAlignment _mainAxisAlignment;
|
||||
void set mainAxisAlignment (MainAxisAlignment value) {
|
||||
if (_mainAxisAlignment != value) {
|
||||
_mainAxisAlignment = value;
|
||||
markNeedsLayout();
|
||||
}
|
||||
}
|
||||
|
||||
/// How the children should be placed along the cross axis
|
||||
FlexAlignItems get alignItems => _alignItems;
|
||||
FlexAlignItems _alignItems;
|
||||
void set alignItems (FlexAlignItems value) {
|
||||
if (_alignItems != value) {
|
||||
_alignItems = value;
|
||||
CrossAxisAlignment get crossAxisAlignment => _crossAxisAlignment;
|
||||
CrossAxisAlignment _crossAxisAlignment;
|
||||
void set crossAxisAlignment (CrossAxisAlignment value) {
|
||||
if (_crossAxisAlignment != value) {
|
||||
_crossAxisAlignment = value;
|
||||
markNeedsLayout();
|
||||
}
|
||||
}
|
||||
@ -336,7 +336,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
||||
int totalChildren = 0;
|
||||
assert(constraints != null);
|
||||
final double mainSize = (_direction == FlexDirection.horizontal) ? constraints.constrainWidth() : constraints.constrainHeight();
|
||||
final bool canFlex = mainSize < double.INFINITY && justifyContent != FlexJustifyContent.collapse;
|
||||
final bool canFlex = mainSize < double.INFINITY && mainAxisAlignment != MainAxisAlignment.collapse;
|
||||
double crossSize = 0.0; // This is determined as we lay out the children
|
||||
double freeSpace = canFlex ? mainSize : 0.0;
|
||||
RenderBox child = firstChild;
|
||||
@ -352,7 +352,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
||||
totalFlex += childParentData.flex;
|
||||
} else {
|
||||
BoxConstraints innerConstraints;
|
||||
if (alignItems == FlexAlignItems.stretch) {
|
||||
if (crossAxisAlignment == CrossAxisAlignment.stretch) {
|
||||
switch (_direction) {
|
||||
case FlexDirection.horizontal:
|
||||
innerConstraints = new BoxConstraints(minHeight: constraints.maxHeight,
|
||||
@ -386,7 +386,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
||||
// Distribute remaining space to flexible children, and determine baseline.
|
||||
double maxBaselineDistance = 0.0;
|
||||
double usedSpace = 0.0;
|
||||
if (totalFlex > 0 || alignItems == FlexAlignItems.baseline) {
|
||||
if (totalFlex > 0 || crossAxisAlignment == CrossAxisAlignment.baseline) {
|
||||
double spacePerFlex = totalFlex > 0 ? (freeSpace / totalFlex) : 0.0;
|
||||
child = firstChild;
|
||||
while (child != null) {
|
||||
@ -394,7 +394,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
||||
if (flex > 0) {
|
||||
double spaceForChild = spacePerFlex * flex;
|
||||
BoxConstraints innerConstraints;
|
||||
if (alignItems == FlexAlignItems.stretch) {
|
||||
if (crossAxisAlignment == CrossAxisAlignment.stretch) {
|
||||
switch (_direction) {
|
||||
case FlexDirection.horizontal:
|
||||
innerConstraints = new BoxConstraints(minWidth: spaceForChild,
|
||||
@ -427,7 +427,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
||||
usedSpace += _getMainSize(child);
|
||||
crossSize = math.max(crossSize, _getCrossSize(child));
|
||||
}
|
||||
if (alignItems == FlexAlignItems.baseline) {
|
||||
if (crossAxisAlignment == CrossAxisAlignment.baseline) {
|
||||
assert(textBaseline != null && 'To use FlexAlignItems.baseline, you must also specify which baseline to use using the "baseline" argument.' is String);
|
||||
double distance = child.getDistanceToBaseline(textBaseline, onlyReal: true);
|
||||
if (distance != null)
|
||||
@ -473,25 +473,25 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
||||
}
|
||||
_overflow = 0.0;
|
||||
}
|
||||
switch (_justifyContent) {
|
||||
case FlexJustifyContent.start:
|
||||
case FlexJustifyContent.collapse:
|
||||
switch (_mainAxisAlignment) {
|
||||
case MainAxisAlignment.start:
|
||||
case MainAxisAlignment.collapse:
|
||||
leadingSpace = 0.0;
|
||||
betweenSpace = 0.0;
|
||||
break;
|
||||
case FlexJustifyContent.end:
|
||||
case MainAxisAlignment.end:
|
||||
leadingSpace = remainingSpace;
|
||||
betweenSpace = 0.0;
|
||||
break;
|
||||
case FlexJustifyContent.center:
|
||||
case MainAxisAlignment.center:
|
||||
leadingSpace = remainingSpace / 2.0;
|
||||
betweenSpace = 0.0;
|
||||
break;
|
||||
case FlexJustifyContent.spaceBetween:
|
||||
case MainAxisAlignment.spaceBetween:
|
||||
leadingSpace = 0.0;
|
||||
betweenSpace = totalChildren > 1 ? remainingSpace / (totalChildren - 1) : 0.0;
|
||||
break;
|
||||
case FlexJustifyContent.spaceAround:
|
||||
case MainAxisAlignment.spaceAround:
|
||||
betweenSpace = totalChildren > 0 ? remainingSpace / totalChildren : 0.0;
|
||||
leadingSpace = betweenSpace / 2.0;
|
||||
break;
|
||||
@ -503,18 +503,18 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
||||
while (child != null) {
|
||||
final FlexParentData childParentData = child.parentData;
|
||||
double childCrossPosition;
|
||||
switch (_alignItems) {
|
||||
case FlexAlignItems.stretch:
|
||||
case FlexAlignItems.start:
|
||||
switch (_crossAxisAlignment) {
|
||||
case CrossAxisAlignment.stretch:
|
||||
case CrossAxisAlignment.start:
|
||||
childCrossPosition = 0.0;
|
||||
break;
|
||||
case FlexAlignItems.end:
|
||||
case CrossAxisAlignment.end:
|
||||
childCrossPosition = crossSize - _getCrossSize(child);
|
||||
break;
|
||||
case FlexAlignItems.center:
|
||||
case CrossAxisAlignment.center:
|
||||
childCrossPosition = crossSize / 2.0 - _getCrossSize(child) / 2.0;
|
||||
break;
|
||||
case FlexAlignItems.baseline:
|
||||
case CrossAxisAlignment.baseline:
|
||||
childCrossPosition = 0.0;
|
||||
if (_direction == FlexDirection.horizontal) {
|
||||
assert(textBaseline != null);
|
||||
@ -595,8 +595,8 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
||||
void debugFillDescription(List<String> description) {
|
||||
super.debugFillDescription(description);
|
||||
description.add('direction: $_direction');
|
||||
description.add('justifyContent: $_justifyContent');
|
||||
description.add('alignItems: $_alignItems');
|
||||
description.add('mainAxisAlignment: $_mainAxisAlignment');
|
||||
description.add('crossAxisAlignment: $_crossAxisAlignment');
|
||||
description.add('textBaseline: $_textBaseline');
|
||||
}
|
||||
|
||||
|
@ -28,12 +28,6 @@ AssetBundle _initDefaultBundle() {
|
||||
|
||||
final AssetBundle _defaultBundle = _initDefaultBundle();
|
||||
|
||||
class RouteArguments {
|
||||
const RouteArguments({ this.context });
|
||||
final BuildContext context;
|
||||
}
|
||||
typedef Widget RouteBuilder(RouteArguments args);
|
||||
|
||||
typedef Future<LocaleQueryData> LocaleChangedCallback(Locale locale);
|
||||
|
||||
class WidgetsApp extends StatefulWidget {
|
||||
@ -42,7 +36,7 @@ class WidgetsApp extends StatefulWidget {
|
||||
this.title,
|
||||
this.textStyle,
|
||||
this.color,
|
||||
this.routes: const <String, RouteBuilder>{},
|
||||
this.routes: const <String, WidgetBuilder>{},
|
||||
this.onGenerateRoute,
|
||||
this.onLocaleChanged,
|
||||
this.showPerformanceOverlay: false,
|
||||
@ -72,7 +66,7 @@ class WidgetsApp extends StatefulWidget {
|
||||
/// [Navigator] is given a named route, the name will be looked up
|
||||
/// in this table first. If the name is not available, then
|
||||
/// [onGenerateRoute] will be called instead.
|
||||
final Map<String, RouteBuilder> routes;
|
||||
final Map<String, WidgetBuilder> routes;
|
||||
|
||||
/// The route generator callback used when the app is navigated to a
|
||||
/// named route but the name is not in the [routes] table.
|
||||
|
@ -17,9 +17,9 @@ export 'package:flutter/rendering.dart' show
|
||||
CustomClipper,
|
||||
CustomPainter,
|
||||
FixedColumnCountGridDelegate,
|
||||
FlexAlignItems,
|
||||
CrossAxisAlignment,
|
||||
FlexDirection,
|
||||
FlexJustifyContent,
|
||||
MainAxisAlignment,
|
||||
FractionalOffsetTween,
|
||||
GridDelegate,
|
||||
GridDelegateWithInOrderChildPlacement,
|
||||
@ -1355,27 +1355,27 @@ class Flex extends MultiChildRenderObjectWidget {
|
||||
Key key,
|
||||
List<Widget> children: _emptyWidgetList,
|
||||
this.direction: FlexDirection.horizontal,
|
||||
this.justifyContent: FlexJustifyContent.start,
|
||||
this.alignItems: FlexAlignItems.center,
|
||||
this.mainAxisAlignment: MainAxisAlignment.start,
|
||||
this.crossAxisAlignment: CrossAxisAlignment.center,
|
||||
this.textBaseline
|
||||
}) : super(key: key, children: children) {
|
||||
assert(direction != null);
|
||||
assert(justifyContent != null);
|
||||
assert(alignItems != null);
|
||||
assert(mainAxisAlignment != null);
|
||||
assert(crossAxisAlignment != null);
|
||||
}
|
||||
|
||||
final FlexDirection direction;
|
||||
final FlexJustifyContent justifyContent;
|
||||
final FlexAlignItems alignItems;
|
||||
final MainAxisAlignment mainAxisAlignment;
|
||||
final CrossAxisAlignment crossAxisAlignment;
|
||||
final TextBaseline textBaseline;
|
||||
|
||||
RenderFlex createRenderObject(BuildContext context) => new RenderFlex(direction: direction, justifyContent: justifyContent, alignItems: alignItems, textBaseline: textBaseline);
|
||||
RenderFlex createRenderObject(BuildContext context) => new RenderFlex(direction: direction, mainAxisAlignment: mainAxisAlignment, crossAxisAlignment: crossAxisAlignment, textBaseline: textBaseline);
|
||||
|
||||
void updateRenderObject(BuildContext context, RenderFlex renderObject) {
|
||||
renderObject
|
||||
..direction = direction
|
||||
..justifyContent = justifyContent
|
||||
..alignItems = alignItems
|
||||
..mainAxisAlignment = mainAxisAlignment
|
||||
..crossAxisAlignment = crossAxisAlignment
|
||||
..textBaseline = textBaseline;
|
||||
}
|
||||
}
|
||||
@ -1388,15 +1388,15 @@ class Row extends Flex {
|
||||
Row({
|
||||
Key key,
|
||||
List<Widget> children: _emptyWidgetList,
|
||||
FlexJustifyContent justifyContent: FlexJustifyContent.start,
|
||||
FlexAlignItems alignItems: FlexAlignItems.center,
|
||||
MainAxisAlignment mainAxisAlignment: MainAxisAlignment.start,
|
||||
CrossAxisAlignment crossAxisAlignment: CrossAxisAlignment.center,
|
||||
TextBaseline textBaseline
|
||||
}) : super(
|
||||
children: children,
|
||||
key: key,
|
||||
direction: FlexDirection.horizontal,
|
||||
justifyContent: justifyContent,
|
||||
alignItems: alignItems,
|
||||
mainAxisAlignment: mainAxisAlignment,
|
||||
crossAxisAlignment: crossAxisAlignment,
|
||||
textBaseline: textBaseline
|
||||
);
|
||||
}
|
||||
@ -1409,15 +1409,15 @@ class Column extends Flex {
|
||||
Column({
|
||||
Key key,
|
||||
List<Widget> children: _emptyWidgetList,
|
||||
FlexJustifyContent justifyContent: FlexJustifyContent.start,
|
||||
FlexAlignItems alignItems: FlexAlignItems.center,
|
||||
MainAxisAlignment mainAxisAlignment: MainAxisAlignment.start,
|
||||
CrossAxisAlignment crossAxisAlignment: CrossAxisAlignment.center,
|
||||
TextBaseline textBaseline
|
||||
}) : super(
|
||||
children: children,
|
||||
key: key,
|
||||
direction: FlexDirection.vertical,
|
||||
justifyContent: justifyContent,
|
||||
alignItems: alignItems,
|
||||
mainAxisAlignment: mainAxisAlignment,
|
||||
crossAxisAlignment: crossAxisAlignment,
|
||||
textBaseline: textBaseline
|
||||
);
|
||||
}
|
||||
|
@ -25,11 +25,13 @@ enum DismissDirection {
|
||||
/// The [Dismissable] can be dismissed by dragging either left or right.
|
||||
horizontal,
|
||||
|
||||
/// The [Dismissable] can be dismissed by dragging left only.
|
||||
left,
|
||||
/// The [Dismissable] can be dismissed by dragging in the reverse of the
|
||||
/// reading direction (e.g., from right to left in left-to-right languages).
|
||||
endToStart,
|
||||
|
||||
/// The [Dismissable] can be dismissed by dragging right only.
|
||||
right,
|
||||
/// The [Dismissable] can be dismissed by dragging in the reading direction
|
||||
/// (e.g., from left to right in left-to-right languages).
|
||||
startToEnd,
|
||||
|
||||
/// The [Dismissable] can be dismissed by dragging up only.
|
||||
up,
|
||||
@ -115,13 +117,13 @@ class _DismissableState extends State<Dismissable> {
|
||||
|
||||
bool get _directionIsXAxis {
|
||||
return config.direction == DismissDirection.horizontal
|
||||
|| config.direction == DismissDirection.left
|
||||
|| config.direction == DismissDirection.right;
|
||||
|| config.direction == DismissDirection.endToStart
|
||||
|| config.direction == DismissDirection.startToEnd;
|
||||
}
|
||||
|
||||
DismissDirection get _dismissDirection {
|
||||
if (_directionIsXAxis)
|
||||
return _dragExtent > 0 ? DismissDirection.right : DismissDirection.left;
|
||||
return _dragExtent > 0 ? DismissDirection.startToEnd : DismissDirection.endToStart;
|
||||
return _dragExtent > 0 ? DismissDirection.down : DismissDirection.up;
|
||||
}
|
||||
|
||||
@ -162,13 +164,13 @@ class _DismissableState extends State<Dismissable> {
|
||||
break;
|
||||
|
||||
case DismissDirection.up:
|
||||
case DismissDirection.left:
|
||||
case DismissDirection.endToStart:
|
||||
if (_dragExtent + delta < 0)
|
||||
_dragExtent += delta;
|
||||
break;
|
||||
|
||||
case DismissDirection.down:
|
||||
case DismissDirection.right:
|
||||
case DismissDirection.startToEnd:
|
||||
if (_dragExtent + delta > 0)
|
||||
_dragExtent += delta;
|
||||
break;
|
||||
@ -201,7 +203,7 @@ class _DismissableState extends State<Dismissable> {
|
||||
switch(config.direction) {
|
||||
case DismissDirection.horizontal:
|
||||
return vx.abs() > _kMinFlingVelocity;
|
||||
case DismissDirection.left:
|
||||
case DismissDirection.endToStart:
|
||||
return -vx > _kMinFlingVelocity;
|
||||
default:
|
||||
return vx > _kMinFlingVelocity;
|
||||
@ -275,7 +277,7 @@ class _DismissableState extends State<Dismissable> {
|
||||
Widget background = config.background;
|
||||
if (config.secondaryBackground != null) {
|
||||
final DismissDirection direction = _dismissDirection;
|
||||
if (direction == DismissDirection.left || direction == DismissDirection.up)
|
||||
if (direction == DismissDirection.endToStart || direction == DismissDirection.up)
|
||||
background = config.secondaryBackground;
|
||||
}
|
||||
|
||||
|
@ -12,10 +12,10 @@ import 'scroll_behavior.dart';
|
||||
import 'scrollable.dart';
|
||||
import 'virtual_viewport.dart';
|
||||
|
||||
/// Controls what alignment items use when settling.
|
||||
enum ItemsSnapAlignment {
|
||||
item,
|
||||
adjacentItem
|
||||
/// Controls how a pageable list should behave during a fling.
|
||||
enum PageableListFlingBehavior {
|
||||
canFlingAcrossMultiplePages,
|
||||
stopAtNextPage
|
||||
}
|
||||
|
||||
/// Scrollable widget that scrolls one "page" at a time.
|
||||
@ -33,7 +33,7 @@ class PageableList extends Scrollable {
|
||||
ScrollListener onScrollEnd,
|
||||
SnapOffsetCallback snapOffsetCallback,
|
||||
this.itemsWrap: false,
|
||||
this.itemsSnapAlignment: ItemsSnapAlignment.adjacentItem,
|
||||
this.itemsSnapAlignment: PageableListFlingBehavior.stopAtNextPage,
|
||||
this.onPageChanged,
|
||||
this.scrollableListPainter,
|
||||
this.duration: const Duration(milliseconds: 200),
|
||||
@ -48,13 +48,15 @@ class PageableList extends Scrollable {
|
||||
onScroll: onScroll,
|
||||
onScrollEnd: onScrollEnd,
|
||||
snapOffsetCallback: snapOffsetCallback
|
||||
);
|
||||
) {
|
||||
assert(itemsSnapAlignment != null);
|
||||
}
|
||||
|
||||
/// Whether the first item should be revealed after scrolling past the last item.
|
||||
final bool itemsWrap;
|
||||
|
||||
/// Controls whether a fling always reveals the adjacent item or whether flings can traverse many items.
|
||||
final ItemsSnapAlignment itemsSnapAlignment;
|
||||
final PageableListFlingBehavior itemsSnapAlignment;
|
||||
|
||||
/// Called when the currently visible page changes.
|
||||
final ValueChanged<int> onPageChanged;
|
||||
@ -187,7 +189,7 @@ class PageableListState<T extends PageableList> extends ScrollableState<T> {
|
||||
|
||||
ScrollBehavior<double, double> createScrollBehavior() => scrollBehavior;
|
||||
|
||||
bool get shouldSnapScrollOffset => config.itemsSnapAlignment == ItemsSnapAlignment.item;
|
||||
bool get shouldSnapScrollOffset => config.itemsSnapAlignment == PageableListFlingBehavior.canFlingAcrossMultiplePages;
|
||||
|
||||
double snapScrollOffset(double newScrollOffset) {
|
||||
final double previousItemOffset = newScrollOffset.floorToDouble();
|
||||
@ -205,10 +207,10 @@ class PageableListState<T extends PageableList> extends ScrollableState<T> {
|
||||
|
||||
Future<Null> fling(double scrollVelocity) {
|
||||
switch(config.itemsSnapAlignment) {
|
||||
case ItemsSnapAlignment.adjacentItem:
|
||||
return _flingToAdjacentItem(scrollVelocity);
|
||||
default:
|
||||
case PageableListFlingBehavior.canFlingAcrossMultiplePages:
|
||||
return super.fling(scrollVelocity).then(_notifyPageChanged);
|
||||
case PageableListFlingBehavior.stopAtNextPage:
|
||||
return _flingToAdjacentItem(scrollVelocity);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ void main() {
|
||||
RenderBox flex = new RenderFlex(
|
||||
children: <RenderBox>[padding],
|
||||
direction: FlexDirection.vertical,
|
||||
alignItems: FlexAlignItems.stretch
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch
|
||||
);
|
||||
RenderBox outer = new RenderDecoratedBox(
|
||||
decoration: new BoxDecoration(
|
||||
|
@ -80,7 +80,7 @@ void main() {
|
||||
|
||||
test('Defaults', () {
|
||||
RenderFlex flex = new RenderFlex();
|
||||
expect(flex.alignItems, equals(FlexAlignItems.center));
|
||||
expect(flex.crossAxisAlignment, equals(CrossAxisAlignment.center));
|
||||
expect(flex.direction, equals(FlexDirection.horizontal));
|
||||
});
|
||||
|
||||
@ -122,7 +122,7 @@ void main() {
|
||||
expect(box2.size.width, equals(100.0));
|
||||
expect(box2.size.height, equals(0.0));
|
||||
|
||||
flex.alignItems = FlexAlignItems.stretch;
|
||||
flex.crossAxisAlignment = CrossAxisAlignment.stretch;
|
||||
pumpFrame();
|
||||
expect(box1.size.width, equals(0.0));
|
||||
expect(box1.size.height, equals(100.0));
|
||||
|
@ -14,8 +14,8 @@ void main() {
|
||||
int buildCount = 0;
|
||||
|
||||
tester.pumpWidget(new MaterialApp(
|
||||
routes: <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) {
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) {
|
||||
return new Scaffold(
|
||||
key: scaffoldKey,
|
||||
body: new Center(child: new Text('body'))
|
||||
|
@ -14,9 +14,9 @@ void main() {
|
||||
bool showBottomSheetThenCalled = false;
|
||||
|
||||
tester.pumpWidget(new MaterialApp(
|
||||
routes: <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) {
|
||||
context = args.context;
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext ctx) {
|
||||
context = ctx;
|
||||
return new Container();
|
||||
}
|
||||
}
|
||||
@ -66,8 +66,8 @@ void main() {
|
||||
bool showBottomSheetThenCalled = false;
|
||||
|
||||
tester.pumpWidget(new MaterialApp(
|
||||
routes: <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) {
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) {
|
||||
return new Scaffold(
|
||||
key: scaffoldKey,
|
||||
body: new Center(child: new Text('body'))
|
||||
|
@ -58,13 +58,13 @@ void dismissElement(WidgetTester tester, Element itemElement, { DismissDirection
|
||||
Point downLocation;
|
||||
Point upLocation;
|
||||
switch(gestureDirection) {
|
||||
case DismissDirection.left:
|
||||
case DismissDirection.endToStart:
|
||||
// getTopRight() returns a point that's just beyond itemWidget's right
|
||||
// edge and outside the Dismissable event listener's bounds.
|
||||
downLocation = tester.getTopRight(itemElement) + const Offset(-0.1, 0.0);
|
||||
upLocation = tester.getTopLeft(itemElement);
|
||||
break;
|
||||
case DismissDirection.right:
|
||||
case DismissDirection.startToEnd:
|
||||
// we do the same thing here to keep the test symmetric
|
||||
downLocation = tester.getTopLeft(itemElement) + const Offset(0.1, 0.0);
|
||||
upLocation = tester.getTopRight(itemElement);
|
||||
@ -129,15 +129,15 @@ void main() {
|
||||
tester.pumpWidget(widgetBuilder());
|
||||
expect(dismissedItems, isEmpty);
|
||||
|
||||
dismissItem(tester, 0, gestureDirection: DismissDirection.right);
|
||||
dismissItem(tester, 0, gestureDirection: DismissDirection.startToEnd);
|
||||
expect(tester.findText('0'), isNull);
|
||||
expect(dismissedItems, equals([0]));
|
||||
expect(reportedDismissDirection, DismissDirection.right);
|
||||
expect(reportedDismissDirection, DismissDirection.startToEnd);
|
||||
|
||||
dismissItem(tester, 1, gestureDirection: DismissDirection.left);
|
||||
dismissItem(tester, 1, gestureDirection: DismissDirection.endToStart);
|
||||
expect(tester.findText('1'), isNull);
|
||||
expect(dismissedItems, equals([0, 1]));
|
||||
expect(reportedDismissDirection, DismissDirection.left);
|
||||
expect(reportedDismissDirection, DismissDirection.endToStart);
|
||||
});
|
||||
});
|
||||
|
||||
@ -165,38 +165,38 @@ void main() {
|
||||
test('drag-left with DismissDirection.left triggers dismiss', () {
|
||||
testWidgets((WidgetTester tester) {
|
||||
scrollDirection = Axis.vertical;
|
||||
dismissDirection = DismissDirection.left;
|
||||
dismissDirection = DismissDirection.endToStart;
|
||||
dismissedItems = <int>[];
|
||||
|
||||
tester.pumpWidget(widgetBuilder());
|
||||
expect(dismissedItems, isEmpty);
|
||||
|
||||
dismissItem(tester, 0, gestureDirection: DismissDirection.right);
|
||||
dismissItem(tester, 0, gestureDirection: DismissDirection.startToEnd);
|
||||
expect(tester.findText('0'), isNotNull);
|
||||
expect(dismissedItems, isEmpty);
|
||||
dismissItem(tester, 1, gestureDirection: DismissDirection.right);
|
||||
dismissItem(tester, 1, gestureDirection: DismissDirection.startToEnd);
|
||||
|
||||
dismissItem(tester, 0, gestureDirection: DismissDirection.left);
|
||||
dismissItem(tester, 0, gestureDirection: DismissDirection.endToStart);
|
||||
expect(tester.findText('0'), isNull);
|
||||
expect(dismissedItems, equals([0]));
|
||||
dismissItem(tester, 1, gestureDirection: DismissDirection.left);
|
||||
dismissItem(tester, 1, gestureDirection: DismissDirection.endToStart);
|
||||
});
|
||||
});
|
||||
|
||||
test('drag-right with DismissDirection.right triggers dismiss', () {
|
||||
testWidgets((WidgetTester tester) {
|
||||
scrollDirection = Axis.vertical;
|
||||
dismissDirection = DismissDirection.right;
|
||||
dismissDirection = DismissDirection.startToEnd;
|
||||
dismissedItems = <int>[];
|
||||
|
||||
tester.pumpWidget(widgetBuilder());
|
||||
expect(dismissedItems, isEmpty);
|
||||
|
||||
dismissItem(tester, 0, gestureDirection: DismissDirection.left);
|
||||
dismissItem(tester, 0, gestureDirection: DismissDirection.endToStart);
|
||||
expect(tester.findText('0'), isNotNull);
|
||||
expect(dismissedItems, isEmpty);
|
||||
|
||||
dismissItem(tester, 0, gestureDirection: DismissDirection.right);
|
||||
dismissItem(tester, 0, gestureDirection: DismissDirection.startToEnd);
|
||||
expect(tester.findText('0'), isNull);
|
||||
expect(dismissedItems, equals([0]));
|
||||
});
|
||||
@ -292,12 +292,12 @@ void main() {
|
||||
));
|
||||
expect(tester.findText('1'), isNotNull);
|
||||
expect(tester.findText('2'), isNotNull);
|
||||
dismissElement(tester, tester.findText('2'), gestureDirection: DismissDirection.right);
|
||||
dismissElement(tester, tester.findText('2'), gestureDirection: DismissDirection.startToEnd);
|
||||
tester.pump(); // start the slide away
|
||||
tester.pump(new Duration(seconds: 1)); // finish the slide away
|
||||
expect(tester.findText('1'), isNotNull);
|
||||
expect(tester.findText('2'), isNull);
|
||||
dismissElement(tester, tester.findText('1'), gestureDirection: DismissDirection.right);
|
||||
dismissElement(tester, tester.findText('1'), gestureDirection: DismissDirection.startToEnd);
|
||||
tester.pump(); // start the slide away
|
||||
tester.pump(new Duration(seconds: 1)); // finish the slide away (at which point the child is no longer included in the tree)
|
||||
expect(tester.findText('1'), isNull);
|
||||
|
@ -12,8 +12,8 @@ void main() {
|
||||
List<dynamic> accepted = <dynamic>[];
|
||||
|
||||
tester.pumpWidget(new MaterialApp(
|
||||
routes: <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) { return new Column(
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) { return new Column(
|
||||
children: <Widget>[
|
||||
new Draggable<int>(
|
||||
data: 1,
|
||||
@ -75,8 +75,8 @@ void main() {
|
||||
Point firstLocation, secondLocation;
|
||||
|
||||
tester.pumpWidget(new MaterialApp(
|
||||
routes: <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) { return new Column(
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) { return new Column(
|
||||
children: <Widget>[
|
||||
new Draggable<int>(
|
||||
data: 1,
|
||||
@ -173,8 +173,8 @@ void main() {
|
||||
Point firstLocation, secondLocation;
|
||||
|
||||
tester.pumpWidget(new MaterialApp(
|
||||
routes: <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) { return new Column(
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) { return new Column(
|
||||
children: <Widget>[
|
||||
new Draggable<int>(
|
||||
data: 1,
|
||||
@ -234,8 +234,8 @@ void main() {
|
||||
Point firstLocation, secondLocation;
|
||||
|
||||
tester.pumpWidget(new MaterialApp(
|
||||
routes: <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) { return new Column(
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) { return new Column(
|
||||
children: <Widget>[
|
||||
new LongPressDraggable<int>(
|
||||
data: 1,
|
||||
@ -285,8 +285,8 @@ void main() {
|
||||
Point firstLocation, secondLocation;
|
||||
|
||||
tester.pumpWidget(new MaterialApp(
|
||||
routes: <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) { return new Column(
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) { return new Column(
|
||||
children: <Widget>[
|
||||
new Draggable<int>(
|
||||
data: 1,
|
||||
@ -337,8 +337,8 @@ void main() {
|
||||
Point firstLocation, secondLocation, thirdLocation;
|
||||
|
||||
tester.pumpWidget(new MaterialApp(
|
||||
routes: <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) {
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) {
|
||||
return new Block(
|
||||
children: <Widget>[
|
||||
new DragTarget<int>(
|
||||
@ -448,8 +448,8 @@ void main() {
|
||||
Point firstLocation, secondLocation, thirdLocation;
|
||||
|
||||
tester.pumpWidget(new MaterialApp(
|
||||
routes: <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) {
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) {
|
||||
return new Block(
|
||||
scrollDirection: Axis.horizontal,
|
||||
children: <Widget>[
|
||||
|
@ -15,9 +15,9 @@ void main() {
|
||||
BuildContext context;
|
||||
tester.pumpWidget(
|
||||
new MaterialApp(
|
||||
routes: <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) {
|
||||
context = args.context;
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext ctx) {
|
||||
context = ctx;
|
||||
return new Scaffold(
|
||||
key: scaffoldKey,
|
||||
drawer: new Text('drawer'),
|
||||
@ -48,8 +48,8 @@ void main() {
|
||||
tester.pumpWidget(new Container()); // throw away the old App and its Navigator
|
||||
tester.pumpWidget(
|
||||
new MaterialApp(
|
||||
routes: <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) {
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) {
|
||||
return new Scaffold(
|
||||
key: scaffoldKey,
|
||||
drawer: new Text('drawer'),
|
||||
|
@ -54,7 +54,7 @@ void main() {
|
||||
test('Row, Column and FlexJustifyContent.collapse', () {
|
||||
final Key flexKey = new Key('flexKey');
|
||||
|
||||
// Row without justifyContent: FlexJustifyContent.collapse
|
||||
// Row without mainAxisAlignment: FlexJustifyContent.collapse
|
||||
testWidgets((WidgetTester tester) {
|
||||
tester.pumpWidget(new Center(
|
||||
child: new Row(
|
||||
@ -69,7 +69,7 @@ void main() {
|
||||
expect(renderBox.size.width, equals(800.0));
|
||||
expect(renderBox.size.height, equals(100.0));
|
||||
|
||||
// Row with justifyContent: FlexJustifyContent.collapse
|
||||
// Row with mainAxisAlignment: FlexJustifyContent.collapse
|
||||
tester.pumpWidget(new Center(
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
@ -77,7 +77,7 @@ void main() {
|
||||
new Container(width: 30.0, height: 100.0)
|
||||
],
|
||||
key: flexKey,
|
||||
justifyContent: FlexJustifyContent.collapse
|
||||
mainAxisAlignment: MainAxisAlignment.collapse
|
||||
)
|
||||
));
|
||||
renderBox = tester.findElementByKey(flexKey).renderObject;
|
||||
@ -85,7 +85,7 @@ void main() {
|
||||
expect(renderBox.size.height, equals(100.0));
|
||||
});
|
||||
|
||||
// Column without justifyContent: FlexJustifyContent.collapse
|
||||
// Column without mainAxisAlignment: FlexJustifyContent.collapse
|
||||
testWidgets((WidgetTester tester) {
|
||||
tester.pumpWidget(new Center(
|
||||
child: new Column(
|
||||
@ -100,7 +100,7 @@ void main() {
|
||||
expect(renderBox.size.width, equals(100.0));
|
||||
expect(renderBox.size.height, equals(600.0));
|
||||
|
||||
// Column with justifyContent: FlexJustifyContent.collapse
|
||||
// Column with mainAxisAlignment: FlexJustifyContent.collapse
|
||||
tester.pumpWidget(new Center(
|
||||
child: new Column(
|
||||
children: <Widget>[
|
||||
@ -108,7 +108,7 @@ void main() {
|
||||
new Container(width: 100.0, height: 150.0)
|
||||
],
|
||||
key: flexKey,
|
||||
justifyContent: FlexJustifyContent.collapse
|
||||
mainAxisAlignment: MainAxisAlignment.collapse
|
||||
)
|
||||
));
|
||||
renderBox = tester.findElementByKey(flexKey).renderObject;
|
||||
@ -133,7 +133,7 @@ void main() {
|
||||
height: 100.0
|
||||
)
|
||||
],
|
||||
justifyContent: FlexJustifyContent.collapse
|
||||
mainAxisAlignment: MainAxisAlignment.collapse
|
||||
)
|
||||
)
|
||||
));
|
||||
@ -154,7 +154,7 @@ void main() {
|
||||
height: 100.0
|
||||
)
|
||||
],
|
||||
justifyContent: FlexJustifyContent.collapse
|
||||
mainAxisAlignment: MainAxisAlignment.collapse
|
||||
)
|
||||
)
|
||||
));
|
||||
|
@ -12,21 +12,21 @@ Key firstKey = new Key('first');
|
||||
Key secondKey = new Key('second');
|
||||
Key thirdKey = new Key('third');
|
||||
|
||||
final Map<String, RouteBuilder> routes = <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) => new Material(
|
||||
final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) => new Material(
|
||||
child: new Block(children: <Widget>[
|
||||
new Container(height: 100.0, width: 100.0),
|
||||
new Card(child: new Hero(tag: 'a', child: new Container(height: 100.0, width: 100.0, key: firstKey))),
|
||||
new Container(height: 100.0, width: 100.0),
|
||||
new FlatButton(child: new Text('two'), onPressed: () => Navigator.pushNamed(args.context, '/two')),
|
||||
new FlatButton(child: new Text('two'), onPressed: () => Navigator.pushNamed(context, '/two')),
|
||||
])
|
||||
),
|
||||
'/two': (RouteArguments args) => new Material(
|
||||
'/two': (BuildContext context) => new Material(
|
||||
child: new Block(children: <Widget>[
|
||||
new Container(height: 150.0, width: 150.0),
|
||||
new Card(child: new Hero(tag: 'a', child: new Container(height: 150.0, width: 150.0, key: secondKey))),
|
||||
new Container(height: 150.0, width: 150.0),
|
||||
new FlatButton(child: new Text('three'), onPressed: () => Navigator.push(args.context, new ThreeRoute())),
|
||||
new FlatButton(child: new Text('three'), onPressed: () => Navigator.push(context, new ThreeRoute())),
|
||||
])
|
||||
),
|
||||
};
|
||||
|
@ -61,9 +61,9 @@ void main() {
|
||||
|
||||
test('ModalBarrier pops the Navigator when dismissed', () {
|
||||
testWidgets((WidgetTester tester) {
|
||||
final Map<String, RouteBuilder> routes = <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) => new FirstWidget(),
|
||||
'/modal': (RouteArguments args) => new SecondWidget(),
|
||||
final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) => new FirstWidget(),
|
||||
'/modal': (BuildContext context) => new SecondWidget(),
|
||||
};
|
||||
|
||||
tester.pumpWidget(new MaterialApp(routes: routes));
|
||||
|
@ -66,9 +66,9 @@ class ThirdWidget extends StatelessWidget {
|
||||
void main() {
|
||||
test('Can navigator navigate to and from a stateful widget', () {
|
||||
testWidgets((WidgetTester tester) {
|
||||
final Map<String, RouteBuilder> routes = <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) => new FirstWidget(),
|
||||
'/second': (RouteArguments args) => new SecondWidget(),
|
||||
final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) => new FirstWidget(),
|
||||
'/second': (BuildContext context) => new SecondWidget(),
|
||||
};
|
||||
|
||||
tester.pumpWidget(new MaterialApp(routes: routes));
|
||||
|
@ -18,7 +18,7 @@ void main() {
|
||||
testWidgets((WidgetTester tester) {
|
||||
GlobalKey containerKey1 = new GlobalKey();
|
||||
GlobalKey containerKey2 = new GlobalKey();
|
||||
final Map<String, RouteBuilder> routes = <String, RouteBuilder>{
|
||||
final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
|
||||
'/': (_) => new Container(key: containerKey1, child: new Text('Home')),
|
||||
'/settings': (_) => new Container(key: containerKey2, child: new Text('Settings')),
|
||||
};
|
||||
|
@ -18,7 +18,7 @@ void main() {
|
||||
key: rotatedBoxKey,
|
||||
quarterTurns: 1,
|
||||
child: new Row(
|
||||
justifyContent: FlexJustifyContent.collapse,
|
||||
mainAxisAlignment: MainAxisAlignment.collapse,
|
||||
children: <Widget>[
|
||||
new GestureDetector(
|
||||
onTap: () { log.add('left'); },
|
||||
|
@ -58,7 +58,7 @@ void main() {
|
||||
)
|
||||
),
|
||||
],
|
||||
alignItems: FlexAlignItems.stretch
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch
|
||||
)
|
||||
);
|
||||
expect(client.updates.length, equals(2));
|
||||
@ -95,7 +95,7 @@ void main() {
|
||||
)
|
||||
),
|
||||
],
|
||||
alignItems: FlexAlignItems.stretch
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch
|
||||
)
|
||||
);
|
||||
expect(client.updates.length, equals(2));
|
||||
@ -160,7 +160,7 @@ void main() {
|
||||
)
|
||||
),
|
||||
],
|
||||
alignItems: FlexAlignItems.stretch
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch
|
||||
)
|
||||
);
|
||||
expect(client.updates.length, equals(2));
|
||||
@ -197,7 +197,7 @@ void main() {
|
||||
)
|
||||
),
|
||||
],
|
||||
alignItems: FlexAlignItems.stretch
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch
|
||||
)
|
||||
);
|
||||
expect(client.updates.length, equals(2));
|
||||
|
@ -35,7 +35,7 @@ void main() {
|
||||
)
|
||||
),
|
||||
],
|
||||
alignItems: FlexAlignItems.stretch
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch
|
||||
)
|
||||
);
|
||||
expect(client.updates.length, equals(2));
|
||||
@ -100,7 +100,7 @@ void main() {
|
||||
)
|
||||
),
|
||||
],
|
||||
alignItems: FlexAlignItems.stretch
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch
|
||||
)
|
||||
);
|
||||
expect(client.updates.length, equals(2));
|
||||
@ -137,7 +137,7 @@ void main() {
|
||||
)
|
||||
),
|
||||
],
|
||||
alignItems: FlexAlignItems.stretch
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch
|
||||
)
|
||||
);
|
||||
expect(client.updates.length, equals(2));
|
||||
|
@ -12,8 +12,8 @@ void main() {
|
||||
String helloSnackBar = 'Hello SnackBar';
|
||||
Key tapTarget = new Key('tap-target');
|
||||
tester.pumpWidget(new MaterialApp(
|
||||
routes: <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) {
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) {
|
||||
return new Scaffold(
|
||||
body: new Builder(
|
||||
builder: (BuildContext context) {
|
||||
@ -63,8 +63,8 @@ void main() {
|
||||
int snackBarCount = 0;
|
||||
Key tapTarget = new Key('tap-target');
|
||||
tester.pumpWidget(new MaterialApp(
|
||||
routes: <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) {
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) {
|
||||
return new Scaffold(
|
||||
body: new Builder(
|
||||
builder: (BuildContext context) {
|
||||
@ -146,8 +146,8 @@ void main() {
|
||||
int time;
|
||||
ScaffoldFeatureController<SnackBar, Null> lastController;
|
||||
tester.pumpWidget(new MaterialApp(
|
||||
routes: <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) {
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) {
|
||||
return new Scaffold(
|
||||
body: new Builder(
|
||||
builder: (BuildContext context) {
|
||||
|
@ -13,22 +13,22 @@ void main() {
|
||||
final Key sublistKey = new UniqueKey();
|
||||
final Key bottomKey = new UniqueKey();
|
||||
|
||||
final Map<String, RouteBuilder> routes = <String, RouteBuilder>{
|
||||
final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
|
||||
'/': (_) {
|
||||
return new Material(
|
||||
child: new Viewport(
|
||||
child: new TwoLevelList(
|
||||
items: <Widget>[
|
||||
new TwoLevelListItem(center: new Text('Top'), key: topKey),
|
||||
new TwoLevelListItem(title: new Text('Top'), key: topKey),
|
||||
new TwoLevelSublist(
|
||||
key: sublistKey,
|
||||
center: new Text('Sublist'),
|
||||
children: <Widget>[
|
||||
new TwoLevelListItem(center: new Text('0')),
|
||||
new TwoLevelListItem(center: new Text('1'))
|
||||
new TwoLevelListItem(title: new Text('0')),
|
||||
new TwoLevelListItem(title: new Text('1'))
|
||||
]
|
||||
),
|
||||
new TwoLevelListItem(center: new Text('Bottom'), key: bottomKey)
|
||||
new TwoLevelListItem(title: new Text('Bottom'), key: bottomKey)
|
||||
]
|
||||
)
|
||||
)
|
||||
|
@ -29,9 +29,9 @@ Enjoy!
|
||||
void main() {
|
||||
runApp(new MaterialApp(
|
||||
title: "Markdown Demo",
|
||||
routes: <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) => new Scaffold(
|
||||
toolBar: new ToolBar(center: new Text("Markdown Demo")),
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) => new Scaffold(
|
||||
appBar: new AppBar(title: new Text("Markdown Demo")),
|
||||
body: new Markdown(data: _kMarkdownData)
|
||||
)
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ class _MarkdownBodyRawState extends State<MarkdownBodyRaw> {
|
||||
}
|
||||
|
||||
return new Column(
|
||||
alignItems: FlexAlignItems.stretch,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: blocks
|
||||
);
|
||||
}
|
||||
@ -365,7 +365,7 @@ class _Block {
|
||||
}
|
||||
|
||||
contents = new Column(
|
||||
alignItems: FlexAlignItems.stretch,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: subWidgets
|
||||
);
|
||||
} else {
|
||||
@ -391,7 +391,7 @@ class _Block {
|
||||
}
|
||||
|
||||
contents = new Row(
|
||||
alignItems: FlexAlignItems.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new SizedBox(
|
||||
width: listIndents.length * markdownStyle.listIndent,
|
||||
|
@ -12,8 +12,8 @@ void main() {
|
||||
runApp(
|
||||
new MaterialApp(
|
||||
title: 'Flutter Demo',
|
||||
routes: <String, RouteBuilder>{
|
||||
'/': (RouteArguments args) => new FlutterDemo()
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) => new FlutterDemo()
|
||||
}
|
||||
)
|
||||
);
|
||||
@ -34,8 +34,8 @@ class _FlutterDemoState extends State<FlutterDemo> {
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(
|
||||
center: new Text('Flutter Demo')
|
||||
appBar: new AppBar(
|
||||
title: new Text('Flutter Demo')
|
||||
),
|
||||
body: new Center(
|
||||
child: new Text('Button tapped $_counter time${ _counter == 1 ? '' : 's' }.')
|
||||
|
Loading…
x
Reference in New Issue
Block a user