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