@@ -16,7 +16,7 @@ class CardModel {
|
||||
Key get key => new ObjectKey(this);
|
||||
}
|
||||
|
||||
class CardCollection extends StatefulComponent {
|
||||
class CardCollection extends StatefulWidget {
|
||||
CardCollectionState createState() => new CardCollectionState();
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ class CardCollectionState extends State<CardCollection> {
|
||||
],
|
||||
flexibleSpace: (_) {
|
||||
return new Container(
|
||||
padding: const EdgeDims.only(left: 72.0),
|
||||
padding: const EdgeInsets.only(left: 72.0),
|
||||
height: 128.0,
|
||||
child: new Align(
|
||||
alignment: const FractionalOffset(0.0, 0.75),
|
||||
@@ -304,7 +304,7 @@ class CardCollectionState extends State<CardCollection> {
|
||||
color: _primaryColor[cardModel.color],
|
||||
child: new Container(
|
||||
height: cardModel.height,
|
||||
padding: const EdgeDims.all(kCardMargins),
|
||||
padding: const EdgeInsets.all(kCardMargins),
|
||||
child: _editable ?
|
||||
new Center(
|
||||
child: new Input(
|
||||
@@ -367,7 +367,7 @@ class CardCollectionState extends State<CardCollection> {
|
||||
bottom: 0.0,
|
||||
left: 0.0,
|
||||
child: new Container(
|
||||
margin: const EdgeDims.all(4.0),
|
||||
margin: const EdgeInsets.all(4.0),
|
||||
child: new Viewport(
|
||||
child: new Container(
|
||||
height: cardModel.height,
|
||||
@@ -428,7 +428,7 @@ class CardCollectionState extends State<CardCollection> {
|
||||
}
|
||||
|
||||
Widget body = new Container(
|
||||
padding: const EdgeDims.symmetric(vertical: 12.0, horizontal: 8.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 8.0),
|
||||
decoration: new BoxDecoration(backgroundColor: _primaryColor[50]),
|
||||
child: cardCollection
|
||||
);
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ExampleDragTarget extends StatefulComponent {
|
||||
class ExampleDragTarget extends StatefulWidget {
|
||||
ExampleDragTargetState createState() => new ExampleDragTargetState();
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ class ExampleDragTargetState extends State<ExampleDragTarget> {
|
||||
builder: (BuildContext context, List<Color> data, List<Color> rejectedData) {
|
||||
return new Container(
|
||||
height: 100.0,
|
||||
margin: new EdgeDims.all(10.0),
|
||||
margin: new EdgeInsets.all(10.0),
|
||||
decoration: new BoxDecoration(
|
||||
border: new Border.all(
|
||||
width: 3.0,
|
||||
@@ -39,7 +39,7 @@ class ExampleDragTargetState extends State<ExampleDragTarget> {
|
||||
}
|
||||
}
|
||||
|
||||
class Dot extends StatefulComponent {
|
||||
class Dot extends StatefulWidget {
|
||||
Dot({ Key key, this.color, this.size, this.child, this.tappable: false }) : super(key: key);
|
||||
final Color color;
|
||||
final double size;
|
||||
@@ -66,7 +66,7 @@ class DotState extends State<Dot> {
|
||||
}
|
||||
}
|
||||
|
||||
class ExampleDragSource extends StatelessComponent {
|
||||
class ExampleDragSource extends StatelessWidget {
|
||||
ExampleDragSource({
|
||||
Key key,
|
||||
this.color,
|
||||
@@ -90,7 +90,7 @@ class ExampleDragSource extends StatelessComponent {
|
||||
size *= kHeavyMultiplier;
|
||||
|
||||
Widget contents = new DefaultTextStyle(
|
||||
style: Theme.of(context).text.body1.copyWith(textAlign: TextAlign.center),
|
||||
style: Theme.of(context).textTheme.body1.copyWith(textAlign: TextAlign.center),
|
||||
child: new Dot(
|
||||
color: color,
|
||||
size: size,
|
||||
@@ -162,7 +162,7 @@ class DashOutlineCirclePainter extends CustomPainter {
|
||||
bool shouldRepaint(DashOutlineCirclePainter oldPainter) => false;
|
||||
}
|
||||
|
||||
class MovableBall extends StatelessComponent {
|
||||
class MovableBall extends StatelessWidget {
|
||||
MovableBall(this.position, this.ballPosition, this.callback);
|
||||
|
||||
final int position;
|
||||
@@ -174,7 +174,7 @@ class MovableBall extends StatelessComponent {
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
Widget ball = new DefaultTextStyle(
|
||||
style: Theme.of(context).text.body1.copyWith(
|
||||
style: Theme.of(context).textTheme.body1.copyWith(
|
||||
textAlign: TextAlign.center,
|
||||
color: Colors.white
|
||||
),
|
||||
@@ -212,7 +212,7 @@ class MovableBall extends StatelessComponent {
|
||||
}
|
||||
}
|
||||
|
||||
class DragAndDropApp extends StatefulComponent {
|
||||
class DragAndDropApp extends StatefulWidget {
|
||||
DragAndDropAppState createState() => new DragAndDropAppState();
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ enum WindowSide {
|
||||
bottomRight,
|
||||
}
|
||||
|
||||
class WindowDecoration extends StatelessComponent {
|
||||
class WindowDecoration extends StatelessWidget {
|
||||
WindowDecoration({
|
||||
Key key,
|
||||
this.side,
|
||||
@@ -87,7 +87,7 @@ class WindowDecoration extends StatelessComponent {
|
||||
}
|
||||
}
|
||||
|
||||
class Window extends StatefulComponent {
|
||||
class Window extends StatefulWidget {
|
||||
Window({ Key key, this.child, this.onClose }) : super(key: key);
|
||||
|
||||
final ChildViewConnection child;
|
||||
@@ -143,7 +143,7 @@ class _WindowState extends State<Window> {
|
||||
color: Colors.blue[200]
|
||||
),
|
||||
new Container(
|
||||
padding: const EdgeDims.all(_kWindowPadding),
|
||||
padding: const EdgeInsets.all(_kWindowPadding),
|
||||
child: new Material(
|
||||
elevation: 8,
|
||||
child: new ChildView(child: config.child)
|
||||
@@ -155,7 +155,7 @@ class _WindowState extends State<Window> {
|
||||
}
|
||||
}
|
||||
|
||||
class LauncherItem extends StatelessComponent {
|
||||
class LauncherItem extends StatelessWidget {
|
||||
LauncherItem({
|
||||
Key key,
|
||||
this.url,
|
||||
@@ -175,7 +175,7 @@ class LauncherItem extends StatelessComponent {
|
||||
}
|
||||
}
|
||||
|
||||
class Launcher extends StatelessComponent {
|
||||
class Launcher extends StatelessWidget {
|
||||
Launcher({ Key key, this.items }) : super(key: key);
|
||||
|
||||
final List<Widget> items;
|
||||
@@ -188,7 +188,7 @@ class Launcher extends StatelessComponent {
|
||||
}
|
||||
}
|
||||
|
||||
class WindowManager extends StatefulComponent {
|
||||
class WindowManager extends StatefulWidget {
|
||||
_WindowManagerState createState() => new _WindowManagerState();
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ class _MarkerPainter extends CustomPainter {
|
||||
}
|
||||
}
|
||||
|
||||
class Marker extends StatelessComponent {
|
||||
class Marker extends StatelessWidget {
|
||||
Marker({
|
||||
this.type: MarkerType.touch,
|
||||
this.position,
|
||||
@@ -82,7 +82,7 @@ class Marker extends StatelessComponent {
|
||||
}
|
||||
}
|
||||
|
||||
class OverlayGeometryApp extends StatefulComponent {
|
||||
class OverlayGeometryApp extends StatefulWidget {
|
||||
OverlayGeometryAppState createState() => new OverlayGeometryAppState();
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> {
|
||||
color: cardModel.color,
|
||||
child: new Container(
|
||||
height: cardModel.height,
|
||||
padding: const EdgeDims.all(8.0),
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: new Center(child: new Text(cardModel.label, style: cardLabelStyle))
|
||||
)
|
||||
)
|
||||
@@ -156,7 +156,7 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> {
|
||||
new Scaffold(
|
||||
toolBar: new ToolBar(center: new Text('Tap a Card')),
|
||||
body: new Container(
|
||||
padding: const EdgeDims.symmetric(vertical: 12.0, horizontal: 8.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 8.0),
|
||||
child: new ScrollableMixedWidgetList(
|
||||
builder: builder,
|
||||
token: cardModels.length,
|
||||
|
||||
@@ -13,7 +13,7 @@ class CardModel {
|
||||
Key get key => new ObjectKey(this);
|
||||
}
|
||||
|
||||
class PageableListApp extends StatefulComponent {
|
||||
class PageableListApp extends StatefulWidget {
|
||||
PageableListAppState createState() => new PageableListAppState();
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class PageableListAppState extends State<PageableListApp> {
|
||||
child: new Container(
|
||||
width: cardModel.size.width,
|
||||
height: cardModel.size.height,
|
||||
padding: const EdgeDims.all(8.0),
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: new Center(child: new Text(cardModel.label, style: cardLabelStyle))
|
||||
)
|
||||
);
|
||||
|
||||
@@ -30,7 +30,7 @@ void main() {
|
||||
);
|
||||
}
|
||||
|
||||
class RawKeyboardDemo extends StatefulComponent {
|
||||
class RawKeyboardDemo extends StatefulWidget {
|
||||
RawKeyboardDemo({ GlobalKey key }) : super(key: key);
|
||||
|
||||
_HardwareKeyDemoState createState() => new _HardwareKeyDemoState();
|
||||
|
||||
@@ -15,7 +15,7 @@ void main() {
|
||||
void addAlignmentRow(FlexAlignItems alignItems) {
|
||||
TextStyle style = const TextStyle(color: const Color(0xFF000000));
|
||||
RenderParagraph paragraph = new RenderParagraph(new TextSpan(style: style, text: '$alignItems'));
|
||||
table.add(new RenderPadding(child: paragraph, padding: new EdgeDims.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);
|
||||
style = new TextStyle(fontSize: 15.0, color: const Color(0xFF000000));
|
||||
row.add(new RenderDecoratedBox(
|
||||
@@ -49,7 +49,7 @@ void main() {
|
||||
void addJustificationRow(FlexJustifyContent justify) {
|
||||
const TextStyle style = const TextStyle(color: const Color(0xFF000000));
|
||||
RenderParagraph paragraph = new RenderParagraph(new TextSpan(style: style, text: '$justify'));
|
||||
table.add(new RenderPadding(child: paragraph, padding: new EdgeDims.only(top: 20.0)));
|
||||
table.add(new RenderPadding(child: paragraph, padding: new EdgeInsets.only(top: 20.0)));
|
||||
RenderFlex row = new RenderFlex(direction: FlexDirection.horizontal);
|
||||
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)));
|
||||
@@ -68,7 +68,7 @@ void main() {
|
||||
|
||||
RenderDecoratedBox root = new RenderDecoratedBox(
|
||||
decoration: new BoxDecoration(backgroundColor: const Color(0xFFFFFFFF)),
|
||||
child: new RenderPadding(child: table, padding: new EdgeDims.symmetric(vertical: 50.0))
|
||||
child: new RenderPadding(child: table, padding: new EdgeInsets.symmetric(vertical: 50.0))
|
||||
);
|
||||
|
||||
new RenderingFlutterBinding(root: root);
|
||||
|
||||
@@ -51,7 +51,7 @@ class PianoKey {
|
||||
}
|
||||
}
|
||||
|
||||
class PianoApp extends StatelessComponent {
|
||||
class PianoApp extends StatelessWidget {
|
||||
final List<PianoKey> keys = <PianoKey>[
|
||||
new PianoKey(Colors.red[500], chimes),
|
||||
new PianoKey(Colors.orange[500], chainsaw),
|
||||
@@ -105,8 +105,8 @@ Widget statusBox(Widget child) {
|
||||
backgroundColor: darkGray
|
||||
),
|
||||
height: 90.0,
|
||||
padding: const EdgeDims.all(8.0),
|
||||
margin: const EdgeDims.symmetric(horizontal: 50.0),
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
margin: const EdgeInsets.symmetric(horizontal: 50.0),
|
||||
child: new Center(child: child)
|
||||
)
|
||||
);
|
||||
|
||||
@@ -46,7 +46,7 @@ class _MyAutoLayoutDelegate extends AutoLayoutDelegate {
|
||||
bool shouldUpdateConstraints(_MyAutoLayoutDelegate oldDelegate) => true;
|
||||
}
|
||||
|
||||
class ColoredBoxes extends StatefulComponent {
|
||||
class ColoredBoxes extends StatefulWidget {
|
||||
_ColoredBoxesState createState() => new _ColoredBoxesState();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ class RenderDots extends RenderConstrainedBox {
|
||||
}
|
||||
}
|
||||
|
||||
class Dots extends OneChildRenderObjectWidget {
|
||||
class Dots extends SingleChildRenderObjectWidget {
|
||||
Dots({ Key key, Widget child }) : super(key: key, child: child);
|
||||
RenderDots createRenderObject(BuildContext context) => new RenderDots();
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ class _GesturePainter extends CustomPainter {
|
||||
}
|
||||
}
|
||||
|
||||
class GestureDemo extends StatefulComponent {
|
||||
class GestureDemo extends StatefulWidget {
|
||||
_GestureDemoState createState() => new _GestureDemoState();
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ class _GestureDemoState extends State<GestureDemo> {
|
||||
left: 0.0,
|
||||
child: new Card(
|
||||
child: new Container(
|
||||
padding: new EdgeDims.all(4.0),
|
||||
padding: new EdgeInsets.all(4.0),
|
||||
child: new Column(
|
||||
children: <Widget>[
|
||||
new Row(
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AdaptedListItem extends StatelessComponent {
|
||||
class AdaptedListItem extends StatelessWidget {
|
||||
AdaptedListItem({ Key key, this.name }) : super(key: key);
|
||||
|
||||
final String name;
|
||||
@@ -15,7 +15,7 @@ class AdaptedListItem extends StatelessComponent {
|
||||
new Container(
|
||||
width: 32.0,
|
||||
height: 32.0,
|
||||
margin: const EdgeDims.all(8.0),
|
||||
margin: const EdgeInsets.all(8.0),
|
||||
decoration: new BoxDecoration(
|
||||
backgroundColor: Colors.lightBlueAccent[100]
|
||||
)
|
||||
@@ -26,7 +26,7 @@ class AdaptedListItem extends StatelessComponent {
|
||||
}
|
||||
}
|
||||
|
||||
class AdaptedGridItem extends StatelessComponent {
|
||||
class AdaptedGridItem extends StatelessWidget {
|
||||
AdaptedGridItem({ Key key, this.name }) : super(key: key);
|
||||
|
||||
final String name;
|
||||
@@ -43,7 +43,7 @@ class AdaptedGridItem extends StatelessComponent {
|
||||
)
|
||||
),
|
||||
new Container(
|
||||
margin: const EdgeDims.only(left: 8.0),
|
||||
margin: const EdgeInsets.only(left: 8.0),
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Flexible(
|
||||
@@ -65,7 +65,7 @@ const double _kListItemExtent = 50.0;
|
||||
const double _kMaxTileWidth = 150.0;
|
||||
const double _kGridViewBreakpoint = 450.0;
|
||||
|
||||
class AdaptiveContainer extends StatelessComponent {
|
||||
class AdaptiveContainer extends StatelessWidget {
|
||||
AdaptiveContainer({ Key key, this.names }) : super(key: key);
|
||||
|
||||
final List<String> names;
|
||||
|
||||
@@ -16,7 +16,7 @@ RenderBox initCircle() {
|
||||
);
|
||||
}
|
||||
|
||||
class SectorApp extends StatefulComponent {
|
||||
class SectorApp extends StatefulWidget {
|
||||
SectorAppState createState() => new SectorAppState();
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ class SectorAppState extends State<SectorApp> {
|
||||
return new Column(
|
||||
children: <Widget>[
|
||||
new Container(
|
||||
padding: new EdgeDims.symmetric(horizontal: 8.0, vertical: 25.0),
|
||||
padding: new EdgeInsets.symmetric(horizontal: 8.0, vertical: 25.0),
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new RaisedButton(
|
||||
@@ -101,8 +101,8 @@ class SectorAppState extends State<SectorApp> {
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Container(
|
||||
padding: new EdgeDims.all(4.0),
|
||||
margin: new EdgeDims.only(right: 10.0),
|
||||
padding: new EdgeInsets.all(4.0),
|
||||
margin: new EdgeInsets.only(right: 10.0),
|
||||
child: new WidgetToRenderBoxAdapter(renderBox: sectorAddIcon)
|
||||
),
|
||||
new Text('ADD SECTOR'),
|
||||
@@ -116,8 +116,8 @@ class SectorAppState extends State<SectorApp> {
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Container(
|
||||
padding: new EdgeDims.all(4.0),
|
||||
margin: new EdgeDims.only(right: 10.0),
|
||||
padding: new EdgeInsets.all(4.0),
|
||||
margin: new EdgeInsets.only(right: 10.0),
|
||||
child: new WidgetToRenderBoxAdapter(renderBox: sectorRemoveIcon)
|
||||
),
|
||||
new Text('REMOVE SECTOR'),
|
||||
@@ -131,11 +131,11 @@ class SectorAppState extends State<SectorApp> {
|
||||
),
|
||||
new Flexible(
|
||||
child: new Container(
|
||||
margin: new EdgeDims.all(8.0),
|
||||
margin: new EdgeInsets.all(8.0),
|
||||
decoration: new BoxDecoration(
|
||||
border: new Border.all(color: new Color(0xFF000000))
|
||||
),
|
||||
padding: new EdgeDims.all(8.0),
|
||||
padding: new EdgeInsets.all(8.0),
|
||||
child: new WidgetToRenderBoxAdapter(
|
||||
renderBox: sectors,
|
||||
onBuild: doUpdates
|
||||
|
||||
@@ -16,7 +16,7 @@ void addFlexChildSolidColor(RenderFlex parent, Color backgroundColor, { int flex
|
||||
}
|
||||
|
||||
// Solid colour, Widget version
|
||||
class Rectangle extends StatelessComponent {
|
||||
class Rectangle extends StatelessWidget {
|
||||
Rectangle(this.color, { Key key }) : super(key: key);
|
||||
final Color color;
|
||||
Widget build(BuildContext context) {
|
||||
@@ -40,8 +40,8 @@ void attachWidgetTreeToRenderTree(RenderProxyBox container) {
|
||||
new Rectangle(const Color(0xFF00FFFF)),
|
||||
new Material(
|
||||
child: new Container(
|
||||
padding: new EdgeDims.all(10.0),
|
||||
margin: new EdgeDims.all(10.0),
|
||||
padding: new EdgeInsets.all(10.0),
|
||||
margin: new EdgeInsets.all(10.0),
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new RaisedButton(
|
||||
@@ -95,7 +95,7 @@ void main() {
|
||||
addFlexChildSolidColor(flexRoot, const Color(0xFF0000FF), flex: 1);
|
||||
|
||||
transformBox = new RenderTransform(child: flexRoot, transform: new Matrix4.identity());
|
||||
RenderPadding root = new RenderPadding(padding: new EdgeDims.all(80.0), child: transformBox);
|
||||
RenderPadding root = new RenderPadding(padding: new EdgeInsets.all(80.0), child: transformBox);
|
||||
|
||||
WidgetFlutterBinding.instance.renderView.child = root;
|
||||
WidgetFlutterBinding.instance.addPersistentFrameCallback(rotate);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
class SpinningSquare extends StatefulComponent {
|
||||
class SpinningSquare extends StatefulWidget {
|
||||
_SpinningSquareState createState() => new _SpinningSquareState();
|
||||
}
|
||||
|
||||
|
||||
@@ -57,11 +57,11 @@ Widget toStyledText(String name, String text) {
|
||||
|
||||
Widget toPlainText(String name, String text) => new Text(name + ":" + text);
|
||||
|
||||
class SpeakerSeparator extends StatelessComponent {
|
||||
class SpeakerSeparator extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return new Container(
|
||||
constraints: const BoxConstraints.expand(height: 0.0),
|
||||
margin: const EdgeDims.symmetric(vertical: 10.0, horizontal: 64.0),
|
||||
margin: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 64.0),
|
||||
decoration: const BoxDecoration(
|
||||
border: const Border(
|
||||
bottom: const BorderSide(color: const Color.fromARGB(24, 0, 0, 0))
|
||||
@@ -71,7 +71,7 @@ class SpeakerSeparator extends StatelessComponent {
|
||||
}
|
||||
}
|
||||
|
||||
class StyledTextDemo extends StatefulComponent {
|
||||
class StyledTextDemo extends StatefulWidget {
|
||||
_StyledTextDemoState createState() => new _StyledTextDemoState();
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ class _StyledTextDemoState extends State<StyledTextDemo> {
|
||||
return new GestureDetector(
|
||||
onTap: _handleTap,
|
||||
child: new Container(
|
||||
padding: new EdgeDims.symmetric(horizontal: 8.0),
|
||||
padding: new EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: new Column(
|
||||
children: children,
|
||||
justifyContent: FlexJustifyContent.center,
|
||||
|
||||
@@ -55,7 +55,7 @@ class _ButtonDemo {
|
||||
int get hashCode => hashValues(title.hashCode, text.hashCode);
|
||||
}
|
||||
|
||||
class ButtonsDemo extends StatefulComponent {
|
||||
class ButtonsDemo extends StatefulWidget {
|
||||
_ButtonsDemoState createState() => new _ButtonsDemoState();
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
|
||||
|
||||
Widget buildRaisedButton(BuildContext context) {
|
||||
return new Container(
|
||||
margin: const EdgeDims.symmetric(vertical: 16.0),
|
||||
margin: const EdgeInsets.symmetric(vertical: 16.0),
|
||||
child: new Column(
|
||||
children: <Widget>[
|
||||
new RaisedButton(
|
||||
@@ -108,7 +108,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
|
||||
]
|
||||
.map((Widget child) {
|
||||
return new Container(
|
||||
margin: const EdgeDims.symmetric(vertical: 8.0),
|
||||
margin: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: child
|
||||
);
|
||||
})
|
||||
@@ -119,7 +119,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
|
||||
|
||||
Widget buildFlatButton(BuildContext context) {
|
||||
return new Container(
|
||||
margin: const EdgeDims.symmetric(vertical: 16.0),
|
||||
margin: const EdgeInsets.symmetric(vertical: 16.0),
|
||||
child: new ButtonTheme(
|
||||
color: ButtonColor.accent,
|
||||
child: new Column(
|
||||
@@ -138,7 +138,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
|
||||
]
|
||||
.map((Widget child) {
|
||||
return new Container(
|
||||
margin: const EdgeDims.symmetric(vertical: 8.0),
|
||||
margin: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: child
|
||||
);
|
||||
})
|
||||
@@ -177,13 +177,13 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
|
||||
Widget buildTabView(_ButtonDemo demo) {
|
||||
return new Builder(
|
||||
builder: (BuildContext context) {
|
||||
final TextStyle textStyle = Theme.of(context).text.caption.copyWith(fontSize: 16.0);
|
||||
final TextStyle textStyle = Theme.of(context).textTheme.caption.copyWith(fontSize: 16.0);
|
||||
return new Column(
|
||||
alignItems: FlexAlignItems.stretch,
|
||||
children: <Widget>[
|
||||
demo.builder(context),
|
||||
new Padding(
|
||||
padding: const EdgeDims.symmetric(horizontal: 32.0),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 32.0),
|
||||
child: new Text(demo.text, style: textStyle)
|
||||
)
|
||||
]
|
||||
|
||||
@@ -36,7 +36,7 @@ final List<TravelDestination> destinations = <TravelDestination>[
|
||||
)
|
||||
];
|
||||
|
||||
class TravelDestinationItem extends StatelessComponent {
|
||||
class TravelDestinationItem extends StatelessWidget {
|
||||
TravelDestinationItem({ Key key, this.destination }) : super(key: key) {
|
||||
assert(destination != null && destination.isValid);
|
||||
}
|
||||
@@ -45,9 +45,9 @@ class TravelDestinationItem extends StatelessComponent {
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
ThemeData theme = Theme.of(context);
|
||||
TextStyle titleStyle = theme.text.headline.copyWith(color: Colors.white);
|
||||
TextStyle descriptionStyle = theme.text.subhead;
|
||||
TextStyle buttonStyle = theme.text.button.copyWith(color: theme.primaryColor);
|
||||
TextStyle titleStyle = theme.textTheme.headline.copyWith(color: Colors.white);
|
||||
TextStyle descriptionStyle = theme.textTheme.subhead;
|
||||
TextStyle buttonStyle = theme.textTheme.button.copyWith(color: theme.primaryColor);
|
||||
|
||||
return new Card(
|
||||
child: new SizedBox(
|
||||
@@ -80,7 +80,7 @@ class TravelDestinationItem extends StatelessComponent {
|
||||
// description and share/expore buttons
|
||||
new Flexible(
|
||||
child: new Padding(
|
||||
padding: const EdgeDims.all(16.0),
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: new Column(
|
||||
justifyContent: FlexJustifyContent.start,
|
||||
alignItems: FlexAlignItems.start,
|
||||
@@ -96,7 +96,7 @@ class TravelDestinationItem extends StatelessComponent {
|
||||
alignItems: FlexAlignItems.end,
|
||||
children: <Widget>[
|
||||
new Padding(
|
||||
padding: const EdgeDims.only(right: 16.0),
|
||||
padding: const EdgeInsets.only(right: 16.0),
|
||||
child: new Text('SHARE', style: buttonStyle)
|
||||
),
|
||||
new Text('EXPLORE', style: buttonStyle)
|
||||
@@ -114,17 +114,17 @@ class TravelDestinationItem extends StatelessComponent {
|
||||
}
|
||||
}
|
||||
|
||||
class CardsDemo extends StatelessComponent {
|
||||
class CardsDemo extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(
|
||||
center: new Text("Travel Stream")
|
||||
),
|
||||
body: new Block(
|
||||
padding: const EdgeDims.only(top: 8.0, left: 8.0, right: 8.0),
|
||||
padding: const EdgeInsets.only(top: 8.0, left: 8.0, right: 8.0),
|
||||
children: destinations.map((TravelDestination destination) {
|
||||
return new Container(
|
||||
margin: const EdgeDims.only(bottom: 8.0),
|
||||
margin: const EdgeInsets.only(bottom: 8.0),
|
||||
child: new TravelDestinationItem(destination: destination)
|
||||
);
|
||||
})
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ChipDemo extends StatefulComponent {
|
||||
class ChipDemo extends StatefulWidget {
|
||||
_ChipDemoState createState() => new _ChipDemoState();
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ const List<ColorSwatch> colorSwatches = const <ColorSwatch>[
|
||||
];
|
||||
|
||||
|
||||
class ColorItem extends StatelessComponent {
|
||||
class ColorItem extends StatelessWidget {
|
||||
ColorItem({ Key key, this.index, this.color, this.prefix: '' }) : super(key: key) {
|
||||
assert(index != null);
|
||||
assert(color != null);
|
||||
@@ -57,7 +57,7 @@ class ColorItem extends StatelessComponent {
|
||||
Widget build(BuildContext context) {
|
||||
return new Container(
|
||||
height: kColorItemHeight,
|
||||
padding: const EdgeDims.symmetric(horizontal: 16.0),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
decoration: new BoxDecoration(backgroundColor: color),
|
||||
child: new Row(
|
||||
justifyContent: FlexJustifyContent.spaceBetween,
|
||||
@@ -71,7 +71,7 @@ class ColorItem extends StatelessComponent {
|
||||
}
|
||||
}
|
||||
|
||||
class ColorSwatchTabView extends StatelessComponent {
|
||||
class ColorSwatchTabView extends StatelessWidget {
|
||||
ColorSwatchTabView({ Key key, this.swatch }) : super(key: key) {
|
||||
assert(swatch != null && swatch.isValid);
|
||||
}
|
||||
@@ -106,7 +106,7 @@ class ColorSwatchTabView extends StatelessComponent {
|
||||
}
|
||||
}
|
||||
|
||||
class ColorsDemo extends StatelessComponent {
|
||||
class ColorsDemo extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return new TabBarSelection<ColorSwatch>(
|
||||
values: colorSwatches,
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class DatePickerDemo extends StatefulComponent {
|
||||
class DatePickerDemo extends StatefulWidget {
|
||||
_DatePickerDemoState createState() => new _DatePickerDemoState();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ const String _alertWithTitleText =
|
||||
"Let Google help apps determine location. This means sending anyonmous location "
|
||||
"data to Google, even when no apps are running.";
|
||||
|
||||
class DialogDemoItem extends StatelessComponent {
|
||||
class DialogDemoItem extends StatelessWidget {
|
||||
DialogDemoItem({ Key key, this.icon, this.color, this.text, this.onPressed }) : super(key: key);
|
||||
|
||||
final IconData icon;
|
||||
@@ -32,7 +32,7 @@ class DialogDemoItem extends StatelessComponent {
|
||||
return new InkWell(
|
||||
onTap: onPressed,
|
||||
child: new Padding(
|
||||
padding: const EdgeDims.symmetric(vertical: 8.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: new Row(
|
||||
justifyContent: FlexJustifyContent.start,
|
||||
alignItems: FlexAlignItems.center,
|
||||
@@ -43,7 +43,7 @@ class DialogDemoItem extends StatelessComponent {
|
||||
color: color
|
||||
),
|
||||
new Padding(
|
||||
padding: const EdgeDims.only(left: 16.0),
|
||||
padding: const EdgeInsets.only(left: 16.0),
|
||||
child: new Text(text)
|
||||
)
|
||||
]
|
||||
@@ -53,7 +53,7 @@ class DialogDemoItem extends StatelessComponent {
|
||||
}
|
||||
}
|
||||
|
||||
class DialogDemo extends StatefulComponent {
|
||||
class DialogDemo extends StatefulWidget {
|
||||
DialogDemoState createState() => new DialogDemoState();
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ class DialogDemoState extends State<DialogDemo> {
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
final ThemeData theme = Theme.of(context);
|
||||
final TextStyle dialogTextStyle = theme.text.subhead.copyWith(color: theme.text.caption.color);
|
||||
final TextStyle dialogTextStyle = theme.textTheme.subhead.copyWith(color: theme.textTheme.caption.color);
|
||||
|
||||
return new Scaffold(
|
||||
key: scaffoldKey,
|
||||
@@ -84,7 +84,7 @@ class DialogDemoState extends State<DialogDemo> {
|
||||
center: new Text('Dialogs')
|
||||
),
|
||||
body: new Block(
|
||||
padding: const EdgeDims.symmetric(vertical: 24.0, horizontal: 72.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 24.0, horizontal: 72.0),
|
||||
children: <Widget>[
|
||||
new RaisedButton(
|
||||
child: new Text('ALERT'),
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DropDownDemo extends StatefulComponent {
|
||||
class DropDownDemo extends StatefulWidget {
|
||||
_DropDownDemoState createState() => new _DropDownDemoState();
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import 'package:vector_math/vector_math_64.dart' as vec;
|
||||
ImageMap _images;
|
||||
SpriteSheet _sprites;
|
||||
|
||||
class FitnessDemo extends StatelessComponent {
|
||||
class FitnessDemo extends StatelessWidget {
|
||||
FitnessDemo({ Key key }) : super(key: key);
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
@@ -26,7 +26,7 @@ class FitnessDemo extends StatelessComponent {
|
||||
}
|
||||
}
|
||||
|
||||
class _FitnessDemoContents extends StatefulComponent {
|
||||
class _FitnessDemoContents extends StatefulWidget {
|
||||
_FitnessDemoContents({ Key key }) : super(key: key);
|
||||
_FitnessDemoContentsState createState() => new _FitnessDemoContentsState();
|
||||
}
|
||||
@@ -102,11 +102,11 @@ class _FitnessDemoContentsState extends State<_FitnessDemoContents> {
|
||||
)
|
||||
),
|
||||
new Padding(
|
||||
padding: new EdgeDims.only(top: 20.0),
|
||||
child: new Text("JUMPING JACKS", style: Theme.of(context).text.title)
|
||||
padding: new EdgeInsets.only(top: 20.0),
|
||||
child: new Text("JUMPING JACKS", style: Theme.of(context).textTheme.title)
|
||||
),
|
||||
new Padding(
|
||||
padding: new EdgeDims.only(top: 20.0, bottom: 20.0),
|
||||
padding: new EdgeInsets.only(top: 20.0, bottom: 20.0),
|
||||
child: new Row(
|
||||
justifyContent: FlexJustifyContent.center,
|
||||
children: <Widget>[
|
||||
@@ -117,7 +117,7 @@ class _FitnessDemoContentsState extends State<_FitnessDemoContents> {
|
||||
)
|
||||
),
|
||||
new Padding(
|
||||
padding: new EdgeDims.only(bottom: 16.0),
|
||||
padding: new EdgeInsets.only(bottom: 16.0),
|
||||
child: new SizedBox(
|
||||
width: 300.0,
|
||||
height: 72.0,
|
||||
@@ -510,7 +510,7 @@ class _JumpingJackPart extends Sprite {
|
||||
}
|
||||
}
|
||||
|
||||
class _Fireworks extends StatefulComponent {
|
||||
class _Fireworks extends StatefulWidget {
|
||||
_Fireworks({ Key key }) : super(key: key);
|
||||
|
||||
_FireworksState createState() => new _FireworksState();
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
class _ContactCategory extends StatelessComponent {
|
||||
class _ContactCategory extends StatelessWidget {
|
||||
_ContactCategory({ Key key, this.icon, this.children }) : super(key: key);
|
||||
|
||||
final IconData icon;
|
||||
@@ -13,12 +13,12 @@ class _ContactCategory extends StatelessComponent {
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return new Container(
|
||||
padding: const EdgeDims.symmetric(vertical: 16.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||
decoration: new BoxDecoration(
|
||||
border: new Border(bottom: new BorderSide(color: Theme.of(context).dividerColor))
|
||||
),
|
||||
child: new DefaultTextStyle(
|
||||
style: Theme.of(context).text.subhead,
|
||||
style: Theme.of(context).textTheme.subhead,
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new SizedBox(
|
||||
@@ -33,7 +33,7 @@ class _ContactCategory extends StatelessComponent {
|
||||
}
|
||||
}
|
||||
|
||||
class _ContactItem extends StatelessComponent {
|
||||
class _ContactItem extends StatelessWidget {
|
||||
_ContactItem({ Key key, this.icon, this.lines }) : super(key: key) {
|
||||
assert(lines.length > 1);
|
||||
}
|
||||
@@ -43,7 +43,7 @@ class _ContactItem extends StatelessComponent {
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
List<Widget> columnChildren = lines.sublist(0, lines.length - 1).map((String line) => new Text(line)).toList();
|
||||
columnChildren.add(new Text(lines.last, style: Theme.of(context).text.caption));
|
||||
columnChildren.add(new Text(lines.last, style: Theme.of(context).textTheme.caption));
|
||||
|
||||
List<Widget> rowChildren = <Widget>[
|
||||
new Column(
|
||||
@@ -58,7 +58,7 @@ class _ContactItem extends StatelessComponent {
|
||||
));
|
||||
}
|
||||
return new Padding(
|
||||
padding: const EdgeDims.symmetric(vertical: 16.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||
child: new Row(
|
||||
justifyContent: FlexJustifyContent.spaceBetween,
|
||||
children: rowChildren
|
||||
@@ -67,7 +67,7 @@ class _ContactItem extends StatelessComponent {
|
||||
}
|
||||
}
|
||||
|
||||
class FlexibleSpaceDemo extends StatefulComponent {
|
||||
class FlexibleSpaceDemo extends StatefulWidget {
|
||||
FlexibleSpaceDemoState createState() => new FlexibleSpaceDemoState();
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ class FlexibleSpaceDemoState extends State<FlexibleSpaceDemo> {
|
||||
),
|
||||
body: new Block(
|
||||
scrollableKey: scrollableKey,
|
||||
padding: new EdgeDims.only(top: appBarHeight),
|
||||
padding: new EdgeInsets.only(top: appBarHeight),
|
||||
children: <Widget>[
|
||||
new _ContactCategory(
|
||||
icon: Icons.call,
|
||||
|
||||
@@ -15,7 +15,7 @@ enum DismissDialogAction {
|
||||
save,
|
||||
}
|
||||
|
||||
class DateTimeItem extends StatelessComponent {
|
||||
class DateTimeItem extends StatelessWidget {
|
||||
DateTimeItem({ Key key, DateTime dateTime, this.onChanged })
|
||||
: date = new DateTime(dateTime.year, dateTime.month, dateTime.day),
|
||||
time = new TimeOfDay(hour: dateTime.hour, minute: dateTime.minute),
|
||||
@@ -31,12 +31,12 @@ class DateTimeItem extends StatelessComponent {
|
||||
final ThemeData theme = Theme.of(context);
|
||||
|
||||
return new DefaultTextStyle(
|
||||
style: theme.text.subhead,
|
||||
style: theme.textTheme.subhead,
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Flexible(
|
||||
child: new Container(
|
||||
padding: const EdgeDims.symmetric(vertical: 8.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
decoration: new BoxDecoration(
|
||||
border: new Border(bottom: new BorderSide(color: theme.dividerColor))
|
||||
),
|
||||
@@ -63,8 +63,8 @@ class DateTimeItem extends StatelessComponent {
|
||||
)
|
||||
),
|
||||
new Container(
|
||||
margin: const EdgeDims.only(left: 8.0),
|
||||
padding: const EdgeDims.symmetric(vertical: 8.0),
|
||||
margin: const EdgeInsets.only(left: 8.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
decoration: new BoxDecoration(
|
||||
border: new Border(bottom: new BorderSide(color: theme.dividerColor))
|
||||
),
|
||||
@@ -92,7 +92,7 @@ class DateTimeItem extends StatelessComponent {
|
||||
}
|
||||
}
|
||||
|
||||
class FullScreenDialogDemo extends StatefulComponent {
|
||||
class FullScreenDialogDemo extends StatefulWidget {
|
||||
FullScreenDialogDemoState createState() => new FullScreenDialogDemoState();
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
|
||||
}
|
||||
|
||||
final ThemeData theme = Theme.of(context);
|
||||
final TextStyle dialogTextStyle = theme.text.subhead.copyWith(color: theme.text.caption.color);
|
||||
final TextStyle dialogTextStyle = theme.textTheme.subhead.copyWith(color: theme.textTheme.caption.color);
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
@@ -149,7 +149,7 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
|
||||
center: new Text('New Event'),
|
||||
right: <Widget> [
|
||||
new FlatButton(
|
||||
child: new Text('SAVE', style: theme.text.body1.copyWith(color: Colors.white)),
|
||||
child: new Text('SAVE', style: theme.textTheme.body1.copyWith(color: Colors.white)),
|
||||
onPressed: () {
|
||||
Navigator.pop(context, DismissDialogAction.save);
|
||||
}
|
||||
@@ -157,37 +157,37 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
|
||||
]
|
||||
),
|
||||
body: new Padding(
|
||||
padding: const EdgeDims.all(16.0),
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: new ScrollableViewport(
|
||||
child: new Column(
|
||||
alignItems: FlexAlignItems.stretch,
|
||||
justifyContent: FlexJustifyContent.collapse,
|
||||
children: <Widget>[
|
||||
new Container(
|
||||
padding: const EdgeDims.symmetric(vertical: 8.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
decoration: new BoxDecoration(
|
||||
border: new Border(bottom: new BorderSide(color: theme.dividerColor))
|
||||
),
|
||||
child: new Align(
|
||||
alignment: const FractionalOffset(0.0, 1.0),
|
||||
child: new Text('Event name', style: theme.text.display2)
|
||||
child: new Text('Event name', style: theme.textTheme.display2)
|
||||
)
|
||||
),
|
||||
new Container(
|
||||
padding: const EdgeDims.symmetric(vertical: 8.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
decoration: new BoxDecoration(
|
||||
border: new Border(bottom: new BorderSide(color: theme.dividerColor))
|
||||
),
|
||||
child: new Align(
|
||||
alignment: const FractionalOffset(0.0, 1.0),
|
||||
child: new Text('Location', style: theme.text.title.copyWith(color: Colors.black54))
|
||||
child: new Text('Location', style: theme.textTheme.title.copyWith(color: Colors.black54))
|
||||
)
|
||||
),
|
||||
new Column(
|
||||
alignItems: FlexAlignItems.stretch,
|
||||
justifyContent: FlexJustifyContent.end,
|
||||
children: <Widget>[
|
||||
new Text('From', style: theme.text.caption),
|
||||
new Text('From', style: theme.textTheme.caption),
|
||||
new DateTimeItem(
|
||||
dateTime: fromDateTime,
|
||||
onChanged: (DateTime value) {
|
||||
@@ -203,7 +203,7 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
|
||||
alignItems: FlexAlignItems.stretch,
|
||||
justifyContent: FlexJustifyContent.end,
|
||||
children: <Widget>[
|
||||
new Text('To', style: theme.text.caption),
|
||||
new Text('To', style: theme.textTheme.caption),
|
||||
new DateTimeItem(
|
||||
dateTime: toDateTime,
|
||||
onChanged: (DateTime value) {
|
||||
@@ -237,7 +237,7 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
|
||||
]
|
||||
.map((Widget child) {
|
||||
return new Container(
|
||||
padding: const EdgeDims.symmetric(vertical: 8.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
height: 96.0,
|
||||
child: child
|
||||
);
|
||||
|
||||
@@ -28,7 +28,7 @@ final List<Photo> photos = new List<Photo>.generate(16, (int index) {
|
||||
return const Photo(assetName: 'packages/flutter_gallery_assets/kangaroo_valley_safari.png');
|
||||
});
|
||||
|
||||
class GridDemoPhotoItem extends StatelessComponent {
|
||||
class GridDemoPhotoItem extends StatelessWidget {
|
||||
GridDemoPhotoItem({ Key key, this.photo, this.tileStyle }) : super(key: key) {
|
||||
assert(photo != null && photo.isValid);
|
||||
assert(tileStyle != null);
|
||||
@@ -97,7 +97,7 @@ class GridListDemoGridDelegate extends FixedColumnCountGridDelegate {
|
||||
this.columnCount,
|
||||
double columnSpacing: 0.0,
|
||||
double rowSpacing: 0.0,
|
||||
EdgeDims padding: EdgeDims.zero,
|
||||
EdgeInsets padding: EdgeInsets.zero,
|
||||
this.tileHeightFactor: 2.75
|
||||
}) : super(columnSpacing: columnSpacing, rowSpacing: rowSpacing, padding: padding) {
|
||||
assert(columnCount != null && columnCount >= 0);
|
||||
@@ -128,7 +128,7 @@ class GridListDemoGridDelegate extends FixedColumnCountGridDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
class GridListDemo extends StatefulComponent {
|
||||
class GridListDemo extends StatefulWidget {
|
||||
GridListDemo({ Key key }) : super(key: key);
|
||||
|
||||
GridListDemoState createState() => new GridListDemoState();
|
||||
@@ -153,7 +153,7 @@ class GridListDemoState extends State<GridListDemo> {
|
||||
)
|
||||
];
|
||||
|
||||
final EdgeDims padding = MediaQuery.of(context).padding;
|
||||
final EdgeInsets padding = MediaQuery.of(context).padding;
|
||||
final ModalPosition position = new ModalPosition(
|
||||
right: padding.right + 16.0,
|
||||
top: padding.top + 16.0
|
||||
@@ -187,7 +187,7 @@ class GridListDemoState extends State<GridListDemo> {
|
||||
columnCount: (orientation == Orientation.portrait) ? 2 : 3,
|
||||
rowSpacing: 4.0,
|
||||
columnSpacing: 4.0,
|
||||
padding: const EdgeDims.all(4.0),
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
tileHeightFactor: (orientation == Orientation.portrait) ? 2.75 : 1.75
|
||||
),
|
||||
children: photos.map((Photo photo) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class IconsDemo extends StatefulComponent {
|
||||
class IconsDemo extends StatefulWidget {
|
||||
IconsDemoState createState() => new IconsDemoState();
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ class IconsDemoState extends State<IconsDemo> {
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
final ThemeData theme = Theme.of(context);
|
||||
final TextStyle textStyle = theme.text.subhead.copyWith(color: theme.text.caption.color);
|
||||
final TextStyle textStyle = theme.textTheme.subhead.copyWith(color: theme.textTheme.caption.color);
|
||||
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(
|
||||
@@ -72,7 +72,7 @@ class IconsDemoState extends State<IconsDemo> {
|
||||
body: new IconTheme(
|
||||
data: new IconThemeData(opacity: iconOpacity),
|
||||
child: new Padding(
|
||||
padding: const EdgeDims.all(24.0),
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: new Column(
|
||||
children: <Widget>[
|
||||
new Row(
|
||||
|
||||
@@ -25,7 +25,7 @@ class LeaveBehindItem {
|
||||
final String body;
|
||||
}
|
||||
|
||||
class LeaveBehindDemo extends StatefulComponent {
|
||||
class LeaveBehindDemo extends StatefulWidget {
|
||||
LeaveBehindDemo({ Key key }) : super(key: key);
|
||||
|
||||
LeaveBehindDemoState createState() => new LeaveBehindDemoState();
|
||||
@@ -156,7 +156,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
|
||||
]
|
||||
),
|
||||
body: new Block(
|
||||
padding: new EdgeDims.all(4.0),
|
||||
padding: new EdgeInsets.all(4.0),
|
||||
children: leaveBehindItems.map(buildItem).toList()
|
||||
)
|
||||
);
|
||||
|
||||
@@ -10,7 +10,7 @@ enum ListDemoItemSize {
|
||||
threeLine
|
||||
}
|
||||
|
||||
class ListDemo extends StatefulComponent {
|
||||
class ListDemo extends StatefulWidget {
|
||||
ListDemo({ Key key }) : super(key: key);
|
||||
|
||||
ListDemoState createState() => new ListDemoState();
|
||||
@@ -195,7 +195,7 @@ class ListDemoState extends State<ListDemo> {
|
||||
]
|
||||
),
|
||||
body: new Block(
|
||||
padding: new EdgeDims.all(_dense ? 4.0 : 8.0),
|
||||
padding: new EdgeInsets.all(_dense ? 4.0 : 8.0),
|
||||
children: listItems.toList()
|
||||
)
|
||||
);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MenuDemo extends StatefulComponent {
|
||||
class MenuDemo extends StatefulWidget {
|
||||
MenuDemo({ Key key }) : super(key: key);
|
||||
|
||||
MenuDemoState createState() => new MenuDemoState();
|
||||
@@ -79,7 +79,7 @@ class MenuDemoState extends State<MenuDemo> {
|
||||
]
|
||||
),
|
||||
body: new Block(
|
||||
padding: const EdgeDims.all(8.0),
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
children: <Widget>[
|
||||
// Pressing the PopupMenuButton on the right of this item shows
|
||||
// a simple menu with one disabled item. Typically the contents
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ModalBottomSheetDemo extends StatelessComponent {
|
||||
class ModalBottomSheetDemo extends StatelessWidget {
|
||||
final TextStyle textStyle = new TextStyle(
|
||||
color: Colors.indigo[400],
|
||||
fontSize: 24.0,
|
||||
@@ -24,7 +24,7 @@ class ModalBottomSheetDemo extends StatelessComponent {
|
||||
showModalBottomSheet/*<Null>*/(context: context, builder: (BuildContext context) {
|
||||
return new Container(
|
||||
child: new Padding(
|
||||
padding: const EdgeDims.all(32.0),
|
||||
padding: const EdgeInsets.all(32.0),
|
||||
child: new Text("This is the modal bottom sheet. Click anywhere to dismiss.", style: textStyle)
|
||||
)
|
||||
);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class PageSelectorDemo extends StatelessComponent {
|
||||
class PageSelectorDemo extends StatelessWidget {
|
||||
|
||||
void _handleArrowButtonPress(BuildContext context, int delta) {
|
||||
final TabBarSelectionState<IconData> selection = TabBarSelection.of/*<IconData>*/(context);
|
||||
@@ -32,7 +32,7 @@ class PageSelectorDemo extends StatelessComponent {
|
||||
return new Column(
|
||||
children: <Widget>[
|
||||
new Container(
|
||||
margin: const EdgeDims.only(top: 16.0),
|
||||
margin: const EdgeInsets.only(top: 16.0),
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new IconButton(
|
||||
@@ -57,7 +57,7 @@ class PageSelectorDemo extends StatelessComponent {
|
||||
children: icons.map((IconData icon) {
|
||||
return new Container(
|
||||
key: new ObjectKey(icon),
|
||||
padding: const EdgeDims.all(12.0),
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: new Card(
|
||||
child: new Center(
|
||||
child: new Icon(icon: icon, size: 128.0, color: color)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class PersistentBottomSheetDemo extends StatelessComponent {
|
||||
class PersistentBottomSheetDemo extends StatelessWidget {
|
||||
|
||||
final TextStyle textStyle = new TextStyle(
|
||||
color: Colors.indigo[400],
|
||||
@@ -19,7 +19,7 @@ class PersistentBottomSheetDemo extends StatelessComponent {
|
||||
border: new Border(top: new BorderSide(color: Colors.black26, width: 1.0))
|
||||
),
|
||||
child: new Padding(
|
||||
padding: const EdgeDims.all(32.0),
|
||||
padding: const EdgeInsets.all(32.0),
|
||||
child: new Text("This is a Material persistent bottom sheet. Drag downwards to dismiss it.", style: textStyle)
|
||||
)
|
||||
);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ProgressIndicatorDemo extends StatefulComponent {
|
||||
class ProgressIndicatorDemo extends StatefulWidget {
|
||||
_ProgressIndicatorDemoState createState() => new _ProgressIndicatorDemoState();
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> {
|
||||
];
|
||||
return new Column(
|
||||
children: indicators
|
||||
.map((Widget c) => new Container(child: c, margin: const EdgeDims.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(),
|
||||
justifyContent: FlexJustifyContent.center
|
||||
);
|
||||
@@ -85,12 +85,12 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> {
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(center: new Text('Progress Indicators')),
|
||||
body: new DefaultTextStyle(
|
||||
style: Theme.of(context).text.title,
|
||||
style: Theme.of(context).textTheme.title,
|
||||
child: new GestureDetector(
|
||||
onTap: _handleTap,
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: new Container(
|
||||
padding: const EdgeDims.symmetric(vertical: 12.0, horizontal: 8.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 8.0),
|
||||
child: new AnimatedBuilder(
|
||||
animation: animation,
|
||||
builder: _buildIndicators
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import 'flexible_space_demo.dart';
|
||||
|
||||
class _BarGraphic extends StatelessComponent {
|
||||
class _BarGraphic extends StatelessWidget {
|
||||
_BarGraphic({ Key key, this.height, this.color, this.leftText, this.rightText: '' })
|
||||
: super(key: key) {
|
||||
assert(height != null);
|
||||
@@ -23,10 +23,10 @@ class _BarGraphic extends StatelessComponent {
|
||||
return new Container(
|
||||
height: height,
|
||||
width: 200.0,
|
||||
padding: const EdgeDims.symmetric(horizontal: 16.0),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
decoration: new BoxDecoration(backgroundColor: color),
|
||||
child: new DefaultTextStyle(
|
||||
style: Theme.of(context).text.body1.copyWith(color: Colors.white),
|
||||
style: Theme.of(context).textTheme.body1.copyWith(color: Colors.white),
|
||||
child: new Row(
|
||||
justifyContent: FlexJustifyContent.spaceBetween,
|
||||
children: <Widget>[
|
||||
@@ -74,7 +74,7 @@ class _FlexibleSpaceGraphic extends _BarGraphic {
|
||||
);
|
||||
}
|
||||
|
||||
class _TechniqueItem extends StatelessComponent {
|
||||
class _TechniqueItem extends StatelessWidget {
|
||||
_TechniqueItem({ this.titleText, this.barGraphics, this.builder });
|
||||
|
||||
final String titleText;
|
||||
@@ -90,7 +90,7 @@ class _TechniqueItem extends StatelessComponent {
|
||||
child: new InkWell(
|
||||
onTap: () { showDemo(context); },
|
||||
child: new Padding(
|
||||
padding: const EdgeDims.all(16.0),
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: new Row(
|
||||
justifyContent: FlexJustifyContent.spaceBetween,
|
||||
children :<Widget>[
|
||||
@@ -110,17 +110,17 @@ const String _introText =
|
||||
"it appears behind the device's status bar. When a flexible space Widget is "
|
||||
"specified it is stacked on top of the ToolBar.";
|
||||
|
||||
class ScrollingTechniquesDemo extends StatelessComponent {
|
||||
class ScrollingTechniquesDemo extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(center: new Text('Scrolling Techniques')),
|
||||
body: new Padding(
|
||||
padding: const EdgeDims.symmetric(horizontal: 16.0),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: new Block(
|
||||
children: <Widget>[
|
||||
new Padding(
|
||||
padding: const EdgeDims.symmetric(horizontal: 16.0, vertical: 32.0),
|
||||
child: new Text(_introText, style: Theme.of(context).text.caption)
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 32.0),
|
||||
child: new Text(_introText, style: Theme.of(context).textTheme.caption)
|
||||
),
|
||||
new _TechniqueItem(
|
||||
builder: (BuildContext context) => new FlexibleSpaceDemo(),
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class SliderDemo extends StatefulComponent {
|
||||
class SliderDemo extends StatefulWidget {
|
||||
_SliderDemoState createState() => new _SliderDemoState();
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class _SliderDemoState extends State<SliderDemo> {
|
||||
}
|
||||
),
|
||||
new Container(
|
||||
padding: const EdgeDims.symmetric(horizontal: 16.0),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: new Text(_value.round().toString().padLeft(3, '0'))
|
||||
),
|
||||
],
|
||||
@@ -47,7 +47,7 @@ class _SliderDemoState extends State<SliderDemo> {
|
||||
// Disabled, but tracking the slider above.
|
||||
new Slider(value: _value / 100.0),
|
||||
new Container(
|
||||
padding: const EdgeDims.symmetric(horizontal: 16.0),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: new Text((_value / 100.0).toStringAsFixed(2))
|
||||
),
|
||||
],
|
||||
|
||||
@@ -17,12 +17,12 @@ const String _text2 =
|
||||
const String _text3 =
|
||||
"By default snackbars automatically disappear after a few seconds ";
|
||||
|
||||
class SnackBarDemo extends StatelessComponent {
|
||||
class SnackBarDemo extends StatelessWidget {
|
||||
SnackBarDemo({ Key key }) : super(key: key);
|
||||
|
||||
Widget buildBody(BuildContext context) {
|
||||
return new Padding(
|
||||
padding: const EdgeDims.all(24.0),
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: new Column(
|
||||
children: <Widget>[
|
||||
new Text(_text1),
|
||||
@@ -47,7 +47,7 @@ class SnackBarDemo extends StatelessComponent {
|
||||
]
|
||||
.map((Widget child) {
|
||||
return new Container(
|
||||
margin: const EdgeDims.symmetric(vertical: 12.0),
|
||||
margin: const EdgeInsets.symmetric(vertical: 12.0),
|
||||
child: child
|
||||
);
|
||||
})
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class TabsDemo extends StatelessComponent {
|
||||
class TabsDemo extends StatelessWidget {
|
||||
final List<IconData> icons = <IconData>[
|
||||
Icons.event,
|
||||
Icons.home,
|
||||
@@ -42,7 +42,7 @@ class TabsDemo extends StatelessComponent {
|
||||
children: icons.map((IconData icon) {
|
||||
return new Container(
|
||||
key: new ObjectKey(icon),
|
||||
padding: const EdgeDims.all(12.0),
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: new Card(
|
||||
child: new Center(
|
||||
child: new Icon(
|
||||
|
||||
@@ -25,7 +25,7 @@ const String _explanatoryText =
|
||||
"with a FloatingActionButton that the Scaffold distinguishes from the others "
|
||||
"by its key.";
|
||||
|
||||
class TabsFabDemo extends StatefulComponent {
|
||||
class TabsFabDemo extends StatefulWidget {
|
||||
_TabsFabDemoState createState() => new _TabsFabDemoState();
|
||||
}
|
||||
|
||||
@@ -59,8 +59,8 @@ class _TabsFabDemoState extends State<TabsFabDemo> {
|
||||
border: new Border(top: new BorderSide(color: Theme.of(context).dividerColor))
|
||||
),
|
||||
child: new Padding(
|
||||
padding: const EdgeDims.all(32.0),
|
||||
child: new Text(_explanatoryText, style: Theme.of(context).text.subhead)
|
||||
padding: const EdgeInsets.all(32.0),
|
||||
child: new Text(_explanatoryText, style: Theme.of(context).textTheme.subhead)
|
||||
)
|
||||
);
|
||||
});
|
||||
@@ -77,7 +77,7 @@ class _TabsFabDemoState extends State<TabsFabDemo> {
|
||||
|
||||
return new Container(
|
||||
key: new ValueKey<String>(page.label),
|
||||
padding: const EdgeDims.TRBL(48.0, 48.0, 96.0, 48.0),
|
||||
padding: const EdgeInsets.TRBL(48.0, 48.0, 96.0, 48.0),
|
||||
child: new Card(
|
||||
child: new Center(
|
||||
child: new Text(page.label, style: textStyle)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class TextFieldDemo extends StatefulComponent {
|
||||
class TextFieldDemo extends StatefulWidget {
|
||||
TextFieldDemo({ Key key }) : super(key: key);
|
||||
|
||||
TextFieldDemoState createState() => new TextFieldDemoState();
|
||||
@@ -66,7 +66,7 @@ class TextFieldDemoState extends State<TextFieldDemo> {
|
||||
center: new Text('Text Fields')
|
||||
),
|
||||
body: new Block(
|
||||
padding: const EdgeDims.all(8.0),
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
children: <Widget>[
|
||||
new Input(
|
||||
hintText: 'What do people call you?',
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class TimePickerDemo extends StatefulComponent {
|
||||
class TimePickerDemo extends StatefulWidget {
|
||||
_TimePickerDemoState createState() => new _TimePickerDemoState();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ToggleControlsDemo extends StatefulComponent {
|
||||
class ToggleControlsDemo extends StatefulWidget {
|
||||
_ToggleControlsDemoState createState() => new _ToggleControlsDemoState();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ const String _introText =
|
||||
"a long press. Tooltip messages are also used by services that make Flutter "
|
||||
"apps accessible, like screen readers.";
|
||||
|
||||
class TooltipDemo extends StatelessComponent {
|
||||
class TooltipDemo extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final ThemeData theme = Theme.of(context);
|
||||
return new Scaffold(
|
||||
@@ -21,10 +21,10 @@ class TooltipDemo extends StatelessComponent {
|
||||
return new Column(
|
||||
alignItems: FlexAlignItems.stretch,
|
||||
children: <Widget>[
|
||||
new Text(_introText, style: theme.text.subhead),
|
||||
new Text(_introText, style: theme.textTheme.subhead),
|
||||
new Row(
|
||||
children: <Widget>[
|
||||
new Text('Long press the ', style: theme.text.subhead),
|
||||
new Text('Long press the ', style: theme.textTheme.subhead),
|
||||
new Tooltip(
|
||||
message: 'call icon',
|
||||
child: new Icon(
|
||||
@@ -33,7 +33,7 @@ class TooltipDemo extends StatelessComponent {
|
||||
color: theme.primaryColor
|
||||
)
|
||||
),
|
||||
new Text(' icon', style: theme.text.subhead)
|
||||
new Text(' icon', style: theme.textTheme.subhead)
|
||||
]
|
||||
),
|
||||
new Center(
|
||||
@@ -52,7 +52,7 @@ class TooltipDemo extends StatelessComponent {
|
||||
]
|
||||
.map((Widget widget) {
|
||||
return new Padding(
|
||||
padding: const EdgeDims.only(top: 16.0, left: 16.0, right: 16.0),
|
||||
padding: const EdgeInsets.only(top: 16.0, left: 16.0, right: 16.0),
|
||||
child: widget
|
||||
);
|
||||
})
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class TwoLevelListDemo extends StatelessComponent {
|
||||
class TwoLevelListDemo extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(center: new Text('Expand/Collapse List Control')),
|
||||
body: new Padding(
|
||||
padding: const EdgeDims.all(0.0),
|
||||
padding: const EdgeInsets.all(0.0),
|
||||
child: new TwoLevelList(
|
||||
type: MaterialListType.oneLine,
|
||||
items: <Widget>[
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
class TextStyleItem extends StatelessComponent {
|
||||
class TextStyleItem extends StatelessWidget {
|
||||
TextStyleItem({ Key key, this.name, this.style, this.text }) : super(key: key) {
|
||||
assert(name != null);
|
||||
assert(style != null);
|
||||
@@ -18,9 +18,9 @@ class TextStyleItem extends StatelessComponent {
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
final ThemeData theme = Theme.of(context);
|
||||
final TextStyle nameStyle = theme.text.body1.copyWith(color: theme.text.caption.color);
|
||||
final TextStyle nameStyle = theme.textTheme.body1.copyWith(color: theme.textTheme.caption.color);
|
||||
return new Padding(
|
||||
padding: const EdgeDims.symmetric(horizontal: 8.0, vertical: 16.0),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 16.0),
|
||||
child: new Row(
|
||||
alignItems: FlexAlignItems.start,
|
||||
children: <Widget>[
|
||||
@@ -37,9 +37,9 @@ class TextStyleItem extends StatelessComponent {
|
||||
}
|
||||
}
|
||||
|
||||
class TypographyDemo extends StatelessComponent {
|
||||
class TypographyDemo extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final TextTheme textTheme = Theme.of(context).text;
|
||||
final TextTheme textTheme = Theme.of(context).textTheme;
|
||||
final List<Widget> styleItems = <Widget>[
|
||||
new TextStyleItem(name: 'display3', style: textTheme.display3, text: 'Regular 56sp'),
|
||||
new TextStyleItem(name: 'display2', style: textTheme.display2, text: 'Regular 45sp'),
|
||||
|
||||
@@ -17,7 +17,7 @@ enum WeatherType {
|
||||
snow
|
||||
}
|
||||
|
||||
class WeatherDemo extends StatefulComponent {
|
||||
class WeatherDemo extends StatefulWidget {
|
||||
WeatherDemo({ Key key }) : super(key: key);
|
||||
_WeatherDemoState createState() => new _WeatherDemoState();
|
||||
}
|
||||
@@ -125,7 +125,7 @@ class _WeatherDemoState extends State<WeatherDemo> {
|
||||
const double _kWeatherButtonSize = 56.0;
|
||||
const double _kWeatherIconSize = 36.0;
|
||||
|
||||
class WeatherButton extends StatelessComponent {
|
||||
class WeatherButton extends StatelessWidget {
|
||||
WeatherButton({ this.icon, this.selected, this.onPressed, Key key }) : super(key: key);
|
||||
|
||||
final String icon;
|
||||
@@ -140,7 +140,7 @@ class WeatherButton extends StatelessComponent {
|
||||
color = const Color(0x33000000);
|
||||
|
||||
return new Padding(
|
||||
padding: const EdgeDims.all(15.0),
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: new Material(
|
||||
color: color,
|
||||
type: MaterialType.circle,
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import 'home.dart';
|
||||
|
||||
class GalleryApp extends StatefulComponent {
|
||||
class GalleryApp extends StatefulWidget {
|
||||
GalleryApp({ Key key }) : super(key: key);
|
||||
|
||||
static GalleryAppState of(BuildContext context) => context.ancestorStateOfType(const TypeMatcher<GalleryAppState>());
|
||||
|
||||
@@ -8,7 +8,7 @@ import 'package:flutter/widgets.dart';
|
||||
|
||||
import 'app.dart';
|
||||
|
||||
class GalleryDrawer extends StatelessComponent {
|
||||
class GalleryDrawer extends StatelessWidget {
|
||||
GalleryDrawer({ Key key }) : super(key: key);
|
||||
|
||||
void _changeTheme(BuildContext context, bool value) {
|
||||
|
||||
@@ -39,7 +39,7 @@ import '../demo/two_level_list_demo.dart';
|
||||
import '../demo/typography_demo.dart';
|
||||
import '../demo/weather_demo.dart';
|
||||
|
||||
class GalleryHome extends StatefulComponent {
|
||||
class GalleryHome extends StatefulWidget {
|
||||
GalleryHome({ Key key }) : super(key: key);
|
||||
|
||||
GalleryHomeState createState() => new GalleryHomeState();
|
||||
@@ -53,7 +53,7 @@ class GalleryHomeState extends State<GalleryHome> {
|
||||
toolBar: new ToolBar(
|
||||
flexibleSpace: (BuildContext context) {
|
||||
return new Container(
|
||||
padding: const EdgeDims.only(left: 16.0, bottom: 24.0),
|
||||
padding: const EdgeInsets.only(left: 16.0, bottom: 24.0),
|
||||
height: 128.0,
|
||||
child: new Align(
|
||||
alignment: const FractionalOffset(0.0, 1.0),
|
||||
@@ -63,7 +63,7 @@ class GalleryHomeState extends State<GalleryHome> {
|
||||
}
|
||||
),
|
||||
body: new Block(
|
||||
padding: const EdgeDims.all(4.0),
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
children: <Widget>[
|
||||
new Row(
|
||||
children: <Widget>[
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'package:flutter/widgets.dart';
|
||||
|
||||
import 'demo.dart';
|
||||
|
||||
class GallerySection extends StatelessComponent {
|
||||
class GallerySection extends StatelessWidget {
|
||||
GallerySection({ this.title, this.image, this.colors, this.demos });
|
||||
|
||||
final String title;
|
||||
@@ -45,7 +45,7 @@ class GallerySection extends StatelessComponent {
|
||||
body: new Material(
|
||||
child: new MaterialList(
|
||||
scrollableKey: scrollableKey,
|
||||
scrollablePadding: new EdgeDims.only(top: appBarHeight),
|
||||
scrollablePadding: new EdgeInsets.only(top: appBarHeight),
|
||||
type: MaterialListType.oneLine,
|
||||
children: (demos ?? const <GalleryDemo>[]).map((GalleryDemo demo) {
|
||||
return new ListItem(
|
||||
@@ -66,7 +66,7 @@ class GallerySection extends StatelessComponent {
|
||||
brightness: Theme.of(context).brightness,
|
||||
primarySwatch: colors
|
||||
);
|
||||
final TextStyle titleTextStyle = theme.text.title.copyWith(
|
||||
final TextStyle titleTextStyle = theme.textTheme.title.copyWith(
|
||||
color: Colors.white
|
||||
);
|
||||
return new Flexible(
|
||||
@@ -75,13 +75,13 @@ class GallerySection extends StatelessComponent {
|
||||
onTap: () { showDemos(context); },
|
||||
child: new Container(
|
||||
height: 256.0,
|
||||
margin: const EdgeDims.all(4.0),
|
||||
margin: const EdgeInsets.all(4.0),
|
||||
decoration: new BoxDecoration(backgroundColor: theme.primaryColor),
|
||||
child: new Column(
|
||||
children: <Widget>[
|
||||
new Flexible(
|
||||
child: new Padding(
|
||||
padding: const EdgeDims.symmetric(horizontal: 12.0),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12.0),
|
||||
child: new AssetImage(
|
||||
name: image,
|
||||
alignment: const FractionalOffset(0.5, 0.5),
|
||||
@@ -90,7 +90,7 @@ class GallerySection extends StatelessComponent {
|
||||
)
|
||||
),
|
||||
new Padding(
|
||||
padding: const EdgeDims.all(16.0),
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: new Align(
|
||||
alignment: const FractionalOffset(0.0, 1.0),
|
||||
child: new Text(title, style: titleTextStyle)
|
||||
|
||||
@@ -23,7 +23,7 @@ import 'stock_strings.dart';
|
||||
import 'stock_symbol_viewer.dart';
|
||||
import 'stock_types.dart';
|
||||
|
||||
class StocksApp extends StatefulComponent {
|
||||
class StocksApp extends StatefulWidget {
|
||||
StocksAppState createState() => new StocksAppState();
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class StockArrowPainter extends CustomPainter {
|
||||
}
|
||||
}
|
||||
|
||||
class StockArrow extends StatelessComponent {
|
||||
class StockArrow extends StatelessWidget {
|
||||
StockArrow({ Key key, this.percentChange }) : super(key: key);
|
||||
|
||||
final double percentChange;
|
||||
@@ -71,7 +71,7 @@ class StockArrow extends StatelessComponent {
|
||||
return new Container(
|
||||
width: 40.0,
|
||||
height: 40.0,
|
||||
margin: const EdgeDims.symmetric(horizontal: 5.0),
|
||||
margin: const EdgeInsets.symmetric(horizontal: 5.0),
|
||||
child: new CustomPaint(
|
||||
painter: new StockArrowPainter(
|
||||
// TODO(jackson): This should change colors with the theme
|
||||
|
||||
@@ -18,7 +18,7 @@ typedef void ModeUpdater(StockMode mode);
|
||||
enum _StockMenuItem { autorefresh, refresh, speedUp, speedDown }
|
||||
enum StockHomeTab { market, portfolio }
|
||||
|
||||
class _NotImplementedDialog extends StatelessComponent {
|
||||
class _NotImplementedDialog extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return new Dialog(
|
||||
title: new Text('Not Implemented'),
|
||||
@@ -50,7 +50,7 @@ class _NotImplementedDialog extends StatelessComponent {
|
||||
}
|
||||
}
|
||||
|
||||
class StockHome extends StatefulComponent {
|
||||
class StockHome extends StatefulWidget {
|
||||
const StockHome(this.stocks, this.symbols, this.configuration, this.updater);
|
||||
|
||||
final Map<String, Stock> stocks;
|
||||
@@ -355,7 +355,7 @@ class StockHomeState extends State<StockHome> {
|
||||
}
|
||||
}
|
||||
|
||||
class _CreateCompanySheet extends StatefulComponent {
|
||||
class _CreateCompanySheet extends StatefulWidget {
|
||||
_CreateCompanySheetState createState() => new _CreateCompanySheetState();
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
|
||||
import 'stock_data.dart';
|
||||
import 'stock_row.dart';
|
||||
|
||||
class StockList extends StatelessComponent {
|
||||
class StockList extends StatelessWidget {
|
||||
StockList({ Key key, this.keySalt, this.stocks, this.onOpen, this.onShow, this.onAction }) : super(key: key);
|
||||
|
||||
final Object keySalt;
|
||||
|
||||
@@ -30,7 +30,7 @@ class StockRowPartKey extends Key {
|
||||
|
||||
typedef void StockRowActionCallback(Stock stock, Key arrowKey);
|
||||
|
||||
class StockRow extends StatelessComponent {
|
||||
class StockRow extends StatelessWidget {
|
||||
StockRow({
|
||||
Stock stock,
|
||||
Object keySalt,
|
||||
@@ -64,7 +64,7 @@ class StockRow extends StatelessComponent {
|
||||
onDoubleTap: _getHandler(onDoubleTap),
|
||||
onLongPress: _getHandler(onLongPressed),
|
||||
child: new Container(
|
||||
padding: const EdgeDims.TRBL(16.0, 16.0, 20.0, 16.0),
|
||||
padding: const EdgeInsets.TRBL(16.0, 16.0, 20.0, 16.0),
|
||||
decoration: new BoxDecoration(
|
||||
border: new Border(
|
||||
bottom: new BorderSide(color: Theme.of(context).dividerColor)
|
||||
@@ -73,7 +73,7 @@ class StockRow extends StatelessComponent {
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Container(
|
||||
margin: const EdgeDims.only(right: 5.0),
|
||||
margin: const EdgeInsets.only(right: 5.0),
|
||||
child: new Hero(
|
||||
tag: StockRowPartKind.arrow,
|
||||
key: _arrowKey,
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import 'stock_types.dart';
|
||||
|
||||
class StockSettings extends StatefulComponent {
|
||||
class StockSettings extends StatefulWidget {
|
||||
const StockSettings(this.configuration, this.updater);
|
||||
|
||||
final StockConfiguration configuration;
|
||||
@@ -241,7 +241,7 @@ class StockSettingsState extends State<StockSettings> {
|
||||
});
|
||||
return new Block(
|
||||
children: rows,
|
||||
padding: const EdgeDims.symmetric(vertical: 20.0)
|
||||
padding: const EdgeInsets.symmetric(vertical: 20.0)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import 'stock_data.dart';
|
||||
import 'stock_arrow.dart';
|
||||
import 'stock_row.dart';
|
||||
|
||||
class StockSymbolView extends StatelessComponent {
|
||||
class StockSymbolView extends StatelessWidget {
|
||||
StockSymbolView({ this.stock });
|
||||
|
||||
final Stock stock;
|
||||
@@ -19,16 +19,16 @@ class StockSymbolView extends StatelessComponent {
|
||||
if (stock.percentChange > 0)
|
||||
changeInPrice = "+" + changeInPrice;
|
||||
|
||||
TextStyle headings = Theme.of(context).text.body2;
|
||||
TextStyle headings = Theme.of(context).textTheme.body2;
|
||||
return new Container(
|
||||
padding: new EdgeDims.all(20.0),
|
||||
padding: new EdgeInsets.all(20.0),
|
||||
child: new Column(
|
||||
children: <Widget>[
|
||||
new Row(
|
||||
children: <Widget>[
|
||||
new Text(
|
||||
'${stock.symbol}',
|
||||
style: Theme.of(context).text.display2
|
||||
style: Theme.of(context).textTheme.display2
|
||||
),
|
||||
new Hero(
|
||||
key: new ObjectKey(stock),
|
||||
@@ -66,7 +66,7 @@ class StockSymbolView extends StatelessComponent {
|
||||
}
|
||||
}
|
||||
|
||||
class StockSymbolPage extends StatelessComponent {
|
||||
class StockSymbolPage extends StatelessWidget {
|
||||
StockSymbolPage({ this.stock });
|
||||
|
||||
final Stock stock;
|
||||
@@ -79,7 +79,7 @@ class StockSymbolPage extends StatelessComponent {
|
||||
body: new Block(
|
||||
children: <Widget>[
|
||||
new Container(
|
||||
margin: new EdgeDims.all(20.0),
|
||||
margin: new EdgeInsets.all(20.0),
|
||||
child: new Card(child: new StockSymbolView(stock: stock))
|
||||
)
|
||||
]
|
||||
@@ -88,14 +88,14 @@ class StockSymbolPage extends StatelessComponent {
|
||||
}
|
||||
}
|
||||
|
||||
class StockSymbolBottomSheet extends StatelessComponent {
|
||||
class StockSymbolBottomSheet extends StatelessWidget {
|
||||
StockSymbolBottomSheet({ this.stock });
|
||||
|
||||
final Stock stock;
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return new Container(
|
||||
padding: new EdgeDims.all(10.0),
|
||||
padding: new EdgeInsets.all(10.0),
|
||||
decoration: new BoxDecoration(
|
||||
border: new Border(top: new BorderSide(color: Colors.black26, width: 1.0))
|
||||
),
|
||||
|
||||
@@ -16,7 +16,7 @@ export 'src/painting/basic_types.dart';
|
||||
export 'src/painting/box_painter.dart';
|
||||
export 'src/painting/colors.dart';
|
||||
export 'src/painting/decoration.dart';
|
||||
export 'src/painting/edge_dims.dart';
|
||||
export 'src/painting/edge_insets.dart';
|
||||
export 'src/painting/text_editing.dart';
|
||||
export 'src/painting/text_painter.dart';
|
||||
export 'src/painting/text_style.dart';
|
||||
|
||||
@@ -15,38 +15,38 @@ enum GestureDisposition {
|
||||
///
|
||||
/// Receives callbacks from the GestureArena to notify the object when it wins
|
||||
/// or loses a gesture negotiation. Exactly one of [acceptGesture] or
|
||||
/// [rejectGesture] will be called for each arena key this member was added to,
|
||||
/// [rejectGesture] will be called for each arena this member was added to,
|
||||
/// regardless of what caused the arena to be resolved. For example, if a
|
||||
/// member resolves the arena itself, that member still receives an
|
||||
/// [acceptGesture] callback.
|
||||
abstract class GestureArenaMember {
|
||||
/// Called when this member wins the arena for the given key.
|
||||
void acceptGesture(Object key);
|
||||
/// Called when this member wins the arena for the given pointer id.
|
||||
void acceptGesture(int pointer);
|
||||
|
||||
/// Called when this member loses the arena for the given key.
|
||||
void rejectGesture(Object key);
|
||||
/// Called when this member loses the arena for the given pointer id.
|
||||
void rejectGesture(int pointer);
|
||||
}
|
||||
|
||||
/// An interface to information to an arena.
|
||||
///
|
||||
/// A given [GestureArenaMember] can have multiple entries in multiple arenas
|
||||
/// with different keys.
|
||||
/// with different pointer ids.
|
||||
class GestureArenaEntry {
|
||||
GestureArenaEntry._(this._arena, this._key, this._member);
|
||||
GestureArenaEntry._(this._arena, this._pointer, this._member);
|
||||
|
||||
final GestureArena _arena;
|
||||
final Object _key;
|
||||
final GestureArenaManager _arena;
|
||||
final int _pointer;
|
||||
final GestureArenaMember _member;
|
||||
|
||||
/// Call this member to claim victory (with accepted) or admit defeat (with rejected).
|
||||
///
|
||||
/// It's fine to attempt to resolve an arena that is already resolved.
|
||||
void resolve(GestureDisposition disposition) {
|
||||
_arena._resolve(_key, _member, disposition);
|
||||
_arena._resolve(_pointer, _member, disposition);
|
||||
}
|
||||
}
|
||||
|
||||
class _GestureArenaState {
|
||||
class _GestureArena {
|
||||
final List<GestureArenaMember> members = new List<GestureArenaMember>();
|
||||
bool isOpen = true;
|
||||
bool isHeld = false;
|
||||
@@ -68,30 +68,30 @@ class _GestureArenaState {
|
||||
///
|
||||
/// See [https://flutter.io/gestures/#gesture-disambiguation] for more
|
||||
/// information about the role this class plays in the gesture system.
|
||||
class GestureArena {
|
||||
final Map<Object, _GestureArenaState> _arenas = new Map<Object, _GestureArenaState>();
|
||||
class GestureArenaManager {
|
||||
final Map<int, _GestureArena> _arenas = new Map<int, _GestureArena>();
|
||||
|
||||
/// Adds a new member (e.g., gesture recognizer) to the arena.
|
||||
GestureArenaEntry add(Object arenaKey, GestureArenaMember member) {
|
||||
_GestureArenaState state = _arenas.putIfAbsent(arenaKey, () => new _GestureArenaState());
|
||||
GestureArenaEntry add(int pointer, GestureArenaMember member) {
|
||||
_GestureArena state = _arenas.putIfAbsent(pointer, () => new _GestureArena());
|
||||
state.add(member);
|
||||
return new GestureArenaEntry._(this, arenaKey, member);
|
||||
return new GestureArenaEntry._(this, pointer, member);
|
||||
}
|
||||
|
||||
/// Prevents new members from entering the arena.
|
||||
///
|
||||
/// Called after the framework has finished dispatching the pointer down event.
|
||||
void close(Object arenaKey) {
|
||||
_GestureArenaState state = _arenas[arenaKey];
|
||||
void close(int pointer) {
|
||||
_GestureArena state = _arenas[pointer];
|
||||
if (state == null)
|
||||
return; // This arena either never existed or has been resolved.
|
||||
state.isOpen = false;
|
||||
_tryToResolveArena(arenaKey, state);
|
||||
_tryToResolveArena(pointer, state);
|
||||
}
|
||||
|
||||
/// Forces resolution of the arena, giving the win to the first member.
|
||||
void sweep(Object arenaKey) {
|
||||
_GestureArenaState state = _arenas[arenaKey];
|
||||
void sweep(int pointer) {
|
||||
_GestureArena state = _arenas[pointer];
|
||||
if (state == null)
|
||||
return; // This arena either never existed or has been resolved.
|
||||
assert(!state.isOpen);
|
||||
@@ -99,19 +99,19 @@ class GestureArena {
|
||||
state.hasPendingSweep = true;
|
||||
return; // This arena is being held for a long-lived member
|
||||
}
|
||||
_arenas.remove(arenaKey);
|
||||
_arenas.remove(pointer);
|
||||
if (state.members.isNotEmpty) {
|
||||
// First member wins
|
||||
state.members.first.acceptGesture(arenaKey);
|
||||
state.members.first.acceptGesture(pointer);
|
||||
// Give all the other members the bad news
|
||||
for (int i = 1; i < state.members.length; i++)
|
||||
state.members[i].rejectGesture(arenaKey);
|
||||
state.members[i].rejectGesture(pointer);
|
||||
}
|
||||
}
|
||||
|
||||
/// Prevents the arena from being swept.
|
||||
void hold(Object key) {
|
||||
_GestureArenaState state = _arenas[key];
|
||||
void hold(int pointer) {
|
||||
_GestureArena state = _arenas[pointer];
|
||||
if (state == null)
|
||||
return; // This arena either never existed or has been resolved.
|
||||
state.isHeld = true;
|
||||
@@ -121,58 +121,58 @@ class GestureArena {
|
||||
///
|
||||
/// If a sweep was attempted on a held arena, the sweep will be done
|
||||
/// on release.
|
||||
void release(Object arenaKey) {
|
||||
_GestureArenaState state = _arenas[arenaKey];
|
||||
void release(int pointer) {
|
||||
_GestureArena state = _arenas[pointer];
|
||||
if (state == null)
|
||||
return; // This arena either never existed or has been resolved.
|
||||
state.isHeld = false;
|
||||
if (state.hasPendingSweep)
|
||||
sweep(arenaKey);
|
||||
sweep(pointer);
|
||||
}
|
||||
|
||||
void _tryToResolveArena(Object arenaKey, _GestureArenaState state) {
|
||||
assert(_arenas[arenaKey] == state);
|
||||
void _tryToResolveArena(int pointer, _GestureArena state) {
|
||||
assert(_arenas[pointer] == state);
|
||||
assert(!state.isOpen);
|
||||
if (state.members.length == 1) {
|
||||
_arenas.remove(arenaKey);
|
||||
state.members.first.acceptGesture(arenaKey);
|
||||
_arenas.remove(pointer);
|
||||
state.members.first.acceptGesture(pointer);
|
||||
} else if (state.members.isEmpty) {
|
||||
_arenas.remove(arenaKey);
|
||||
_arenas.remove(pointer);
|
||||
} else if (state.eagerWinner != null) {
|
||||
_resolveInFavorOf(arenaKey, state, state.eagerWinner);
|
||||
_resolveInFavorOf(pointer, state, state.eagerWinner);
|
||||
}
|
||||
}
|
||||
|
||||
void _resolve(Object arenaKey, GestureArenaMember member, GestureDisposition disposition) {
|
||||
_GestureArenaState state = _arenas[arenaKey];
|
||||
void _resolve(int pointer, GestureArenaMember member, GestureDisposition disposition) {
|
||||
_GestureArena state = _arenas[pointer];
|
||||
if (state == null)
|
||||
return; // This arena has already resolved.
|
||||
assert(state.members.contains(member));
|
||||
if (disposition == GestureDisposition.rejected) {
|
||||
state.members.remove(member);
|
||||
member.rejectGesture(arenaKey);
|
||||
member.rejectGesture(pointer);
|
||||
if (!state.isOpen)
|
||||
_tryToResolveArena(arenaKey, state);
|
||||
_tryToResolveArena(pointer, state);
|
||||
} else {
|
||||
assert(disposition == GestureDisposition.accepted);
|
||||
if (state.isOpen) {
|
||||
state.eagerWinner ??= member;
|
||||
} else {
|
||||
_resolveInFavorOf(arenaKey, state, member);
|
||||
_resolveInFavorOf(pointer, state, member);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _resolveInFavorOf(Object arenaKey, _GestureArenaState state, GestureArenaMember member) {
|
||||
assert(state == _arenas[arenaKey]);
|
||||
void _resolveInFavorOf(int pointer, _GestureArena state, GestureArenaMember member) {
|
||||
assert(state == _arenas[pointer]);
|
||||
assert(state != null);
|
||||
assert(state.eagerWinner == null || state.eagerWinner == member);
|
||||
assert(!state.isOpen);
|
||||
_arenas.remove(arenaKey);
|
||||
_arenas.remove(pointer);
|
||||
for (GestureArenaMember rejectedMember in state.members) {
|
||||
if (rejectedMember != member)
|
||||
rejectedMember.rejectGesture(arenaKey);
|
||||
rejectedMember.rejectGesture(pointer);
|
||||
}
|
||||
member.acceptGesture(arenaKey);
|
||||
member.acceptGesture(pointer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ abstract class Gesturer extends BindingBase implements HitTestTarget, HitTestabl
|
||||
|
||||
/// The gesture arenas used for disambiguating the meaning of sequences of
|
||||
/// pointer events.
|
||||
final GestureArena gestureArena = new GestureArena();
|
||||
final GestureArenaManager gestureArena = new GestureArenaManager();
|
||||
|
||||
/// State for all pointers which are currently down.
|
||||
///
|
||||
|
||||
@@ -31,7 +31,7 @@ abstract class GestureRecognizer extends GestureArenaMember {
|
||||
/// It's the GestureRecognizer's responsibility to then add itself
|
||||
/// to the global pointer router (see [PointerRouter]) to receive
|
||||
/// subsequent events for this pointer, and to add the pointer to
|
||||
/// the global gesture arena manager (see [GestureArena]) to track
|
||||
/// the global gesture arena manager (see [GestureArenaManager]) to track
|
||||
/// that pointer.
|
||||
void addPointer(PointerDownEvent event);
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ const double _kCloseProgressThreshold = 0.5;
|
||||
const Color _kTransparent = const Color(0x00000000);
|
||||
const Color _kBarrierColor = Colors.black54;
|
||||
|
||||
class BottomSheet extends StatefulComponent {
|
||||
class BottomSheet extends StatefulWidget {
|
||||
BottomSheet({
|
||||
Key key,
|
||||
this.animationController,
|
||||
@@ -94,7 +94,7 @@ class _BottomSheetState extends State<BottomSheet> {
|
||||
|
||||
// MODAL BOTTOM SHEETS
|
||||
|
||||
class _ModalBottomSheetLayout extends OneChildLayoutDelegate {
|
||||
class _ModalBottomSheetLayout extends SingleChildLayoutDelegate {
|
||||
_ModalBottomSheetLayout(this.progress);
|
||||
|
||||
final double progress;
|
||||
@@ -117,7 +117,7 @@ class _ModalBottomSheetLayout extends OneChildLayoutDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
class _ModalBottomSheet<T> extends StatefulComponent {
|
||||
class _ModalBottomSheet<T> extends StatefulWidget {
|
||||
_ModalBottomSheet({ Key key, this.route }) : super(key: key);
|
||||
|
||||
final _ModalBottomSheetRoute<T> route;
|
||||
@@ -133,7 +133,7 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> {
|
||||
animation: config.route.animation,
|
||||
builder: (BuildContext context, Widget child) {
|
||||
return new ClipRect(
|
||||
child: new CustomOneChildLayout(
|
||||
child: new CustomSingleChildLayout(
|
||||
delegate: new _ModalBottomSheetLayout(config.route.animation.value),
|
||||
child: new BottomSheet(
|
||||
animationController: config.route.animation,
|
||||
|
||||
@@ -39,7 +39,7 @@ class ButtonTheme extends InheritedWidget {
|
||||
///
|
||||
/// MaterialButtons whose [onPressed] handler is null will be disabled. To have
|
||||
/// an enabled button, make sure to pass a non-null value for onPressed.
|
||||
abstract class MaterialButton extends StatefulComponent {
|
||||
abstract class MaterialButton extends StatefulWidget {
|
||||
MaterialButton({
|
||||
Key key,
|
||||
this.child,
|
||||
@@ -116,14 +116,14 @@ abstract class MaterialButtonState<T extends MaterialButton> extends State<T> {
|
||||
onTap: config.onPressed,
|
||||
onHighlightChanged: _handleHighlightChanged,
|
||||
child: new Container(
|
||||
padding: new EdgeDims.symmetric(horizontal: 8.0),
|
||||
padding: new EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: new Center(
|
||||
widthFactor: 1.0,
|
||||
child: config.child
|
||||
)
|
||||
)
|
||||
);
|
||||
TextStyle style = Theme.of(context).text.button.copyWith(color: getTextColor(context));
|
||||
TextStyle style = Theme.of(context).textTheme.button.copyWith(color: getTextColor(context));
|
||||
int elevation = this.elevation;
|
||||
Color color = getColor(context);
|
||||
if (elevation > 0 || color != null) {
|
||||
@@ -143,8 +143,8 @@ abstract class MaterialButtonState<T extends MaterialButton> extends State<T> {
|
||||
return new Container(
|
||||
height: 36.0,
|
||||
constraints: new BoxConstraints(minWidth: 88.0),
|
||||
padding: const EdgeDims.symmetric(horizontal: 8.0),
|
||||
margin: const EdgeDims.all(8.0),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
margin: const EdgeInsets.all(8.0),
|
||||
child: contents
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,12 +6,12 @@ import 'package:flutter/widgets.dart';
|
||||
|
||||
import 'material.dart';
|
||||
|
||||
const EdgeDims _kCardMargins = const EdgeDims.all(4.0);
|
||||
const EdgeInsets _kCardMargins = const EdgeInsets.all(4.0);
|
||||
|
||||
/// A material design card
|
||||
///
|
||||
/// <https://www.google.com/design/spec/components/cards.html>
|
||||
class Card extends StatelessComponent {
|
||||
class Card extends StatelessWidget {
|
||||
const Card({ Key key, this.child, this.color }) : super(key: key);
|
||||
|
||||
final Widget child;
|
||||
|
||||
@@ -21,7 +21,7 @@ import 'toggleable.dart';
|
||||
/// the checkbox.
|
||||
///
|
||||
/// <https://www.google.com/design/spec/components/lists-controls.html#lists-controls-types-of-list-controls>
|
||||
class Checkbox extends StatelessComponent {
|
||||
class Checkbox extends StatelessWidget {
|
||||
/// Constructs a checkbox
|
||||
///
|
||||
/// * `value` determines whether the checkbox is checked.
|
||||
|
||||
@@ -21,7 +21,7 @@ const TextStyle _kLabelStyle = const TextStyle(
|
||||
textBaseline: TextBaseline.alphabetic
|
||||
);
|
||||
|
||||
class Chip extends StatelessComponent {
|
||||
class Chip extends StatelessWidget {
|
||||
const Chip({
|
||||
Key key,
|
||||
this.avatar,
|
||||
@@ -45,7 +45,7 @@ class Chip extends StatelessComponent {
|
||||
leftPadding = 0.0;
|
||||
children.add(new ExcludeSemantics(
|
||||
child: new Container(
|
||||
margin: const EdgeDims.only(right: 8.0),
|
||||
margin: const EdgeInsets.only(right: 8.0),
|
||||
width: _kAvatarDiamater,
|
||||
height: _kAvatarDiamater,
|
||||
child: avatar
|
||||
@@ -65,7 +65,7 @@ class Chip extends StatelessComponent {
|
||||
child: new Tooltip(
|
||||
message: 'Delete "$label"',
|
||||
child: new Container(
|
||||
padding: const EdgeDims.symmetric(horizontal: 4.0),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
||||
child: new Icon(
|
||||
icon: Icons.cancel,
|
||||
size: 18.0,
|
||||
@@ -80,7 +80,7 @@ class Chip extends StatelessComponent {
|
||||
container: true,
|
||||
child: new Container(
|
||||
height: _kChipHeight,
|
||||
padding: new EdgeDims.only(left: leftPadding, right: rightPadding),
|
||||
padding: new EdgeInsets.only(left: leftPadding, right: rightPadding),
|
||||
decoration: new BoxDecoration(
|
||||
backgroundColor: Colors.grey[300],
|
||||
borderRadius: 16.0
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'package:flutter/widgets.dart';
|
||||
import 'constants.dart';
|
||||
import 'theme.dart';
|
||||
|
||||
class CircleAvatar extends StatelessComponent {
|
||||
class CircleAvatar extends StatelessWidget {
|
||||
CircleAvatar({
|
||||
Key key,
|
||||
this.child,
|
||||
|
||||
@@ -33,7 +33,7 @@ const double kFadingEdgeLength = 12.0;
|
||||
const double kPressedStateDuration = 64.0; // units?
|
||||
const Duration kThemeChangeDuration = const Duration(milliseconds: 200);
|
||||
|
||||
const EdgeDims kDialogHeadingPadding = const EdgeDims.TRBL(24.0, 24.0, 20.0, 24.0);
|
||||
const EdgeInsets kDialogHeadingPadding = const EdgeInsets.TRBL(24.0, 24.0, 20.0, 24.0);
|
||||
|
||||
const double kRadialReactionRadius = 24.0; // Pixels
|
||||
const Duration kRadialReactionDuration = const Duration(milliseconds: 200);
|
||||
|
||||
@@ -17,7 +17,7 @@ import 'typography.dart';
|
||||
|
||||
enum _DatePickerMode { day, year }
|
||||
|
||||
class DatePicker extends StatefulComponent {
|
||||
class DatePicker extends StatefulWidget {
|
||||
DatePicker({
|
||||
this.selectedDate,
|
||||
this.onChanged,
|
||||
@@ -105,7 +105,7 @@ class _DatePickerState extends State<DatePicker> {
|
||||
}
|
||||
|
||||
// Shows the selected date in large font and toggles between year and day mode
|
||||
class _DatePickerHeader extends StatelessComponent {
|
||||
class _DatePickerHeader extends StatelessWidget {
|
||||
_DatePickerHeader({ this.selectedDate, this.mode, this.onModeChanged }) {
|
||||
assert(selectedDate != null);
|
||||
assert(mode != null);
|
||||
@@ -140,7 +140,7 @@ class _DatePickerHeader extends StatelessComponent {
|
||||
TextStyle yearStyle = headerTheme.headline.copyWith(color: yearColor, height: 1.0);
|
||||
|
||||
return new Container(
|
||||
padding: new EdgeDims.all(10.0),
|
||||
padding: new EdgeInsets.all(10.0),
|
||||
decoration: new BoxDecoration(backgroundColor: theme.primaryColor),
|
||||
child: new Column(
|
||||
children: <Widget>[
|
||||
@@ -163,7 +163,7 @@ class _DatePickerHeader extends StatelessComponent {
|
||||
}
|
||||
|
||||
// Fixed height component shows a single month and allows choosing a day
|
||||
class DayPicker extends StatelessComponent {
|
||||
class DayPicker extends StatelessWidget {
|
||||
DayPicker({
|
||||
this.selectedDate,
|
||||
this.currentDate,
|
||||
@@ -183,7 +183,7 @@ class DayPicker extends StatelessComponent {
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
ThemeData themeData = Theme.of(context);
|
||||
TextStyle headerStyle = themeData.text.caption.copyWith(fontWeight: FontWeight.w700);
|
||||
TextStyle headerStyle = themeData.textTheme.caption.copyWith(fontWeight: FontWeight.w700);
|
||||
TextStyle monthStyle = headerStyle.copyWith(fontSize: 14.0, height: 24.0 / 14.0);
|
||||
TextStyle dayStyle = headerStyle.copyWith(fontWeight: FontWeight.w500);
|
||||
DateFormat dateFormat = new DateFormat();
|
||||
@@ -269,7 +269,7 @@ class DayPicker extends StatelessComponent {
|
||||
}
|
||||
}
|
||||
|
||||
class MonthPicker extends StatefulComponent {
|
||||
class MonthPicker extends StatefulWidget {
|
||||
MonthPicker({
|
||||
Key key,
|
||||
this.selectedDate,
|
||||
@@ -351,7 +351,7 @@ class _MonthPickerState extends State<MonthPicker> {
|
||||
}
|
||||
|
||||
// Scrollable list of years to allow picking a year
|
||||
class YearPicker extends StatefulComponent {
|
||||
class YearPicker extends StatefulWidget {
|
||||
YearPicker({
|
||||
Key key,
|
||||
this.selectedDate,
|
||||
@@ -376,7 +376,7 @@ class _YearPickerState extends State<YearPicker> {
|
||||
static const double _itemExtent = 50.0;
|
||||
|
||||
List<Widget> buildItems(BuildContext context, int start, int count) {
|
||||
TextStyle style = Theme.of(context).text.body1.copyWith(color: Colors.black54);
|
||||
TextStyle style = Theme.of(context).textTheme.body1.copyWith(color: Colors.black54);
|
||||
List<Widget> items = new List<Widget>();
|
||||
for (int i = start; i < start + count; i++) {
|
||||
int year = config.firstDate.year + i;
|
||||
|
||||
@@ -10,7 +10,7 @@ import 'dialog.dart';
|
||||
import 'date_picker.dart';
|
||||
import 'flat_button.dart';
|
||||
|
||||
class _DatePickerDialog extends StatefulComponent {
|
||||
class _DatePickerDialog extends StatefulWidget {
|
||||
_DatePickerDialog({
|
||||
Key key,
|
||||
this.initialDate,
|
||||
@@ -55,7 +55,7 @@ class _DatePickerDialogState extends State<_DatePickerDialog> {
|
||||
lastDate: config.lastDate,
|
||||
onChanged: _handleDateChanged
|
||||
),
|
||||
contentPadding: EdgeDims.zero,
|
||||
contentPadding: EdgeInsets.zero,
|
||||
actions: <Widget>[
|
||||
new FlatButton(
|
||||
child: new Text('CANCEL'),
|
||||
|
||||
@@ -16,7 +16,7 @@ typedef Widget DialogBuilder(NavigatorState navigator);
|
||||
/// A material design dialog
|
||||
///
|
||||
/// <https://www.google.com/design/spec/components/dialogs.html>
|
||||
class Dialog extends StatelessComponent {
|
||||
class Dialog extends StatelessWidget {
|
||||
Dialog({
|
||||
Key key,
|
||||
this.title,
|
||||
@@ -32,14 +32,14 @@ class Dialog extends StatelessComponent {
|
||||
|
||||
// Padding around the title; uses material design default if none is supplied
|
||||
// If there is no title, no padding will be provided
|
||||
final EdgeDims titlePadding;
|
||||
final EdgeInsets titlePadding;
|
||||
|
||||
/// The (optional) content of the dialog is displayed in the center of the
|
||||
/// dialog in a lighter font.
|
||||
final Widget content;
|
||||
|
||||
// Padding around the content; uses material design default if none is supplied
|
||||
final EdgeDims contentPadding;
|
||||
final EdgeInsets contentPadding;
|
||||
|
||||
/// The (optional) set of actions that are displayed at the bottom of the
|
||||
/// dialog.
|
||||
@@ -59,26 +59,26 @@ class Dialog extends StatelessComponent {
|
||||
List<Widget> dialogBody = new List<Widget>();
|
||||
|
||||
if (title != null) {
|
||||
EdgeDims padding = titlePadding;
|
||||
EdgeInsets padding = titlePadding;
|
||||
if (padding == null)
|
||||
padding = new EdgeDims.TRBL(24.0, 24.0, content == null ? 20.0 : 0.0, 24.0);
|
||||
padding = new EdgeInsets.TRBL(24.0, 24.0, content == null ? 20.0 : 0.0, 24.0);
|
||||
dialogBody.add(new Padding(
|
||||
padding: padding,
|
||||
child: new DefaultTextStyle(
|
||||
style: Theme.of(context).text.title,
|
||||
style: Theme.of(context).textTheme.title,
|
||||
child: title
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
if (content != null) {
|
||||
EdgeDims padding = contentPadding;
|
||||
EdgeInsets padding = contentPadding;
|
||||
if (padding == null)
|
||||
padding = const EdgeDims.TRBL(20.0, 24.0, 24.0, 24.0);
|
||||
padding = const EdgeInsets.TRBL(20.0, 24.0, 24.0, 24.0);
|
||||
dialogBody.add(new Padding(
|
||||
padding: padding,
|
||||
child: new DefaultTextStyle(
|
||||
style: Theme.of(context).text.subhead,
|
||||
style: Theme.of(context).textTheme.subhead,
|
||||
child: content
|
||||
)
|
||||
));
|
||||
@@ -98,7 +98,7 @@ class Dialog extends StatelessComponent {
|
||||
|
||||
return new Center(
|
||||
child: new Container(
|
||||
margin: new EdgeDims.symmetric(horizontal: 40.0, vertical: 24.0),
|
||||
margin: new EdgeInsets.symmetric(horizontal: 40.0, vertical: 24.0),
|
||||
child: new ConstrainedBox(
|
||||
constraints: new BoxConstraints(minWidth: 280.0),
|
||||
child: new Material(
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:flutter/widgets.dart';
|
||||
|
||||
import 'theme.dart';
|
||||
|
||||
class Divider extends StatelessComponent {
|
||||
class Divider extends StatelessWidget {
|
||||
Divider({ Key key, this.height: 16.0, this.indent: 0.0, this.color }) : super(key: key) {
|
||||
assert(height >= 1.0);
|
||||
}
|
||||
@@ -19,7 +19,7 @@ class Divider extends StatelessComponent {
|
||||
final double bottom = (height ~/ 2.0).toDouble();
|
||||
return new Container(
|
||||
height: 0.0,
|
||||
margin: new EdgeDims.only(
|
||||
margin: new EdgeInsets.only(
|
||||
top: height - bottom - 1.0,
|
||||
left: indent,
|
||||
bottom: bottom
|
||||
|
||||
@@ -26,7 +26,7 @@ const double _kEdgeDragWidth = 20.0;
|
||||
const double _kMinFlingVelocity = 365.0;
|
||||
const Duration _kBaseSettleDuration = const Duration(milliseconds: 246);
|
||||
|
||||
class Drawer extends StatelessComponent {
|
||||
class Drawer extends StatelessWidget {
|
||||
Drawer({
|
||||
Key key,
|
||||
this.elevation: 16,
|
||||
@@ -47,7 +47,7 @@ class Drawer extends StatelessComponent {
|
||||
}
|
||||
}
|
||||
|
||||
class DrawerController extends StatefulComponent {
|
||||
class DrawerController extends StatefulWidget {
|
||||
DrawerController({
|
||||
GlobalKey key,
|
||||
this.child
|
||||
|
||||
@@ -11,14 +11,14 @@ import 'theme.dart';
|
||||
// TODO(jackson): This class should usually render the user's
|
||||
// preferred banner image rather than a solid background
|
||||
|
||||
class DrawerHeader extends StatelessComponent {
|
||||
class DrawerHeader extends StatelessWidget {
|
||||
const DrawerHeader({ Key key, this.child }) : super(key: key);
|
||||
|
||||
final Widget child;
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
assert(debugCheckHasMaterial(context));
|
||||
final double statusBarHeight = (MediaQuery.of(context)?.padding ?? EdgeDims.zero).top;
|
||||
final double statusBarHeight = (MediaQuery.of(context)?.padding ?? EdgeInsets.zero).top;
|
||||
return new Container(
|
||||
height: statusBarHeight + kMaterialDrawerHeight,
|
||||
decoration: new BoxDecoration(
|
||||
@@ -30,15 +30,15 @@ class DrawerHeader extends StatelessComponent {
|
||||
)
|
||||
)
|
||||
),
|
||||
padding: const EdgeDims.only(bottom: 7.0),
|
||||
margin: const EdgeDims.only(bottom: 8.0),
|
||||
padding: const EdgeInsets.only(bottom: 7.0),
|
||||
margin: const EdgeInsets.only(bottom: 8.0),
|
||||
child: new Column(
|
||||
children: <Widget>[
|
||||
new Flexible(child: new Container()),
|
||||
new Container(
|
||||
padding: const EdgeDims.symmetric(horizontal: 16.0),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: new DefaultTextStyle(
|
||||
style: Theme.of(context).text.body2,
|
||||
style: Theme.of(context).textTheme.body2,
|
||||
child: child
|
||||
)
|
||||
)
|
||||
|
||||
@@ -11,7 +11,7 @@ import 'icons.dart';
|
||||
import 'ink_well.dart';
|
||||
import 'theme.dart';
|
||||
|
||||
class DrawerItem extends StatelessComponent {
|
||||
class DrawerItem extends StatelessWidget {
|
||||
const DrawerItem({
|
||||
Key key,
|
||||
this.icon,
|
||||
@@ -43,7 +43,7 @@ class DrawerItem extends StatelessComponent {
|
||||
}
|
||||
|
||||
TextStyle _getTextStyle(ThemeData themeData) {
|
||||
TextStyle result = themeData.text.body2;
|
||||
TextStyle result = themeData.textTheme.body2;
|
||||
if (selected) {
|
||||
switch (themeData.brightness) {
|
||||
case ThemeBrightness.light:
|
||||
@@ -63,7 +63,7 @@ class DrawerItem extends StatelessComponent {
|
||||
if (icon != null) {
|
||||
children.add(
|
||||
new Padding(
|
||||
padding: const EdgeDims.symmetric(horizontal: 16.0),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: new Icon(
|
||||
icon: icon,
|
||||
color: _getIconColor(themeData)
|
||||
@@ -74,7 +74,7 @@ class DrawerItem extends StatelessComponent {
|
||||
children.add(
|
||||
new Flexible(
|
||||
child: new Padding(
|
||||
padding: const EdgeDims.symmetric(horizontal: 16.0),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: new DefaultTextStyle(
|
||||
style: _getTextStyle(themeData),
|
||||
child: child
|
||||
|
||||
@@ -16,7 +16,7 @@ import 'material.dart';
|
||||
|
||||
const Duration _kDropDownMenuDuration = const Duration(milliseconds: 300);
|
||||
const double _kMenuItemHeight = 48.0;
|
||||
const EdgeDims _kMenuHorizontalPadding = const EdgeDims.only(left: 36.0, right: 36.0);
|
||||
const EdgeInsets _kMenuHorizontalPadding = const EdgeInsets.only(left: 36.0, right: 36.0);
|
||||
const double _kBaselineOffsetFromBottom = 20.0;
|
||||
const Border _kDropDownUnderline = const Border(bottom: const BorderSide(color: const Color(0xFFBDBDBD), width: 2.0));
|
||||
|
||||
@@ -56,7 +56,7 @@ class _DropDownMenuPainter extends CustomPainter {
|
||||
}
|
||||
}
|
||||
|
||||
class _DropDownMenu<T> extends StatusTransitionComponent {
|
||||
class _DropDownMenu<T> extends StatusTransitionWidget {
|
||||
_DropDownMenu({
|
||||
Key key,
|
||||
_DropDownRoute<T> route
|
||||
@@ -197,7 +197,7 @@ class _DropDownRoute<T> extends PopupRoute<_DropDownRouteResult<T>> {
|
||||
}
|
||||
}
|
||||
|
||||
class DropDownMenuItem<T> extends StatelessComponent {
|
||||
class DropDownMenuItem<T> extends StatelessWidget {
|
||||
DropDownMenuItem({
|
||||
Key key,
|
||||
this.value,
|
||||
@@ -210,9 +210,9 @@ class DropDownMenuItem<T> extends StatelessComponent {
|
||||
Widget build(BuildContext context) {
|
||||
return new Container(
|
||||
height: _kMenuItemHeight,
|
||||
padding: const EdgeDims.only(left: 8.0, right: 8.0, top: 6.0),
|
||||
padding: const EdgeInsets.only(left: 8.0, right: 8.0, top: 6.0),
|
||||
child: new DefaultTextStyle(
|
||||
style: Theme.of(context).text.subhead,
|
||||
style: Theme.of(context).textTheme.subhead,
|
||||
child: new Baseline(
|
||||
baseline: _kMenuItemHeight - _kBaselineOffsetFromBottom,
|
||||
child: child
|
||||
@@ -222,7 +222,7 @@ class DropDownMenuItem<T> extends StatelessComponent {
|
||||
}
|
||||
}
|
||||
|
||||
class DropDownButton<T> extends StatefulComponent {
|
||||
class DropDownButton<T> extends StatefulWidget {
|
||||
DropDownButton({
|
||||
Key key,
|
||||
this.items,
|
||||
@@ -301,7 +301,7 @@ class _DropDownButtonState<T> extends State<DropDownButton<T>> {
|
||||
),
|
||||
new Container(
|
||||
child: new Icon(icon: Icons.arrow_drop_down, size: 36.0),
|
||||
padding: const EdgeDims.only(top: 6.0)
|
||||
padding: const EdgeInsets.only(top: 6.0)
|
||||
)
|
||||
],
|
||||
justifyContent: FlexJustifyContent.collapse
|
||||
|
||||
@@ -11,7 +11,7 @@ import 'constants.dart';
|
||||
import 'scaffold.dart';
|
||||
import 'theme.dart';
|
||||
|
||||
class FlexibleSpaceBar extends StatefulComponent {
|
||||
class FlexibleSpaceBar extends StatefulWidget {
|
||||
FlexibleSpaceBar({ Key key, this.title, this.image }) : super(key: key);
|
||||
|
||||
final Widget title;
|
||||
@@ -26,7 +26,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
|
||||
assert(debugCheckHasScaffold(context));
|
||||
final double appBarHeight = Scaffold.of(context).appBarHeight;
|
||||
final Animation<double> animation = Scaffold.of(context).appBarAnimation;
|
||||
final EdgeDims toolBarPadding = MediaQuery.of(context)?.padding ?? EdgeDims.zero;
|
||||
final EdgeInsets toolBarPadding = MediaQuery.of(context)?.padding ?? EdgeInsets.zero;
|
||||
final double toolBarHeight = kToolBarHeight + toolBarPadding.top;
|
||||
final List<Widget> children = <Widget>[];
|
||||
|
||||
@@ -70,7 +70,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
|
||||
curve: new Interval(0.0, scaleAndAlignEnd)
|
||||
);
|
||||
children.add(new Padding(
|
||||
padding: const EdgeDims.only(left: 72.0, bottom: 14.0),
|
||||
padding: const EdgeInsets.only(left: 72.0, bottom: 14.0),
|
||||
child: new Align(
|
||||
alignment: new Tween<FractionalOffset>(
|
||||
begin: new FractionalOffset(0.0, yAlignStart),
|
||||
|
||||
@@ -33,7 +33,7 @@ const Interval _kChildSegueInterval = const Interval(0.65, 1.0);
|
||||
///
|
||||
/// See also:
|
||||
/// * https://www.google.com/design/spec/components/buttons-floating-action-button.html
|
||||
class FloatingActionButton extends StatefulComponent {
|
||||
class FloatingActionButton extends StatefulWidget {
|
||||
const FloatingActionButton({
|
||||
Key key,
|
||||
this.child,
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:flutter/widgets.dart';
|
||||
|
||||
/// Creates a [Stack] with the header anchored across the top or a footer across the
|
||||
/// bottom. The [GridTileBar] class can be used to create grid tile headers and footers.
|
||||
class GridTile extends StatelessComponent {
|
||||
class GridTile extends StatelessWidget {
|
||||
GridTile({ Key key, this.header, this.footer, this.child }) : super(key: key) {
|
||||
assert(child != null);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import 'typography.dart';
|
||||
/// https://www.google.com/design/spec/components/grid-lists.html#grid-lists-specs
|
||||
/// For a one-line header specify title and to add a second line specify caption.
|
||||
/// Use left or right to add an icon.
|
||||
class GridTileBar extends StatelessComponent {
|
||||
class GridTileBar extends StatelessWidget {
|
||||
GridTileBar({ Key key, this.backgroundColor, this.left, this.right, this.title, this.caption }) : super(key: key);
|
||||
|
||||
final Color backgroundColor;
|
||||
@@ -29,18 +29,18 @@ class GridTileBar extends StatelessComponent {
|
||||
if (backgroundColor != null)
|
||||
decoration = new BoxDecoration(backgroundColor: backgroundColor);
|
||||
|
||||
EdgeDims padding;
|
||||
EdgeInsets padding;
|
||||
if (left != null && right != null)
|
||||
padding = const EdgeDims.symmetric(vertical: 16.0, horizontal: 8.0);
|
||||
padding = const EdgeInsets.symmetric(vertical: 16.0, horizontal: 8.0);
|
||||
else if (left != null)
|
||||
padding = const EdgeDims.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)
|
||||
padding = const EdgeDims.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>[];
|
||||
|
||||
if (left != null)
|
||||
children.add(new Padding(padding: const EdgeDims.only(right: 8.0), child: left));
|
||||
children.add(new Padding(padding: const EdgeInsets.only(right: 8.0), child: left));
|
||||
|
||||
if (title != null && caption != null) {
|
||||
children.add(
|
||||
@@ -72,7 +72,7 @@ class GridTileBar extends StatelessComponent {
|
||||
}
|
||||
|
||||
if (right != null)
|
||||
children.add(new Padding(padding: const EdgeDims.only(left: 8.0), child: right));
|
||||
children.add(new Padding(padding: const EdgeInsets.only(left: 8.0), child: right));
|
||||
|
||||
return new Container(
|
||||
padding: padding,
|
||||
|
||||
@@ -22,7 +22,7 @@ import 'theme.dart';
|
||||
/// in your project's `flutter.yaml` file. This ensures that the
|
||||
/// MaterialIcons font is included in your application. This font is
|
||||
/// used to display the icons.
|
||||
class Icon extends StatelessComponent {
|
||||
class Icon extends StatelessWidget {
|
||||
Icon({
|
||||
Key key,
|
||||
this.icon,
|
||||
|
||||
@@ -20,7 +20,7 @@ import 'tooltip.dart';
|
||||
///
|
||||
/// If the [onPressed] callback is not specified or null, then the button will
|
||||
/// be disabled, will not react to touch.
|
||||
class IconButton extends StatelessComponent {
|
||||
class IconButton extends StatelessWidget {
|
||||
const IconButton({
|
||||
Key key,
|
||||
this.size: 24.0,
|
||||
@@ -56,7 +56,7 @@ class IconButton extends StatelessComponent {
|
||||
Widget build(BuildContext context) {
|
||||
assert(debugCheckHasMaterial(context));
|
||||
Widget result = new Padding(
|
||||
padding: const EdgeDims.all(8.0),
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: new Icon(
|
||||
size: size,
|
||||
icon: icon,
|
||||
|
||||
@@ -24,7 +24,7 @@ import 'theme.dart';
|
||||
/// at the top of its [build] function to call [debugCheckHasMaterial]:
|
||||
///
|
||||
/// assert(debugCheckHasMaterial(context));
|
||||
class InkResponse extends StatefulComponent {
|
||||
class InkResponse extends StatefulWidget {
|
||||
InkResponse({
|
||||
Key key,
|
||||
this.child,
|
||||
|
||||
@@ -14,7 +14,7 @@ import 'theme.dart';
|
||||
export 'package:sky_services/editing/editing.mojom.dart' show KeyboardType;
|
||||
|
||||
/// A material design text input field.
|
||||
class Input extends StatefulComponent {
|
||||
class Input extends StatefulWidget {
|
||||
Input({
|
||||
Key key,
|
||||
this.value: InputValue.empty,
|
||||
@@ -84,7 +84,7 @@ class _InputState extends State<Input> {
|
||||
BuildContext focusContext = focusKey.currentContext;
|
||||
bool focused = focusContext != null && Focus.at(focusContext, autofocus: config.autofocus);
|
||||
|
||||
TextStyle textStyle = config.style ?? themeData.text.subhead;
|
||||
TextStyle textStyle = config.style ?? themeData.textTheme.subhead;
|
||||
Color activeColor = themeData.hintColor;
|
||||
if (focused) {
|
||||
switch (themeData.brightness) {
|
||||
@@ -104,10 +104,10 @@ class _InputState extends State<Input> {
|
||||
|
||||
if (config.labelText != null) {
|
||||
TextStyle labelStyle = hasInlineLabel ?
|
||||
themeData.text.subhead.copyWith(color: themeData.hintColor) :
|
||||
themeData.text.caption.copyWith(color: activeColor);
|
||||
themeData.textTheme.subhead.copyWith(color: themeData.hintColor) :
|
||||
themeData.textTheme.caption.copyWith(color: activeColor);
|
||||
|
||||
double topPaddingIncrement = themeData.text.caption.fontSize + (config.isDense ? 4.0 : 8.0);
|
||||
double topPaddingIncrement = themeData.textTheme.caption.fontSize + (config.isDense ? 4.0 : 8.0);
|
||||
double top = topPadding;
|
||||
if (hasInlineLabel)
|
||||
top += topPaddingIncrement + textStyle.fontSize - labelStyle.fontSize;
|
||||
@@ -124,7 +124,7 @@ class _InputState extends State<Input> {
|
||||
}
|
||||
|
||||
if (config.hintText != null && config.value.text.isEmpty && !hasInlineLabel) {
|
||||
TextStyle hintStyle = themeData.text.subhead.copyWith(color: themeData.hintColor);
|
||||
TextStyle hintStyle = themeData.textTheme.subhead.copyWith(color: themeData.hintColor);
|
||||
stackChildren.add(new Positioned(
|
||||
left: 0.0,
|
||||
top: topPadding + textStyle.fontSize - hintStyle.fontSize,
|
||||
@@ -132,8 +132,8 @@ class _InputState extends State<Input> {
|
||||
));
|
||||
}
|
||||
|
||||
EdgeDims margin = new EdgeDims.only(bottom: config.isDense ? 4.0 : 8.0);
|
||||
EdgeDims padding = new EdgeDims.only(top: topPadding, bottom: 8.0);
|
||||
EdgeInsets margin = new EdgeInsets.only(bottom: config.isDense ? 4.0 : 8.0);
|
||||
EdgeInsets padding = new EdgeInsets.only(top: topPadding, bottom: 8.0);
|
||||
Color borderColor = activeColor;
|
||||
double borderWidth = focused ? 2.0 : 1.0;
|
||||
|
||||
@@ -141,8 +141,8 @@ class _InputState extends State<Input> {
|
||||
borderColor = themeData.errorColor;
|
||||
borderWidth = 2.0;
|
||||
if (!config.isDense) {
|
||||
margin = const EdgeDims.only(bottom: 15.0);
|
||||
padding = new EdgeDims.only(top: topPadding, bottom: 1.0);
|
||||
margin = const EdgeInsets.only(bottom: 15.0);
|
||||
padding = new EdgeInsets.only(top: topPadding, bottom: 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ class _InputState extends State<Input> {
|
||||
));
|
||||
|
||||
if (config.errorText != null && !config.isDense) {
|
||||
TextStyle errorStyle = themeData.text.caption.copyWith(color: themeData.errorColor);
|
||||
TextStyle errorStyle = themeData.textTheme.caption.copyWith(color: themeData.errorColor);
|
||||
stackChildren.add(new Positioned(
|
||||
left: 0.0,
|
||||
bottom: 0.0,
|
||||
@@ -191,7 +191,7 @@ class _InputState extends State<Input> {
|
||||
alignItems: FlexAlignItems.start,
|
||||
children: [
|
||||
new Container(
|
||||
margin: new EdgeDims.only(right: 16.0, top: iconTop),
|
||||
margin: new EdgeInsets.only(right: 16.0, top: iconTop),
|
||||
width: config.isDense ? 40.0 : 48.0,
|
||||
child: new Icon(
|
||||
icon: config.icon,
|
||||
@@ -208,7 +208,7 @@ class _InputState extends State<Input> {
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () => _rawInputLineKey.currentState?.requestKeyboard(),
|
||||
child: new Padding(
|
||||
padding: const EdgeDims.symmetric(horizontal: 16.0),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: child
|
||||
)
|
||||
);
|
||||
|
||||
@@ -21,14 +21,14 @@ Map<MaterialListType, double> kListItemExtent = const <MaterialListType, double>
|
||||
MaterialListType.threeLine: kThreeLineListItemHeight,
|
||||
};
|
||||
|
||||
class MaterialList extends StatefulComponent {
|
||||
class MaterialList extends StatefulWidget {
|
||||
MaterialList({
|
||||
Key key,
|
||||
this.initialScrollOffset,
|
||||
this.onScroll,
|
||||
this.type: MaterialListType.twoLine,
|
||||
this.children,
|
||||
this.scrollablePadding: EdgeDims.zero,
|
||||
this.scrollablePadding: EdgeInsets.zero,
|
||||
this.scrollableKey
|
||||
}) : super(key: key);
|
||||
|
||||
@@ -36,7 +36,7 @@ class MaterialList extends StatefulComponent {
|
||||
final ScrollListener onScroll;
|
||||
final MaterialListType type;
|
||||
final Iterable<Widget> children;
|
||||
final EdgeDims scrollablePadding;
|
||||
final EdgeInsets scrollablePadding;
|
||||
final Key scrollableKey;
|
||||
|
||||
_MaterialListState createState() => new _MaterialListState();
|
||||
@@ -52,7 +52,7 @@ class _MaterialListState extends State<MaterialList> {
|
||||
scrollDirection: Axis.vertical,
|
||||
onScroll: config.onScroll,
|
||||
itemExtent: kListItemExtent[config.type],
|
||||
padding: const EdgeDims.symmetric(vertical: 8.0) + config.scrollablePadding,
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0) + config.scrollablePadding,
|
||||
scrollableListPainter: _scrollbarPainter,
|
||||
children: config.children
|
||||
);
|
||||
|
||||
@@ -15,7 +15,7 @@ import 'theme.dart';
|
||||
/// isThreeLine: true is specified. If dense: true is specified then the overall
|
||||
/// height of this list item and the size of the DefaultTextStyles that wrap
|
||||
/// the [primary] and [secondary] widget are reduced.
|
||||
class ListItem extends StatelessComponent {
|
||||
class ListItem extends StatelessWidget {
|
||||
ListItem({
|
||||
Key key,
|
||||
this.left,
|
||||
@@ -69,7 +69,7 @@ class ListItem extends StatelessComponent {
|
||||
|
||||
TextStyle primaryTextStyle(BuildContext context) {
|
||||
final ThemeData theme = Theme.of(context);
|
||||
final TextStyle style = theme.text.subhead;
|
||||
final TextStyle style = theme.textTheme.subhead;
|
||||
if (!enabled) {
|
||||
final Color color = theme.disabledColor;
|
||||
return dense ? style.copyWith(fontSize: 13.0, color: color) : style.copyWith(color: color);
|
||||
@@ -79,8 +79,8 @@ class ListItem extends StatelessComponent {
|
||||
|
||||
TextStyle secondaryTextStyle(BuildContext context) {
|
||||
final ThemeData theme = Theme.of(context);
|
||||
final Color color = theme.text.caption.color;
|
||||
final TextStyle style = theme.text.body1;
|
||||
final Color color = theme.textTheme.caption.color;
|
||||
final TextStyle style = theme.textTheme.body1;
|
||||
return dense ? style.copyWith(color: color, fontSize: 12.0) : style.copyWith(color: color);
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ class ListItem extends StatelessComponent {
|
||||
|
||||
if (left != null) {
|
||||
children.add(new Container(
|
||||
margin: new EdgeDims.only(right: 16.0, top: iconMarginTop),
|
||||
margin: new EdgeInsets.only(right: 16.0, top: iconMarginTop),
|
||||
width: 40.0,
|
||||
child: new Align(
|
||||
alignment: new FractionalOffset(0.0, isThreeLine ? 0.0 : 0.5),
|
||||
@@ -138,7 +138,7 @@ class ListItem extends StatelessComponent {
|
||||
|
||||
if (right != null) {
|
||||
children.add(new Container(
|
||||
margin: new EdgeDims.only(left: 16.0, top: iconMarginTop),
|
||||
margin: new EdgeInsets.only(left: 16.0, top: iconMarginTop),
|
||||
child: new Align(
|
||||
alignment: new FractionalOffset(1.0, isThreeLine ? 0.0 : 0.5),
|
||||
child: right
|
||||
@@ -151,7 +151,7 @@ class ListItem extends StatelessComponent {
|
||||
onLongPress: enabled ? onLongPress : null,
|
||||
child: new Container(
|
||||
height: itemHeight,
|
||||
padding: const EdgeDims.symmetric(horizontal: 16.0),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: new Row(
|
||||
alignItems: FlexAlignItems.center,
|
||||
children: children
|
||||
|
||||
@@ -73,7 +73,7 @@ abstract class MaterialInkController {
|
||||
/// list on the paper, and it's been scrolled), a LayoutChangedNotification must
|
||||
/// be dispatched at the relevant subtree. (This in particular means that
|
||||
/// Transitions should not be placed inside Material.)
|
||||
class Material extends StatefulComponent {
|
||||
class Material extends StatefulWidget {
|
||||
Material({
|
||||
Key key,
|
||||
this.child,
|
||||
@@ -130,7 +130,7 @@ class _MaterialState extends State<Material> {
|
||||
Widget contents = config.child;
|
||||
if (contents != null) {
|
||||
contents = new DefaultTextStyle(
|
||||
style: config.textStyle ?? Theme.of(context).text.body1,
|
||||
style: config.textStyle ?? Theme.of(context).textTheme.body1,
|
||||
child: contents
|
||||
);
|
||||
}
|
||||
@@ -274,7 +274,7 @@ class RenderInkFeatures extends RenderProxyBox implements MaterialInkController
|
||||
}
|
||||
}
|
||||
|
||||
class InkFeatures extends OneChildRenderObjectWidget {
|
||||
class InkFeatures extends SingleChildRenderObjectWidget {
|
||||
InkFeatures({ Key key, this.color, Widget child }) : super(key: key, child: child);
|
||||
|
||||
final Color color;
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'dart:async';
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
class _MaterialPageTransition extends AnimatedComponent {
|
||||
class _MaterialPageTransition extends AnimatedWidget {
|
||||
_MaterialPageTransition({
|
||||
Key key,
|
||||
Animation<double> animation,
|
||||
|
||||
@@ -28,7 +28,7 @@ const double _kMenuVerticalPadding = 8.0;
|
||||
const double _kMenuWidthStep = 56.0;
|
||||
const double _kMenuScreenPadding = 8.0;
|
||||
|
||||
abstract class PopupMenuEntry<T> extends StatefulComponent {
|
||||
abstract class PopupMenuEntry<T> extends StatefulWidget {
|
||||
PopupMenuEntry({ Key key }) : super(key: key);
|
||||
|
||||
double get height;
|
||||
@@ -75,7 +75,7 @@ class _PopupMenuItemState<T extends PopupMenuItem<dynamic>> extends State<T> {
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
final ThemeData theme = Theme.of(context);
|
||||
TextStyle style = theme.text.subhead;
|
||||
TextStyle style = theme.textTheme.subhead;
|
||||
if (!config.enabled)
|
||||
style = style.copyWith(color: theme.disabledColor);
|
||||
|
||||
@@ -99,7 +99,7 @@ class _PopupMenuItemState<T extends PopupMenuItem<dynamic>> extends State<T> {
|
||||
child: new MergeSemantics(
|
||||
child: new Container(
|
||||
height: config.height,
|
||||
padding: const EdgeDims.symmetric(horizontal: _kMenuHorizontalPadding),
|
||||
padding: const EdgeInsets.symmetric(horizontal: _kMenuHorizontalPadding),
|
||||
child: item
|
||||
)
|
||||
)
|
||||
@@ -159,7 +159,7 @@ class _CheckedPopupMenuItemState<T> extends _PopupMenuItemState<CheckedPopupMenu
|
||||
}
|
||||
}
|
||||
|
||||
class _PopupMenu<T> extends StatelessComponent {
|
||||
class _PopupMenu<T> extends StatelessWidget {
|
||||
_PopupMenu({
|
||||
Key key,
|
||||
this.route
|
||||
@@ -204,7 +204,7 @@ class _PopupMenu<T> extends StatelessComponent {
|
||||
stepWidth: _kMenuWidthStep,
|
||||
child: new Block(
|
||||
children: children,
|
||||
padding: const EdgeDims.symmetric(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: _kMenuVerticalPadding
|
||||
)
|
||||
)
|
||||
@@ -233,7 +233,7 @@ class _PopupMenu<T> extends StatelessComponent {
|
||||
}
|
||||
}
|
||||
|
||||
class _PopupMenuRouteLayout extends OneChildLayoutDelegate {
|
||||
class _PopupMenuRouteLayout extends SingleChildLayoutDelegate {
|
||||
_PopupMenuRouteLayout(this.position, this.selectedItemOffset);
|
||||
|
||||
final ModalPosition position;
|
||||
@@ -316,7 +316,7 @@ class _PopupMenuRoute<T> extends PopupRoute<T> {
|
||||
final Size screenSize = MediaQuery.of(context).size;
|
||||
return new ConstrainedBox(
|
||||
constraints: new BoxConstraints(maxWidth: screenSize.width, maxHeight: screenSize.height),
|
||||
child: new CustomOneChildLayout(
|
||||
child: new CustomSingleChildLayout(
|
||||
delegate: new _PopupMenuRouteLayout(position, selectedItemOffset),
|
||||
child: new _PopupMenu<T>(route: this)
|
||||
)
|
||||
@@ -357,7 +357,7 @@ typedef void PopupMenuItemSelected<T>(T value);
|
||||
/// because an item was selected. The value passed to [onSelected] is the value of
|
||||
/// the selected menu item. If child is null then a standard 'navigation/more_vert'
|
||||
/// icon is created.
|
||||
class PopupMenuButton<T> extends StatefulComponent {
|
||||
class PopupMenuButton<T> extends StatefulWidget {
|
||||
PopupMenuButton({
|
||||
Key key,
|
||||
this.items,
|
||||
|
||||
@@ -14,7 +14,7 @@ const double _kCircularProgressIndicatorStrokeWidth = 4.0;
|
||||
|
||||
// TODO(hansmuller): implement the support for buffer indicator
|
||||
|
||||
abstract class ProgressIndicator extends StatefulComponent {
|
||||
abstract class ProgressIndicator extends StatefulWidget {
|
||||
ProgressIndicator({
|
||||
Key key,
|
||||
this.value
|
||||
|
||||
@@ -14,7 +14,7 @@ const double _kDiameter = 16.0;
|
||||
const double _kOuterRadius = _kDiameter / 2.0;
|
||||
const double _kInnerRadius = 5.0;
|
||||
|
||||
class Radio<T> extends StatelessComponent {
|
||||
class Radio<T> extends StatelessWidget {
|
||||
Radio({
|
||||
Key key,
|
||||
this.value,
|
||||
|
||||
@@ -37,7 +37,7 @@ enum _ScaffoldSlot {
|
||||
class _ScaffoldLayout extends MultiChildLayoutDelegate {
|
||||
_ScaffoldLayout({ this.padding });
|
||||
|
||||
final EdgeDims padding;
|
||||
final EdgeInsets padding;
|
||||
|
||||
void performLayout(Size size) {
|
||||
BoxConstraints looseConstraints = new BoxConstraints.loose(size);
|
||||
@@ -51,12 +51,12 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
|
||||
double contentTop = padding.top;
|
||||
double contentBottom = size.height - padding.bottom;
|
||||
|
||||
if (isChild(_ScaffoldSlot.toolBar)) {
|
||||
if (hasChild(_ScaffoldSlot.toolBar)) {
|
||||
contentTop = layoutChild(_ScaffoldSlot.toolBar, fullWidthConstraints).height;
|
||||
positionChild(_ScaffoldSlot.toolBar, Offset.zero);
|
||||
}
|
||||
|
||||
if (isChild(_ScaffoldSlot.body)) {
|
||||
if (hasChild(_ScaffoldSlot.body)) {
|
||||
final double bodyHeight = contentBottom - contentTop;
|
||||
final BoxConstraints bodyConstraints = fullWidthConstraints.tighten(height: bodyHeight);
|
||||
layoutChild(_ScaffoldSlot.body, bodyConstraints);
|
||||
@@ -75,17 +75,17 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
|
||||
Size bottomSheetSize = Size.zero;
|
||||
Size snackBarSize = Size.zero;
|
||||
|
||||
if (isChild(_ScaffoldSlot.bottomSheet)) {
|
||||
if (hasChild(_ScaffoldSlot.bottomSheet)) {
|
||||
bottomSheetSize = layoutChild(_ScaffoldSlot.bottomSheet, fullWidthConstraints);
|
||||
positionChild(_ScaffoldSlot.bottomSheet, new Offset((size.width - bottomSheetSize.width) / 2.0, contentBottom - bottomSheetSize.height));
|
||||
}
|
||||
|
||||
if (isChild(_ScaffoldSlot.snackBar)) {
|
||||
if (hasChild(_ScaffoldSlot.snackBar)) {
|
||||
snackBarSize = layoutChild(_ScaffoldSlot.snackBar, fullWidthConstraints);
|
||||
positionChild(_ScaffoldSlot.snackBar, new Offset(0.0, contentBottom - snackBarSize.height));
|
||||
}
|
||||
|
||||
if (isChild(_ScaffoldSlot.floatingActionButton)) {
|
||||
if (hasChild(_ScaffoldSlot.floatingActionButton)) {
|
||||
final Size fabSize = layoutChild(_ScaffoldSlot.floatingActionButton, looseConstraints);
|
||||
final double fabX = size.width - fabSize.width - _kFloatingActionButtonMargin;
|
||||
double fabY = contentBottom - fabSize.height - _kFloatingActionButtonMargin;
|
||||
@@ -96,7 +96,7 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
|
||||
positionChild(_ScaffoldSlot.floatingActionButton, new Offset(fabX, fabY));
|
||||
}
|
||||
|
||||
if (isChild(_ScaffoldSlot.drawer)) {
|
||||
if (hasChild(_ScaffoldSlot.drawer)) {
|
||||
layoutChild(_ScaffoldSlot.drawer, new BoxConstraints.tight(size));
|
||||
positionChild(_ScaffoldSlot.drawer, Offset.zero);
|
||||
}
|
||||
@@ -107,7 +107,7 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
class _FloatingActionButtonTransition extends StatefulComponent {
|
||||
class _FloatingActionButtonTransition extends StatefulWidget {
|
||||
_FloatingActionButtonTransition({
|
||||
Key key,
|
||||
this.child
|
||||
@@ -180,7 +180,7 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr
|
||||
/// This class provides APIs for showing drawers, snackbars, and bottom sheets.
|
||||
///
|
||||
/// See: <https://www.google.com/design/spec/layout/structure.html>
|
||||
class Scaffold extends StatefulComponent {
|
||||
class Scaffold extends StatefulWidget {
|
||||
Scaffold({
|
||||
Key key,
|
||||
this.toolBar,
|
||||
@@ -375,11 +375,11 @@ class ScaffoldState extends State<Scaffold> {
|
||||
|
||||
bool _shouldShowBackArrow;
|
||||
|
||||
Widget _getModifiedToolBar({ EdgeDims padding, double foregroundOpacity: 1.0, int elevation }) {
|
||||
Widget _getModifiedToolBar({ EdgeInsets padding, double foregroundOpacity: 1.0, int elevation }) {
|
||||
ToolBar toolBar = config.toolBar;
|
||||
if (toolBar == null)
|
||||
return null;
|
||||
EdgeDims toolBarPadding = new EdgeDims.only(top: padding.top);
|
||||
EdgeInsets toolBarPadding = new EdgeInsets.only(top: padding.top);
|
||||
Widget left = toolBar.left;
|
||||
if (left == null) {
|
||||
if (config.drawer != null) {
|
||||
@@ -431,7 +431,7 @@ class ScaffoldState extends State<Scaffold> {
|
||||
}
|
||||
|
||||
Widget _buildScrollableAppBar(BuildContext context) {
|
||||
final EdgeDims toolBarPadding = MediaQuery.of(context)?.padding ?? EdgeDims.zero;
|
||||
final EdgeInsets toolBarPadding = MediaQuery.of(context)?.padding ?? EdgeInsets.zero;
|
||||
final double toolBarHeight = kToolBarHeight + toolBarPadding.top;
|
||||
Widget appBar;
|
||||
|
||||
@@ -468,7 +468,7 @@ class ScaffoldState extends State<Scaffold> {
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
EdgeDims padding = MediaQuery.of(context)?.padding ?? EdgeDims.zero;
|
||||
EdgeInsets padding = MediaQuery.of(context)?.padding ?? EdgeInsets.zero;
|
||||
|
||||
if (_snackBars.length > 0) {
|
||||
ModalRoute<dynamic> route = ModalRoute.of(context);
|
||||
@@ -538,7 +538,7 @@ class ScaffoldState extends State<Scaffold> {
|
||||
new CustomMultiChildLayout(
|
||||
children: children,
|
||||
delegate: new _ScaffoldLayout(
|
||||
padding: EdgeDims.zero
|
||||
padding: EdgeInsets.zero
|
||||
)
|
||||
),
|
||||
new Positioned(
|
||||
@@ -572,7 +572,7 @@ class ScaffoldFeatureController<T extends Widget, U> {
|
||||
final StateSetter setState;
|
||||
}
|
||||
|
||||
class _PersistentBottomSheet extends StatefulComponent {
|
||||
class _PersistentBottomSheet extends StatefulWidget {
|
||||
_PersistentBottomSheet({
|
||||
Key key,
|
||||
this.animationController,
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'dart:ui' show Color, Offset;
|
||||
import 'package:flutter/painting.dart';
|
||||
|
||||
// Based on http://www.google.com/design/spec/what-is-material/elevation-shadows.html
|
||||
// Currently, only the elevation values that are bound to one or more components are
|
||||
// Currently, only the elevation values that are bound to one or more widgets are
|
||||
// defined here.
|
||||
|
||||
/// Map of elevation offsets used by material design to [BoxShadow] definitions.
|
||||
|
||||
@@ -11,7 +11,7 @@ import 'constants.dart';
|
||||
import 'debug.dart';
|
||||
import 'theme.dart';
|
||||
|
||||
class Slider extends StatelessComponent {
|
||||
class Slider extends StatelessWidget {
|
||||
Slider({
|
||||
Key key,
|
||||
this.value,
|
||||
|
||||
@@ -37,7 +37,7 @@ const Curve _snackBarFadeCurve = const Interval(0.72, 1.0, curve: Curves.fastOut
|
||||
///
|
||||
/// See also:
|
||||
/// * https://www.google.com/design/spec/components/snackbars-toasts.html
|
||||
class SnackBarAction extends StatelessComponent {
|
||||
class SnackBarAction extends StatelessWidget {
|
||||
SnackBarAction({Key key, this.label, this.onPressed }) : super(key: key) {
|
||||
assert(label != null);
|
||||
assert(onPressed != null);
|
||||
@@ -51,7 +51,7 @@ class SnackBarAction extends StatelessComponent {
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return new Container(
|
||||
margin: const EdgeDims.only(left: _kSideMargins),
|
||||
margin: const EdgeInsets.only(left: _kSideMargins),
|
||||
child: new FlatButton(
|
||||
onPressed: onPressed,
|
||||
textTheme: ButtonColor.accent,
|
||||
@@ -70,7 +70,7 @@ class SnackBarAction extends StatelessComponent {
|
||||
/// * [Scaffold.of] and [ScaffoldState.showSnackBar]
|
||||
/// * [SnackBarAction]
|
||||
/// * https://www.google.com/design/spec/components/snackbars-toasts.html
|
||||
class SnackBar extends StatelessComponent {
|
||||
class SnackBar extends StatelessWidget {
|
||||
SnackBar({
|
||||
Key key,
|
||||
this.content,
|
||||
@@ -91,7 +91,7 @@ class SnackBar extends StatelessComponent {
|
||||
List<Widget> children = <Widget>[
|
||||
new Flexible(
|
||||
child: new Container(
|
||||
margin: const EdgeDims.symmetric(vertical: _kSingleLineVerticalPadding),
|
||||
margin: const EdgeInsets.symmetric(vertical: _kSingleLineVerticalPadding),
|
||||
child: new DefaultTextStyle(
|
||||
style: Typography.white.subhead,
|
||||
child: content
|
||||
@@ -120,13 +120,13 @@ class SnackBar extends StatelessComponent {
|
||||
elevation: 6,
|
||||
color: _kSnackBackground,
|
||||
child: new Container(
|
||||
margin: const EdgeDims.symmetric(horizontal: _kSideMargins),
|
||||
margin: const EdgeInsets.symmetric(horizontal: _kSideMargins),
|
||||
child: new Theme(
|
||||
data: new ThemeData(
|
||||
brightness: ThemeBrightness.dark,
|
||||
accentColor: theme.accentColor,
|
||||
accentColorBrightness: theme.accentColorBrightness,
|
||||
text: Typography.white
|
||||
textTheme: Typography.white
|
||||
),
|
||||
child: new FadeTransition(
|
||||
opacity: fadeAnimation,
|
||||
|
||||
@@ -13,7 +13,7 @@ import 'shadows.dart';
|
||||
import 'theme.dart';
|
||||
import 'toggleable.dart';
|
||||
|
||||
class Switch extends StatelessComponent {
|
||||
class Switch extends StatelessWidget {
|
||||
Switch({ Key key, this.value, this.activeColor, this.onChanged })
|
||||
: super(key: key);
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ const double _kTextAndIconTabHeight = 72.0;
|
||||
const double _kTabIndicatorHeight = 2.0;
|
||||
const double _kMinTabWidth = 72.0;
|
||||
const double _kMaxTabWidth = 264.0;
|
||||
const EdgeDims _kTabLabelPadding = const EdgeDims.symmetric(horizontal: 12.0);
|
||||
const EdgeInsets _kTabLabelPadding = const EdgeInsets.symmetric(horizontal: 12.0);
|
||||
const double _kTabBarScrollDrag = 0.025;
|
||||
const Duration _kTabBarScroll = const Duration(milliseconds: 300);
|
||||
|
||||
@@ -297,7 +297,7 @@ class TabLabel {
|
||||
final TabLabelIconBuilder iconBuilder;
|
||||
}
|
||||
|
||||
class _Tab extends StatelessComponent {
|
||||
class _Tab extends StatelessWidget {
|
||||
_Tab({
|
||||
Key key,
|
||||
this.onSelected,
|
||||
@@ -342,7 +342,7 @@ class _Tab extends StatelessComponent {
|
||||
children: <Widget>[
|
||||
new Container(
|
||||
child: _buildLabelIcon(context),
|
||||
margin: const EdgeDims.only(bottom: 10.0)
|
||||
margin: const EdgeInsets.only(bottom: 10.0)
|
||||
),
|
||||
_buildLabelText()
|
||||
],
|
||||
@@ -374,7 +374,7 @@ class _TabsScrollBehavior extends BoundedBehavior {
|
||||
|
||||
bool isScrollable = true;
|
||||
|
||||
Simulation createFlingScrollSimulation(double position, double velocity) {
|
||||
Simulation createScrollSimulation(double position, double velocity) {
|
||||
if (!isScrollable)
|
||||
return null;
|
||||
|
||||
@@ -395,7 +395,7 @@ abstract class TabBarSelectionAnimationListener {
|
||||
void handleSelectionDeactivate();
|
||||
}
|
||||
|
||||
class TabBarSelection<T> extends StatefulComponent {
|
||||
class TabBarSelection<T> extends StatefulWidget {
|
||||
TabBarSelection({
|
||||
Key key,
|
||||
this.value,
|
||||
@@ -784,7 +784,7 @@ class _TabBarState<T> extends ScrollableState<TabBar<T>> implements TabBarSelect
|
||||
|
||||
if (config.isScrollable) {
|
||||
return new Viewport(
|
||||
scrollDirection: Axis.horizontal,
|
||||
mainAxis: Axis.horizontal,
|
||||
paintOffset: scrollOffsetToPixelDelta(scrollOffset),
|
||||
onPaintOffsetUpdateNeeded: _handlePaintOffsetUpdateNeeded,
|
||||
child: contents
|
||||
@@ -961,7 +961,7 @@ class _TabBarViewState<T> extends PageableListState<TabBarView<T>> implements Ta
|
||||
_initSelection(newSelection);
|
||||
return new PageViewport(
|
||||
itemsWrap: config.itemsWrap,
|
||||
scrollDirection: config.scrollDirection,
|
||||
mainAxis: config.scrollDirection,
|
||||
startOffset: scrollOffset,
|
||||
overlayPainter: config.scrollableListPainter,
|
||||
children: _items
|
||||
@@ -969,7 +969,7 @@ class _TabBarViewState<T> extends PageableListState<TabBarView<T>> implements Ta
|
||||
}
|
||||
}
|
||||
|
||||
class TabPageSelector<T> extends StatelessComponent {
|
||||
class TabPageSelector<T> extends StatelessWidget {
|
||||
const TabPageSelector({ Key key }) : super(key: key);
|
||||
|
||||
Widget _buildTabIndicator(TabBarSelectionState<T> selection, T tab, Animation<double> animation, ColorTween selectedColor, ColorTween previousColor) {
|
||||
@@ -988,7 +988,7 @@ class TabPageSelector<T> extends StatelessComponent {
|
||||
return new Container(
|
||||
width: 12.0,
|
||||
height: 12.0,
|
||||
margin: new EdgeDims.all(4.0),
|
||||
margin: new EdgeInsets.all(4.0),
|
||||
decoration: new BoxDecoration(
|
||||
backgroundColor: background,
|
||||
border: new Border.all(color: selectedColor.end),
|
||||
|
||||
@@ -52,7 +52,7 @@ class ThemeData {
|
||||
Color hintColor,
|
||||
double hintOpacity,
|
||||
Color errorColor,
|
||||
TextTheme text,
|
||||
TextTheme textTheme,
|
||||
TextTheme primaryTextTheme,
|
||||
IconThemeData primaryIconTheme
|
||||
}) {
|
||||
@@ -77,7 +77,7 @@ class ThemeData {
|
||||
hintColor ??= isDark ? const Color(0x42FFFFFF) : const Color(0x4C000000);
|
||||
hintOpacity ??= hintColor != null ? hintColor.alpha / 0xFF : isDark ? 0.26 : 0.30;
|
||||
errorColor ??= Colors.red[700];
|
||||
text ??= isDark ? Typography.white : Typography.black;
|
||||
textTheme ??= isDark ? Typography.white : Typography.black;
|
||||
primaryTextTheme ??= primaryColorBrightness == ThemeBrightness.dark ? Typography.white : Typography.black;
|
||||
primaryIconTheme ??= primaryColorBrightness == ThemeBrightness.dark ? const IconThemeData(color: Colors.white) : const IconThemeData(color: Colors.black);
|
||||
return new ThemeData.raw(
|
||||
@@ -100,7 +100,7 @@ class ThemeData {
|
||||
hintColor: hintColor,
|
||||
hintOpacity: hintOpacity,
|
||||
errorColor: errorColor,
|
||||
text: text,
|
||||
textTheme: textTheme,
|
||||
primaryTextTheme: primaryTextTheme,
|
||||
primaryIconTheme: primaryIconTheme
|
||||
);
|
||||
@@ -126,7 +126,7 @@ class ThemeData {
|
||||
this.hintColor,
|
||||
this.hintOpacity,
|
||||
this.errorColor,
|
||||
this.text,
|
||||
this.textTheme,
|
||||
this.primaryTextTheme,
|
||||
this.primaryIconTheme
|
||||
}) {
|
||||
@@ -149,7 +149,7 @@ class ThemeData {
|
||||
assert(hintColor != null);
|
||||
assert(hintOpacity != null);
|
||||
assert(errorColor != null);
|
||||
assert(text != null);
|
||||
assert(textTheme != null);
|
||||
assert(primaryTextTheme != null);
|
||||
assert(primaryIconTheme != null);
|
||||
}
|
||||
@@ -207,7 +207,7 @@ class ThemeData {
|
||||
final Color errorColor;
|
||||
|
||||
/// Text with a color that contrasts with the card and canvas colors.
|
||||
final TextTheme text;
|
||||
final TextTheme textTheme;
|
||||
|
||||
/// A text theme that contrasts with the primary color.
|
||||
final TextTheme primaryTextTheme;
|
||||
@@ -235,7 +235,7 @@ class ThemeData {
|
||||
hintColor: Color.lerp(begin.hintColor, end.hintColor, t),
|
||||
hintOpacity: lerpDouble(begin.hintOpacity, end.hintOpacity, t),
|
||||
errorColor: Color.lerp(begin.errorColor, end.errorColor, t),
|
||||
text: TextTheme.lerp(begin.text, end.text, t),
|
||||
textTheme: TextTheme.lerp(begin.textTheme, end.textTheme, t),
|
||||
primaryTextTheme: TextTheme.lerp(begin.primaryTextTheme, end.primaryTextTheme, t),
|
||||
primaryIconTheme: IconThemeData.lerp(begin.primaryIconTheme, end.primaryIconTheme, t)
|
||||
);
|
||||
@@ -264,7 +264,7 @@ class ThemeData {
|
||||
(otherData.hintColor == hintColor) &&
|
||||
(otherData.hintOpacity == hintOpacity) &&
|
||||
(otherData.errorColor == errorColor) &&
|
||||
(otherData.text == text) &&
|
||||
(otherData.textTheme == textTheme) &&
|
||||
(otherData.primaryTextTheme == primaryTextTheme) &&
|
||||
(otherData.primaryIconTheme == primaryIconTheme);
|
||||
}
|
||||
@@ -290,7 +290,7 @@ class ThemeData {
|
||||
hintColor,
|
||||
hintOpacity,
|
||||
errorColor,
|
||||
text,
|
||||
textTheme,
|
||||
primaryTextTheme,
|
||||
primaryIconTheme
|
||||
)
|
||||
|
||||
@@ -89,7 +89,7 @@ class TimeOfDay {
|
||||
|
||||
enum _TimePickerMode { hour, minute }
|
||||
|
||||
class TimePicker extends StatefulComponent {
|
||||
class TimePicker extends StatefulWidget {
|
||||
TimePicker({
|
||||
this.selectedTime,
|
||||
this.onChanged
|
||||
@@ -126,7 +126,7 @@ class _TimePickerState extends State<TimePicker> {
|
||||
new AspectRatio(
|
||||
aspectRatio: 1.0,
|
||||
child: new Container(
|
||||
margin: const EdgeDims.all(12.0),
|
||||
margin: const EdgeInsets.all(12.0),
|
||||
child: new _Dial(
|
||||
mode: _mode,
|
||||
selectedTime: config.selectedTime,
|
||||
@@ -141,7 +141,7 @@ class _TimePickerState extends State<TimePicker> {
|
||||
}
|
||||
|
||||
// TODO(ianh): Localize!
|
||||
class _TimePickerHeader extends StatelessComponent {
|
||||
class _TimePickerHeader extends StatelessWidget {
|
||||
_TimePickerHeader({
|
||||
this.selectedTime,
|
||||
this.mode,
|
||||
@@ -214,12 +214,12 @@ class _TimePickerHeader extends StatelessComponent {
|
||||
onTap: _handleChangeDayPeriod,
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: new Container(
|
||||
padding: const EdgeDims.only(left: 16.0, right: 24.0),
|
||||
padding: const EdgeInsets.only(left: 16.0, right: 24.0),
|
||||
child: new Column(
|
||||
children: <Widget>[
|
||||
new Text('AM', style: amStyle),
|
||||
new Container(
|
||||
padding: const EdgeDims.only(top: 4.0),
|
||||
padding: const EdgeInsets.only(top: 4.0),
|
||||
child: new Text('PM', style: pmStyle)
|
||||
),
|
||||
],
|
||||
@@ -312,7 +312,7 @@ class _DialPainter extends CustomPainter {
|
||||
}
|
||||
}
|
||||
|
||||
class _Dial extends StatefulComponent {
|
||||
class _Dial extends StatefulWidget {
|
||||
_Dial({
|
||||
this.selectedTime,
|
||||
this.mode,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user