diff --git a/dev/manual_tests/card_collection.dart b/dev/manual_tests/card_collection.dart index d0bbd4cf38..dd264e4ead 100644 --- a/dev/manual_tests/card_collection.dart +++ b/dev/manual_tests/card_collection.dart @@ -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 { ], 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 { 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 { 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 { } 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 ); diff --git a/dev/manual_tests/drag_and_drop.dart b/dev/manual_tests/drag_and_drop.dart index 2256a7948b..435ce6bab9 100644 --- a/dev/manual_tests/drag_and_drop.dart +++ b/dev/manual_tests/drag_and_drop.dart @@ -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 { builder: (BuildContext context, List data, List 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 { } } -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 { } } -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(); } diff --git a/dev/manual_tests/mozart.dart b/dev/manual_tests/mozart.dart index 95b1c6e253..4f6dd575dc 100644 --- a/dev/manual_tests/mozart.dart +++ b/dev/manual_tests/mozart.dart @@ -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 { 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 { } } -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 items; @@ -188,7 +188,7 @@ class Launcher extends StatelessComponent { } } -class WindowManager extends StatefulComponent { +class WindowManager extends StatefulWidget { _WindowManagerState createState() => new _WindowManagerState(); } diff --git a/dev/manual_tests/overlay_geometry.dart b/dev/manual_tests/overlay_geometry.dart index 74e0545619..aec69e5711 100644 --- a/dev/manual_tests/overlay_geometry.dart +++ b/dev/manual_tests/overlay_geometry.dart @@ -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 { 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 { 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, diff --git a/dev/manual_tests/pageable_list.dart b/dev/manual_tests/pageable_list.dart index b6aed7b266..5a71c54d94 100644 --- a/dev/manual_tests/pageable_list.dart +++ b/dev/manual_tests/pageable_list.dart @@ -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 { 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)) ) ); diff --git a/dev/manual_tests/raw_keyboard.dart b/dev/manual_tests/raw_keyboard.dart index f55b142c23..01c2c09bc8 100644 --- a/dev/manual_tests/raw_keyboard.dart +++ b/dev/manual_tests/raw_keyboard.dart @@ -30,7 +30,7 @@ void main() { ); } -class RawKeyboardDemo extends StatefulComponent { +class RawKeyboardDemo extends StatefulWidget { RawKeyboardDemo({ GlobalKey key }) : super(key: key); _HardwareKeyDemoState createState() => new _HardwareKeyDemoState(); diff --git a/examples/layers/rendering/flex_layout.dart b/examples/layers/rendering/flex_layout.dart index adaa4bf6db..79ac2422d4 100644 --- a/examples/layers/rendering/flex_layout.dart +++ b/examples/layers/rendering/flex_layout.dart @@ -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); diff --git a/examples/layers/services/media_service.dart b/examples/layers/services/media_service.dart index 23d961dcf9..1bd51cec40 100644 --- a/examples/layers/services/media_service.dart +++ b/examples/layers/services/media_service.dart @@ -51,7 +51,7 @@ class PianoKey { } } -class PianoApp extends StatelessComponent { +class PianoApp extends StatelessWidget { final List keys = [ 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) ) ); diff --git a/examples/layers/widgets/autolayout.dart b/examples/layers/widgets/autolayout.dart index b5ea37670a..3b4d02865a 100644 --- a/examples/layers/widgets/autolayout.dart +++ b/examples/layers/widgets/autolayout.dart @@ -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(); } diff --git a/examples/layers/widgets/custom_render_box.dart b/examples/layers/widgets/custom_render_box.dart index ac609911d0..a938388484 100644 --- a/examples/layers/widgets/custom_render_box.dart +++ b/examples/layers/widgets/custom_render_box.dart @@ -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(); } diff --git a/examples/layers/widgets/gestures.dart b/examples/layers/widgets/gestures.dart index 0b456d80fc..de280959d6 100644 --- a/examples/layers/widgets/gestures.dart +++ b/examples/layers/widgets/gestures.dart @@ -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 { 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: [ new Row( diff --git a/examples/layers/widgets/media_query.dart b/examples/layers/widgets/media_query.dart index 80caa8d83c..b58b8a7777 100644 --- a/examples/layers/widgets/media_query.dart +++ b/examples/layers/widgets/media_query.dart @@ -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: [ 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 names; diff --git a/examples/layers/widgets/sectors.dart b/examples/layers/widgets/sectors.dart index d1c3243fe4..98005251ce 100644 --- a/examples/layers/widgets/sectors.dart +++ b/examples/layers/widgets/sectors.dart @@ -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 { return new Column( children: [ 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: [ new RaisedButton( @@ -101,8 +101,8 @@ class SectorAppState extends State { child: new Row( children: [ 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 { child: new Row( children: [ 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 { ), 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 diff --git a/examples/layers/widgets/spinning_mixed.dart b/examples/layers/widgets/spinning_mixed.dart index c566349565..8a56ed849f 100644 --- a/examples/layers/widgets/spinning_mixed.dart +++ b/examples/layers/widgets/spinning_mixed.dart @@ -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: [ 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); diff --git a/examples/layers/widgets/spinning_square.dart b/examples/layers/widgets/spinning_square.dart index cd0adc10ff..bf754c6a2c 100644 --- a/examples/layers/widgets/spinning_square.dart +++ b/examples/layers/widgets/spinning_square.dart @@ -4,7 +4,7 @@ import 'package:flutter/widgets.dart'; -class SpinningSquare extends StatefulComponent { +class SpinningSquare extends StatefulWidget { _SpinningSquareState createState() => new _SpinningSquareState(); } diff --git a/examples/layers/widgets/styled_text.dart b/examples/layers/widgets/styled_text.dart index abd2ec9bc4..af6ce892d8 100644 --- a/examples/layers/widgets/styled_text.dart +++ b/examples/layers/widgets/styled_text.dart @@ -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 { 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, diff --git a/examples/material_gallery/lib/demo/buttons_demo.dart b/examples/material_gallery/lib/demo/buttons_demo.dart index fc6ee21ebc..4fb92b2895 100644 --- a/examples/material_gallery/lib/demo/buttons_demo.dart +++ b/examples/material_gallery/lib/demo/buttons_demo.dart @@ -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 { 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: [ new RaisedButton( @@ -108,7 +108,7 @@ class _ButtonsDemoState extends State { ] .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 { 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 { ] .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 { 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: [ 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) ) ] diff --git a/examples/material_gallery/lib/demo/cards_demo.dart b/examples/material_gallery/lib/demo/cards_demo.dart index 3f74e934c4..c8e8911e9b 100644 --- a/examples/material_gallery/lib/demo/cards_demo.dart +++ b/examples/material_gallery/lib/demo/cards_demo.dart @@ -36,7 +36,7 @@ final List destinations = [ ) ]; -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: [ 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) ); }) diff --git a/examples/material_gallery/lib/demo/chip_demo.dart b/examples/material_gallery/lib/demo/chip_demo.dart index 3807123704..e6cf5a4455 100644 --- a/examples/material_gallery/lib/demo/chip_demo.dart +++ b/examples/material_gallery/lib/demo/chip_demo.dart @@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; -class ChipDemo extends StatefulComponent { +class ChipDemo extends StatefulWidget { _ChipDemoState createState() => new _ChipDemoState(); } diff --git a/examples/material_gallery/lib/demo/colors_demo.dart b/examples/material_gallery/lib/demo/colors_demo.dart index 2e5e9dc8b6..e34ce9dc77 100644 --- a/examples/material_gallery/lib/demo/colors_demo.dart +++ b/examples/material_gallery/lib/demo/colors_demo.dart @@ -41,7 +41,7 @@ const List colorSwatches = const [ ]; -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( values: colorSwatches, diff --git a/examples/material_gallery/lib/demo/date_picker_demo.dart b/examples/material_gallery/lib/demo/date_picker_demo.dart index 7022ad26af..794c833cd0 100644 --- a/examples/material_gallery/lib/demo/date_picker_demo.dart +++ b/examples/material_gallery/lib/demo/date_picker_demo.dart @@ -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(); } diff --git a/examples/material_gallery/lib/demo/dialog_demo.dart b/examples/material_gallery/lib/demo/dialog_demo.dart index 46ccb73339..9a2540a0fb 100644 --- a/examples/material_gallery/lib/demo/dialog_demo.dart +++ b/examples/material_gallery/lib/demo/dialog_demo.dart @@ -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 { 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 { 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: [ new RaisedButton( child: new Text('ALERT'), diff --git a/examples/material_gallery/lib/demo/drop_down_demo.dart b/examples/material_gallery/lib/demo/drop_down_demo.dart index 3d2a3f4f4e..55afe0d92c 100644 --- a/examples/material_gallery/lib/demo/drop_down_demo.dart +++ b/examples/material_gallery/lib/demo/drop_down_demo.dart @@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; -class DropDownDemo extends StatefulComponent { +class DropDownDemo extends StatefulWidget { _DropDownDemoState createState() => new _DropDownDemoState(); } diff --git a/examples/material_gallery/lib/demo/fitness_demo.dart b/examples/material_gallery/lib/demo/fitness_demo.dart index d15682e832..355e2a9604 100644 --- a/examples/material_gallery/lib/demo/fitness_demo.dart +++ b/examples/material_gallery/lib/demo/fitness_demo.dart @@ -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: [ @@ -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(); diff --git a/examples/material_gallery/lib/demo/flexible_space_demo.dart b/examples/material_gallery/lib/demo/flexible_space_demo.dart index f8d24c45e7..e17502ffe8 100644 --- a/examples/material_gallery/lib/demo/flexible_space_demo.dart +++ b/examples/material_gallery/lib/demo/flexible_space_demo.dart @@ -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: [ 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 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 rowChildren = [ 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 { ), body: new Block( scrollableKey: scrollableKey, - padding: new EdgeDims.only(top: appBarHeight), + padding: new EdgeInsets.only(top: appBarHeight), children: [ new _ContactCategory( icon: Icons.call, diff --git a/examples/material_gallery/lib/demo/full_screen_dialog_demo.dart b/examples/material_gallery/lib/demo/full_screen_dialog_demo.dart index 3bd48c164b..3f7d3e652a 100644 --- a/examples/material_gallery/lib/demo/full_screen_dialog_demo.dart +++ b/examples/material_gallery/lib/demo/full_screen_dialog_demo.dart @@ -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: [ 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 { } 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 { center: new Text('New Event'), right: [ 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 { ] ), 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: [ 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: [ - 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 { alignItems: FlexAlignItems.stretch, justifyContent: FlexJustifyContent.end, children: [ - 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 { ] .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 ); diff --git a/examples/material_gallery/lib/demo/grid_list_demo.dart b/examples/material_gallery/lib/demo/grid_list_demo.dart index c3aaea869d..ff1b6e4784 100644 --- a/examples/material_gallery/lib/demo/grid_list_demo.dart +++ b/examples/material_gallery/lib/demo/grid_list_demo.dart @@ -28,7 +28,7 @@ final List photos = new List.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 { ) ]; - 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 { 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) { diff --git a/examples/material_gallery/lib/demo/icons_demo.dart b/examples/material_gallery/lib/demo/icons_demo.dart index 3146fda5dd..a46d6711fd 100644 --- a/examples/material_gallery/lib/demo/icons_demo.dart +++ b/examples/material_gallery/lib/demo/icons_demo.dart @@ -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 { 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 { 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: [ new Row( diff --git a/examples/material_gallery/lib/demo/leave_behind_demo.dart b/examples/material_gallery/lib/demo/leave_behind_demo.dart index a5dbb3010a..a8b4554706 100644 --- a/examples/material_gallery/lib/demo/leave_behind_demo.dart +++ b/examples/material_gallery/lib/demo/leave_behind_demo.dart @@ -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 { ] ), body: new Block( - padding: new EdgeDims.all(4.0), + padding: new EdgeInsets.all(4.0), children: leaveBehindItems.map(buildItem).toList() ) ); diff --git a/examples/material_gallery/lib/demo/list_demo.dart b/examples/material_gallery/lib/demo/list_demo.dart index 4966b980cc..429ba402ca 100644 --- a/examples/material_gallery/lib/demo/list_demo.dart +++ b/examples/material_gallery/lib/demo/list_demo.dart @@ -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 { ] ), body: new Block( - padding: new EdgeDims.all(_dense ? 4.0 : 8.0), + padding: new EdgeInsets.all(_dense ? 4.0 : 8.0), children: listItems.toList() ) ); diff --git a/examples/material_gallery/lib/demo/menu_demo.dart b/examples/material_gallery/lib/demo/menu_demo.dart index b219bfb3a2..d627fb340a 100644 --- a/examples/material_gallery/lib/demo/menu_demo.dart +++ b/examples/material_gallery/lib/demo/menu_demo.dart @@ -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 { ] ), body: new Block( - padding: const EdgeDims.all(8.0), + padding: const EdgeInsets.all(8.0), children: [ // Pressing the PopupMenuButton on the right of this item shows // a simple menu with one disabled item. Typically the contents diff --git a/examples/material_gallery/lib/demo/modal_bottom_sheet_demo.dart b/examples/material_gallery/lib/demo/modal_bottom_sheet_demo.dart index 675c644a56..6341377bc1 100644 --- a/examples/material_gallery/lib/demo/modal_bottom_sheet_demo.dart +++ b/examples/material_gallery/lib/demo/modal_bottom_sheet_demo.dart @@ -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/**/(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) ) ); diff --git a/examples/material_gallery/lib/demo/page_selector_demo.dart b/examples/material_gallery/lib/demo/page_selector_demo.dart index 31a83daad9..4158e461ef 100644 --- a/examples/material_gallery/lib/demo/page_selector_demo.dart +++ b/examples/material_gallery/lib/demo/page_selector_demo.dart @@ -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 selection = TabBarSelection.of/**/(context); @@ -32,7 +32,7 @@ class PageSelectorDemo extends StatelessComponent { return new Column( children: [ new Container( - margin: const EdgeDims.only(top: 16.0), + margin: const EdgeInsets.only(top: 16.0), child: new Row( children: [ 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) diff --git a/examples/material_gallery/lib/demo/persistent_bottom_sheet_demo.dart b/examples/material_gallery/lib/demo/persistent_bottom_sheet_demo.dart index 1b279f60cf..6513863768 100644 --- a/examples/material_gallery/lib/demo/persistent_bottom_sheet_demo.dart +++ b/examples/material_gallery/lib/demo/persistent_bottom_sheet_demo.dart @@ -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) ) ); diff --git a/examples/material_gallery/lib/demo/progress_indicator_demo.dart b/examples/material_gallery/lib/demo/progress_indicator_demo.dart index d6701b99f0..b6245ad2cd 100644 --- a/examples/material_gallery/lib/demo/progress_indicator_demo.dart +++ b/examples/material_gallery/lib/demo/progress_indicator_demo.dart @@ -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 { ]; 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 { 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 diff --git a/examples/material_gallery/lib/demo/scrolling_techniques_demo.dart b/examples/material_gallery/lib/demo/scrolling_techniques_demo.dart index 840e5da516..d5ac4fe1dc 100644 --- a/examples/material_gallery/lib/demo/scrolling_techniques_demo.dart +++ b/examples/material_gallery/lib/demo/scrolling_techniques_demo.dart @@ -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: [ @@ -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 :[ @@ -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: [ 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(), diff --git a/examples/material_gallery/lib/demo/slider_demo.dart b/examples/material_gallery/lib/demo/slider_demo.dart index ae17ee1370..a86ed46d2e 100644 --- a/examples/material_gallery/lib/demo/slider_demo.dart +++ b/examples/material_gallery/lib/demo/slider_demo.dart @@ -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 { } ), 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 { // 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)) ), ], diff --git a/examples/material_gallery/lib/demo/snack_bar_demo.dart b/examples/material_gallery/lib/demo/snack_bar_demo.dart index 09b2d3181f..0b1595ed18 100644 --- a/examples/material_gallery/lib/demo/snack_bar_demo.dart +++ b/examples/material_gallery/lib/demo/snack_bar_demo.dart @@ -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: [ 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 ); }) diff --git a/examples/material_gallery/lib/demo/tabs_demo.dart b/examples/material_gallery/lib/demo/tabs_demo.dart index 3df5e45956..48c9ba3ebb 100644 --- a/examples/material_gallery/lib/demo/tabs_demo.dart +++ b/examples/material_gallery/lib/demo/tabs_demo.dart @@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; -class TabsDemo extends StatelessComponent { +class TabsDemo extends StatelessWidget { final List icons = [ 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( diff --git a/examples/material_gallery/lib/demo/tabs_fab_demo.dart b/examples/material_gallery/lib/demo/tabs_fab_demo.dart index 1f13eddab6..9cbe49b9bd 100644 --- a/examples/material_gallery/lib/demo/tabs_fab_demo.dart +++ b/examples/material_gallery/lib/demo/tabs_fab_demo.dart @@ -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 { 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 { return new Container( key: new ValueKey(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) diff --git a/examples/material_gallery/lib/demo/text_field_demo.dart b/examples/material_gallery/lib/demo/text_field_demo.dart index 566a1727ba..dffdc30105 100644 --- a/examples/material_gallery/lib/demo/text_field_demo.dart +++ b/examples/material_gallery/lib/demo/text_field_demo.dart @@ -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 { center: new Text('Text Fields') ), body: new Block( - padding: const EdgeDims.all(8.0), + padding: const EdgeInsets.all(8.0), children: [ new Input( hintText: 'What do people call you?', diff --git a/examples/material_gallery/lib/demo/time_picker_demo.dart b/examples/material_gallery/lib/demo/time_picker_demo.dart index 1ab5e15a72..56a26f0209 100644 --- a/examples/material_gallery/lib/demo/time_picker_demo.dart +++ b/examples/material_gallery/lib/demo/time_picker_demo.dart @@ -6,7 +6,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; -class TimePickerDemo extends StatefulComponent { +class TimePickerDemo extends StatefulWidget { _TimePickerDemoState createState() => new _TimePickerDemoState(); } diff --git a/examples/material_gallery/lib/demo/toggle_controls_demo.dart b/examples/material_gallery/lib/demo/toggle_controls_demo.dart index d7a6a91018..eb92ee8bec 100644 --- a/examples/material_gallery/lib/demo/toggle_controls_demo.dart +++ b/examples/material_gallery/lib/demo/toggle_controls_demo.dart @@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; -class ToggleControlsDemo extends StatefulComponent { +class ToggleControlsDemo extends StatefulWidget { _ToggleControlsDemoState createState() => new _ToggleControlsDemoState(); } diff --git a/examples/material_gallery/lib/demo/tooltip_demo.dart b/examples/material_gallery/lib/demo/tooltip_demo.dart index b79fa9ef7a..a4a5dca9eb 100644 --- a/examples/material_gallery/lib/demo/tooltip_demo.dart +++ b/examples/material_gallery/lib/demo/tooltip_demo.dart @@ -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: [ - new Text(_introText, style: theme.text.subhead), + new Text(_introText, style: theme.textTheme.subhead), new Row( children: [ - 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 ); }) diff --git a/examples/material_gallery/lib/demo/two_level_list_demo.dart b/examples/material_gallery/lib/demo/two_level_list_demo.dart index 0604ac859b..506b7e5a37 100644 --- a/examples/material_gallery/lib/demo/two_level_list_demo.dart +++ b/examples/material_gallery/lib/demo/two_level_list_demo.dart @@ -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: [ diff --git a/examples/material_gallery/lib/demo/typography_demo.dart b/examples/material_gallery/lib/demo/typography_demo.dart index f884400d15..83c0f5587c 100644 --- a/examples/material_gallery/lib/demo/typography_demo.dart +++ b/examples/material_gallery/lib/demo/typography_demo.dart @@ -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: [ @@ -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 styleItems = [ new TextStyleItem(name: 'display3', style: textTheme.display3, text: 'Regular 56sp'), new TextStyleItem(name: 'display2', style: textTheme.display2, text: 'Regular 45sp'), diff --git a/examples/material_gallery/lib/demo/weather_demo.dart b/examples/material_gallery/lib/demo/weather_demo.dart index fb65a9fbbc..1cd56dabbe 100644 --- a/examples/material_gallery/lib/demo/weather_demo.dart +++ b/examples/material_gallery/lib/demo/weather_demo.dart @@ -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 { 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, diff --git a/examples/material_gallery/lib/gallery/app.dart b/examples/material_gallery/lib/gallery/app.dart index 1b05d4dd3a..39fe069ace 100644 --- a/examples/material_gallery/lib/gallery/app.dart +++ b/examples/material_gallery/lib/gallery/app.dart @@ -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()); diff --git a/examples/material_gallery/lib/gallery/drawer.dart b/examples/material_gallery/lib/gallery/drawer.dart index db3cf8f149..1509e854de 100644 --- a/examples/material_gallery/lib/gallery/drawer.dart +++ b/examples/material_gallery/lib/gallery/drawer.dart @@ -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) { diff --git a/examples/material_gallery/lib/gallery/home.dart b/examples/material_gallery/lib/gallery/home.dart index d8c119d266..9214e20537 100644 --- a/examples/material_gallery/lib/gallery/home.dart +++ b/examples/material_gallery/lib/gallery/home.dart @@ -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 { 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 { } ), body: new Block( - padding: const EdgeDims.all(4.0), + padding: const EdgeInsets.all(4.0), children: [ new Row( children: [ diff --git a/examples/material_gallery/lib/gallery/section.dart b/examples/material_gallery/lib/gallery/section.dart index e9cd9b8fb6..82e8463209 100644 --- a/examples/material_gallery/lib/gallery/section.dart +++ b/examples/material_gallery/lib/gallery/section.dart @@ -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 []).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: [ 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) diff --git a/examples/stocks/lib/main.dart b/examples/stocks/lib/main.dart index d29394d5d5..d22b124f6d 100644 --- a/examples/stocks/lib/main.dart +++ b/examples/stocks/lib/main.dart @@ -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(); } diff --git a/examples/stocks/lib/stock_arrow.dart b/examples/stocks/lib/stock_arrow.dart index 67f0203d75..84ce41a351 100644 --- a/examples/stocks/lib/stock_arrow.dart +++ b/examples/stocks/lib/stock_arrow.dart @@ -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 diff --git a/examples/stocks/lib/stock_home.dart b/examples/stocks/lib/stock_home.dart index 0c30b21256..fd58211ef7 100644 --- a/examples/stocks/lib/stock_home.dart +++ b/examples/stocks/lib/stock_home.dart @@ -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 stocks; @@ -355,7 +355,7 @@ class StockHomeState extends State { } } -class _CreateCompanySheet extends StatefulComponent { +class _CreateCompanySheet extends StatefulWidget { _CreateCompanySheetState createState() => new _CreateCompanySheetState(); } diff --git a/examples/stocks/lib/stock_list.dart b/examples/stocks/lib/stock_list.dart index e94f296d48..8ffadaab24 100644 --- a/examples/stocks/lib/stock_list.dart +++ b/examples/stocks/lib/stock_list.dart @@ -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; diff --git a/examples/stocks/lib/stock_row.dart b/examples/stocks/lib/stock_row.dart index 40a7399b4b..e1f2b68426 100644 --- a/examples/stocks/lib/stock_row.dart +++ b/examples/stocks/lib/stock_row.dart @@ -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: [ new Container( - margin: const EdgeDims.only(right: 5.0), + margin: const EdgeInsets.only(right: 5.0), child: new Hero( tag: StockRowPartKind.arrow, key: _arrowKey, diff --git a/examples/stocks/lib/stock_settings.dart b/examples/stocks/lib/stock_settings.dart index 215c66b632..46600abc26 100644 --- a/examples/stocks/lib/stock_settings.dart +++ b/examples/stocks/lib/stock_settings.dart @@ -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 { }); return new Block( children: rows, - padding: const EdgeDims.symmetric(vertical: 20.0) + padding: const EdgeInsets.symmetric(vertical: 20.0) ); } diff --git a/examples/stocks/lib/stock_symbol_viewer.dart b/examples/stocks/lib/stock_symbol_viewer.dart index 308247da34..dee4f2a2d3 100644 --- a/examples/stocks/lib/stock_symbol_viewer.dart +++ b/examples/stocks/lib/stock_symbol_viewer.dart @@ -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: [ new Row( children: [ 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: [ 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)) ), diff --git a/packages/flutter/lib/painting.dart b/packages/flutter/lib/painting.dart index 7902f6b323..0789ee7757 100644 --- a/packages/flutter/lib/painting.dart +++ b/packages/flutter/lib/painting.dart @@ -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'; diff --git a/packages/flutter/lib/src/gestures/arena.dart b/packages/flutter/lib/src/gestures/arena.dart index 76e65674cd..9392e5c69f 100644 --- a/packages/flutter/lib/src/gestures/arena.dart +++ b/packages/flutter/lib/src/gestures/arena.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 members = new List(); 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 _arenas = new Map(); +class GestureArenaManager { + final Map _arenas = new Map(); /// 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); } } diff --git a/packages/flutter/lib/src/gestures/binding.dart b/packages/flutter/lib/src/gestures/binding.dart index 42c58bbb51..d8324bd359 100644 --- a/packages/flutter/lib/src/gestures/binding.dart +++ b/packages/flutter/lib/src/gestures/binding.dart @@ -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. /// diff --git a/packages/flutter/lib/src/gestures/recognizer.dart b/packages/flutter/lib/src/gestures/recognizer.dart index 4af8037073..21bc125858 100644 --- a/packages/flutter/lib/src/gestures/recognizer.dart +++ b/packages/flutter/lib/src/gestures/recognizer.dart @@ -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); diff --git a/packages/flutter/lib/src/material/bottom_sheet.dart b/packages/flutter/lib/src/material/bottom_sheet.dart index c27989e446..21d750ca69 100644 --- a/packages/flutter/lib/src/material/bottom_sheet.dart +++ b/packages/flutter/lib/src/material/bottom_sheet.dart @@ -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 { // 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 extends StatefulComponent { +class _ModalBottomSheet extends StatefulWidget { _ModalBottomSheet({ Key key, this.route }) : super(key: key); final _ModalBottomSheetRoute route; @@ -133,7 +133,7 @@ class _ModalBottomSheetState extends State<_ModalBottomSheet> { 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, diff --git a/packages/flutter/lib/src/material/button.dart b/packages/flutter/lib/src/material/button.dart index 0883e9a6aa..0fd126aef2 100644 --- a/packages/flutter/lib/src/material/button.dart +++ b/packages/flutter/lib/src/material/button.dart @@ -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 extends State { 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 extends State { 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 ); } diff --git a/packages/flutter/lib/src/material/card.dart b/packages/flutter/lib/src/material/card.dart index cb790a311b..241d553c37 100644 --- a/packages/flutter/lib/src/material/card.dart +++ b/packages/flutter/lib/src/material/card.dart @@ -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 /// /// -class Card extends StatelessComponent { +class Card extends StatelessWidget { const Card({ Key key, this.child, this.color }) : super(key: key); final Widget child; diff --git a/packages/flutter/lib/src/material/checkbox.dart b/packages/flutter/lib/src/material/checkbox.dart index 6e551e8d28..54b1d4222d 100644 --- a/packages/flutter/lib/src/material/checkbox.dart +++ b/packages/flutter/lib/src/material/checkbox.dart @@ -21,7 +21,7 @@ import 'toggleable.dart'; /// the checkbox. /// /// -class Checkbox extends StatelessComponent { +class Checkbox extends StatelessWidget { /// Constructs a checkbox /// /// * `value` determines whether the checkbox is checked. diff --git a/packages/flutter/lib/src/material/chip.dart b/packages/flutter/lib/src/material/chip.dart index 3e64a8c736..32354daf43 100644 --- a/packages/flutter/lib/src/material/chip.dart +++ b/packages/flutter/lib/src/material/chip.dart @@ -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 diff --git a/packages/flutter/lib/src/material/circle_avatar.dart b/packages/flutter/lib/src/material/circle_avatar.dart index 73e4e392b1..a10fbfd60f 100644 --- a/packages/flutter/lib/src/material/circle_avatar.dart +++ b/packages/flutter/lib/src/material/circle_avatar.dart @@ -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, diff --git a/packages/flutter/lib/src/material/constants.dart b/packages/flutter/lib/src/material/constants.dart index b546a959ea..72c9c4b95b 100644 --- a/packages/flutter/lib/src/material/constants.dart +++ b/packages/flutter/lib/src/material/constants.dart @@ -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); diff --git a/packages/flutter/lib/src/material/date_picker.dart b/packages/flutter/lib/src/material/date_picker.dart index d12a625399..59c5a8e692 100644 --- a/packages/flutter/lib/src/material/date_picker.dart +++ b/packages/flutter/lib/src/material/date_picker.dart @@ -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 { } // 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: [ @@ -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 { } // 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 { static const double _itemExtent = 50.0; List 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 items = new List(); for (int i = start; i < start + count; i++) { int year = config.firstDate.year + i; diff --git a/packages/flutter/lib/src/material/date_picker_dialog.dart b/packages/flutter/lib/src/material/date_picker_dialog.dart index 7129a3d421..2d58f0b1d9 100644 --- a/packages/flutter/lib/src/material/date_picker_dialog.dart +++ b/packages/flutter/lib/src/material/date_picker_dialog.dart @@ -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: [ new FlatButton( child: new Text('CANCEL'), diff --git a/packages/flutter/lib/src/material/dialog.dart b/packages/flutter/lib/src/material/dialog.dart index 197fa44972..3104b56480 100644 --- a/packages/flutter/lib/src/material/dialog.dart +++ b/packages/flutter/lib/src/material/dialog.dart @@ -16,7 +16,7 @@ typedef Widget DialogBuilder(NavigatorState navigator); /// A material design dialog /// /// -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 dialogBody = new List(); 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( diff --git a/packages/flutter/lib/src/material/divider.dart b/packages/flutter/lib/src/material/divider.dart index 0781e97fc0..d01968a955 100644 --- a/packages/flutter/lib/src/material/divider.dart +++ b/packages/flutter/lib/src/material/divider.dart @@ -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 diff --git a/packages/flutter/lib/src/material/drawer.dart b/packages/flutter/lib/src/material/drawer.dart index 32d2d40d9e..e3353e92e5 100644 --- a/packages/flutter/lib/src/material/drawer.dart +++ b/packages/flutter/lib/src/material/drawer.dart @@ -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 diff --git a/packages/flutter/lib/src/material/drawer_header.dart b/packages/flutter/lib/src/material/drawer_header.dart index bb265dbb2a..4feb78b81d 100644 --- a/packages/flutter/lib/src/material/drawer_header.dart +++ b/packages/flutter/lib/src/material/drawer_header.dart @@ -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: [ 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 ) ) diff --git a/packages/flutter/lib/src/material/drawer_item.dart b/packages/flutter/lib/src/material/drawer_item.dart index 8f91ce7ca4..05942a0fa7 100644 --- a/packages/flutter/lib/src/material/drawer_item.dart +++ b/packages/flutter/lib/src/material/drawer_item.dart @@ -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 diff --git a/packages/flutter/lib/src/material/dropdown.dart b/packages/flutter/lib/src/material/dropdown.dart index 82c3b8d3c9..bf63f95ff2 100644 --- a/packages/flutter/lib/src/material/dropdown.dart +++ b/packages/flutter/lib/src/material/dropdown.dart @@ -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 extends StatusTransitionComponent { +class _DropDownMenu extends StatusTransitionWidget { _DropDownMenu({ Key key, _DropDownRoute route @@ -197,7 +197,7 @@ class _DropDownRoute extends PopupRoute<_DropDownRouteResult> { } } -class DropDownMenuItem extends StatelessComponent { +class DropDownMenuItem extends StatelessWidget { DropDownMenuItem({ Key key, this.value, @@ -210,9 +210,9 @@ class DropDownMenuItem 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 extends StatelessComponent { } } -class DropDownButton extends StatefulComponent { +class DropDownButton extends StatefulWidget { DropDownButton({ Key key, this.items, @@ -301,7 +301,7 @@ class _DropDownButtonState extends State> { ), 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 diff --git a/packages/flutter/lib/src/material/flexible_space_bar.dart b/packages/flutter/lib/src/material/flexible_space_bar.dart index 679cecf667..f61b63e810 100644 --- a/packages/flutter/lib/src/material/flexible_space_bar.dart +++ b/packages/flutter/lib/src/material/flexible_space_bar.dart @@ -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 { assert(debugCheckHasScaffold(context)); final double appBarHeight = Scaffold.of(context).appBarHeight; final Animation 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 children = []; @@ -70,7 +70,7 @@ class _FlexibleSpaceBarState extends State { 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( begin: new FractionalOffset(0.0, yAlignStart), diff --git a/packages/flutter/lib/src/material/floating_action_button.dart b/packages/flutter/lib/src/material/floating_action_button.dart index 682f2b5234..edc81b5962 100644 --- a/packages/flutter/lib/src/material/floating_action_button.dart +++ b/packages/flutter/lib/src/material/floating_action_button.dart @@ -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, diff --git a/packages/flutter/lib/src/material/grid_tile.dart b/packages/flutter/lib/src/material/grid_tile.dart index 159f9e236a..fefd8f8a32 100644 --- a/packages/flutter/lib/src/material/grid_tile.dart +++ b/packages/flutter/lib/src/material/grid_tile.dart @@ -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); } diff --git a/packages/flutter/lib/src/material/grid_tile_bar.dart b/packages/flutter/lib/src/material/grid_tile_bar.dart index bd3cede3c0..48f92107c1 100644 --- a/packages/flutter/lib/src/material/grid_tile_bar.dart +++ b/packages/flutter/lib/src/material/grid_tile_bar.dart @@ -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 children = []; 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, diff --git a/packages/flutter/lib/src/material/icon.dart b/packages/flutter/lib/src/material/icon.dart index 6290b46e62..90a8bf4798 100644 --- a/packages/flutter/lib/src/material/icon.dart +++ b/packages/flutter/lib/src/material/icon.dart @@ -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, diff --git a/packages/flutter/lib/src/material/icon_button.dart b/packages/flutter/lib/src/material/icon_button.dart index 83e46e378b..461dc75459 100644 --- a/packages/flutter/lib/src/material/icon_button.dart +++ b/packages/flutter/lib/src/material/icon_button.dart @@ -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, diff --git a/packages/flutter/lib/src/material/ink_well.dart b/packages/flutter/lib/src/material/ink_well.dart index fd729178e7..1eff1e7f48 100644 --- a/packages/flutter/lib/src/material/ink_well.dart +++ b/packages/flutter/lib/src/material/ink_well.dart @@ -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, diff --git a/packages/flutter/lib/src/material/input.dart b/packages/flutter/lib/src/material/input.dart index a176e058fe..cf7120ab70 100644 --- a/packages/flutter/lib/src/material/input.dart +++ b/packages/flutter/lib/src/material/input.dart @@ -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 { 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 { 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 { } 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 { )); } - 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 { 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 { )); 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 { 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 { 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 ) ); diff --git a/packages/flutter/lib/src/material/list.dart b/packages/flutter/lib/src/material/list.dart index 3eaedbed21..507dd4a929 100644 --- a/packages/flutter/lib/src/material/list.dart +++ b/packages/flutter/lib/src/material/list.dart @@ -21,14 +21,14 @@ Map kListItemExtent = const 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 children; - final EdgeDims scrollablePadding; + final EdgeInsets scrollablePadding; final Key scrollableKey; _MaterialListState createState() => new _MaterialListState(); @@ -52,7 +52,7 @@ class _MaterialListState extends State { 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 ); diff --git a/packages/flutter/lib/src/material/list_item.dart b/packages/flutter/lib/src/material/list_item.dart index f3ec9f23f8..09df91f3ac 100644 --- a/packages/flutter/lib/src/material/list_item.dart +++ b/packages/flutter/lib/src/material/list_item.dart @@ -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 diff --git a/packages/flutter/lib/src/material/material.dart b/packages/flutter/lib/src/material/material.dart index 4956be5708..b2f2de7974 100644 --- a/packages/flutter/lib/src/material/material.dart +++ b/packages/flutter/lib/src/material/material.dart @@ -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 { 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; diff --git a/packages/flutter/lib/src/material/page.dart b/packages/flutter/lib/src/material/page.dart index b5c3d3b94e..303b0be982 100644 --- a/packages/flutter/lib/src/material/page.dart +++ b/packages/flutter/lib/src/material/page.dart @@ -6,7 +6,7 @@ import 'dart:async'; import 'package:flutter/widgets.dart'; -class _MaterialPageTransition extends AnimatedComponent { +class _MaterialPageTransition extends AnimatedWidget { _MaterialPageTransition({ Key key, Animation animation, diff --git a/packages/flutter/lib/src/material/popup_menu.dart b/packages/flutter/lib/src/material/popup_menu.dart index 5ba198dbe0..a3638547e9 100644 --- a/packages/flutter/lib/src/material/popup_menu.dart +++ b/packages/flutter/lib/src/material/popup_menu.dart @@ -28,7 +28,7 @@ const double _kMenuVerticalPadding = 8.0; const double _kMenuWidthStep = 56.0; const double _kMenuScreenPadding = 8.0; -abstract class PopupMenuEntry extends StatefulComponent { +abstract class PopupMenuEntry extends StatefulWidget { PopupMenuEntry({ Key key }) : super(key: key); double get height; @@ -75,7 +75,7 @@ class _PopupMenuItemState> extends State { 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> extends State { 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 extends _PopupMenuItemState extends StatelessComponent { +class _PopupMenu extends StatelessWidget { _PopupMenu({ Key key, this.route @@ -204,7 +204,7 @@ class _PopupMenu 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 extends StatelessComponent { } } -class _PopupMenuRouteLayout extends OneChildLayoutDelegate { +class _PopupMenuRouteLayout extends SingleChildLayoutDelegate { _PopupMenuRouteLayout(this.position, this.selectedItemOffset); final ModalPosition position; @@ -316,7 +316,7 @@ class _PopupMenuRoute extends PopupRoute { 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(route: this) ) @@ -357,7 +357,7 @@ typedef void PopupMenuItemSelected(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 extends StatefulComponent { +class PopupMenuButton extends StatefulWidget { PopupMenuButton({ Key key, this.items, diff --git a/packages/flutter/lib/src/material/progress_indicator.dart b/packages/flutter/lib/src/material/progress_indicator.dart index 5955c8bb6a..37bce7ca8e 100644 --- a/packages/flutter/lib/src/material/progress_indicator.dart +++ b/packages/flutter/lib/src/material/progress_indicator.dart @@ -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 diff --git a/packages/flutter/lib/src/material/radio.dart b/packages/flutter/lib/src/material/radio.dart index 342648b425..83b4bd3024 100644 --- a/packages/flutter/lib/src/material/radio.dart +++ b/packages/flutter/lib/src/material/radio.dart @@ -14,7 +14,7 @@ const double _kDiameter = 16.0; const double _kOuterRadius = _kDiameter / 2.0; const double _kInnerRadius = 5.0; -class Radio extends StatelessComponent { +class Radio extends StatelessWidget { Radio({ Key key, this.value, diff --git a/packages/flutter/lib/src/material/scaffold.dart b/packages/flutter/lib/src/material/scaffold.dart index faf0d64cb4..a415863fb4 100644 --- a/packages/flutter/lib/src/material/scaffold.dart +++ b/packages/flutter/lib/src/material/scaffold.dart @@ -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: -class Scaffold extends StatefulComponent { +class Scaffold extends StatefulWidget { Scaffold({ Key key, this.toolBar, @@ -375,11 +375,11 @@ class ScaffoldState extends State { 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 { } 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 { } 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 route = ModalRoute.of(context); @@ -538,7 +538,7 @@ class ScaffoldState extends State { new CustomMultiChildLayout( children: children, delegate: new _ScaffoldLayout( - padding: EdgeDims.zero + padding: EdgeInsets.zero ) ), new Positioned( @@ -572,7 +572,7 @@ class ScaffoldFeatureController { final StateSetter setState; } -class _PersistentBottomSheet extends StatefulComponent { +class _PersistentBottomSheet extends StatefulWidget { _PersistentBottomSheet({ Key key, this.animationController, diff --git a/packages/flutter/lib/src/material/shadows.dart b/packages/flutter/lib/src/material/shadows.dart index 98cf23b44b..a2e9fc9a6a 100644 --- a/packages/flutter/lib/src/material/shadows.dart +++ b/packages/flutter/lib/src/material/shadows.dart @@ -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. diff --git a/packages/flutter/lib/src/material/slider.dart b/packages/flutter/lib/src/material/slider.dart index d51a348936..d503380547 100644 --- a/packages/flutter/lib/src/material/slider.dart +++ b/packages/flutter/lib/src/material/slider.dart @@ -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, diff --git a/packages/flutter/lib/src/material/snack_bar.dart b/packages/flutter/lib/src/material/snack_bar.dart index 20cde5bd9a..257bba7daa 100644 --- a/packages/flutter/lib/src/material/snack_bar.dart +++ b/packages/flutter/lib/src/material/snack_bar.dart @@ -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 children = [ 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, diff --git a/packages/flutter/lib/src/material/switch.dart b/packages/flutter/lib/src/material/switch.dart index 4a7461e40e..d6d3185eb5 100644 --- a/packages/flutter/lib/src/material/switch.dart +++ b/packages/flutter/lib/src/material/switch.dart @@ -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); diff --git a/packages/flutter/lib/src/material/tabs.dart b/packages/flutter/lib/src/material/tabs.dart index 961cef77a0..4ff2bc22a3 100644 --- a/packages/flutter/lib/src/material/tabs.dart +++ b/packages/flutter/lib/src/material/tabs.dart @@ -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: [ 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 extends StatefulComponent { +class TabBarSelection extends StatefulWidget { TabBarSelection({ Key key, this.value, @@ -784,7 +784,7 @@ class _TabBarState extends ScrollableState> 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 extends PageableListState> 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 extends PageableListState> implements Ta } } -class TabPageSelector extends StatelessComponent { +class TabPageSelector extends StatelessWidget { const TabPageSelector({ Key key }) : super(key: key); Widget _buildTabIndicator(TabBarSelectionState selection, T tab, Animation animation, ColorTween selectedColor, ColorTween previousColor) { @@ -988,7 +988,7 @@ class TabPageSelector 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), diff --git a/packages/flutter/lib/src/material/theme_data.dart b/packages/flutter/lib/src/material/theme_data.dart index 139037e626..6490dd1163 100644 --- a/packages/flutter/lib/src/material/theme_data.dart +++ b/packages/flutter/lib/src/material/theme_data.dart @@ -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 ) diff --git a/packages/flutter/lib/src/material/time_picker.dart b/packages/flutter/lib/src/material/time_picker.dart index 59294d39fc..69501663f4 100644 --- a/packages/flutter/lib/src/material/time_picker.dart +++ b/packages/flutter/lib/src/material/time_picker.dart @@ -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 { 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 { } // 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: [ 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, diff --git a/packages/flutter/lib/src/material/time_picker_dialog.dart b/packages/flutter/lib/src/material/time_picker_dialog.dart index 4c40967132..b026dfd7c3 100644 --- a/packages/flutter/lib/src/material/time_picker_dialog.dart +++ b/packages/flutter/lib/src/material/time_picker_dialog.dart @@ -10,7 +10,7 @@ import 'dialog.dart'; import 'time_picker.dart'; import 'flat_button.dart'; -class _TimePickerDialog extends StatefulComponent { +class _TimePickerDialog extends StatefulWidget { _TimePickerDialog({ Key key, this.initialTime @@ -49,7 +49,7 @@ class _TimePickerDialogState extends State<_TimePickerDialog> { selectedTime: _selectedTime, onChanged: _handleTimeChanged ), - contentPadding: EdgeDims.zero, + contentPadding: EdgeInsets.zero, actions: [ new FlatButton( child: new Text('CANCEL'), diff --git a/packages/flutter/lib/src/material/tool_bar.dart b/packages/flutter/lib/src/material/tool_bar.dart index 4d8920047f..7182c4b598 100644 --- a/packages/flutter/lib/src/material/tool_bar.dart +++ b/packages/flutter/lib/src/material/tool_bar.dart @@ -11,7 +11,7 @@ import 'material.dart'; import 'theme.dart'; import 'typography.dart'; -class ToolBar extends StatelessComponent { +class ToolBar extends StatelessWidget { ToolBar({ Key key, this.left, @@ -23,7 +23,7 @@ class ToolBar extends StatelessComponent { this.elevation: 4, this.backgroundColor, this.textTheme, - this.padding: EdgeDims.zero + this.padding: EdgeInsets.zero }) : super(key: key) { assert((flexibleSpace != null) ? tabBar == null : true); assert((tabBar != null) ? flexibleSpace == null : true); @@ -38,7 +38,7 @@ class ToolBar extends StatelessComponent { final int elevation; final Color backgroundColor; final TextTheme textTheme; - final EdgeDims padding; + final EdgeInsets padding; ToolBar copyWith({ Key key, @@ -50,7 +50,7 @@ class ToolBar extends StatelessComponent { int elevation, Color backgroundColor, TextTheme textTheme, - EdgeDims padding + EdgeInsets padding }) { return new ToolBar( key: key ?? this.key, @@ -103,7 +103,7 @@ class ToolBar extends StatelessComponent { toolBarRow.add( new Flexible( child: new Padding( - padding: new EdgeDims.only(left: 24.0), + padding: new EdgeInsets.only(left: 24.0), child: center != null ? new DefaultTextStyle(style: centerStyle, child: center) : null ) ) @@ -111,7 +111,7 @@ class ToolBar extends StatelessComponent { if (right != null) toolBarRow.addAll(right); - EdgeDims combinedPadding = new EdgeDims.symmetric(horizontal: 8.0); + EdgeInsets combinedPadding = new EdgeInsets.symmetric(horizontal: 8.0); if (padding != null) combinedPadding += padding; @@ -121,7 +121,7 @@ class ToolBar extends StatelessComponent { final Widget toolBar = new ConstrainedBox( constraints: new BoxConstraints(maxHeight: toolBarHeight), child: new Padding( - padding: new EdgeDims.only(left: combinedPadding.left, right: combinedPadding.right), + padding: new EdgeInsets.only(left: combinedPadding.left, right: combinedPadding.right), child: new ClipRect( child: new OverflowBox( alignment: const FractionalOffset(0.0, 1.0), // bottom justify @@ -130,7 +130,7 @@ class ToolBar extends StatelessComponent { child: new DefaultTextStyle( style: sideStyle, child: new Padding( - padding: new EdgeDims.only(top: combinedPadding.top, bottom: combinedPadding.bottom), + padding: new EdgeInsets.only(top: combinedPadding.top, bottom: combinedPadding.bottom), child: new Row(children: toolBarRow) ) ) diff --git a/packages/flutter/lib/src/material/tooltip.dart b/packages/flutter/lib/src/material/tooltip.dart index 66292f64db..520ef671b1 100644 --- a/packages/flutter/lib/src/material/tooltip.dart +++ b/packages/flutter/lib/src/material/tooltip.dart @@ -12,13 +12,13 @@ import 'theme.dart'; const double _kDefaultTooltipBorderRadius = 2.0; const double _kDefaultTooltipHeight = 32.0; -const EdgeDims _kDefaultTooltipPadding = const EdgeDims.symmetric(horizontal: 16.0); +const EdgeInsets _kDefaultTooltipPadding = const EdgeInsets.symmetric(horizontal: 16.0); const double _kDefaultVerticalTooltipOffset = 24.0; -const EdgeDims _kDefaultTooltipScreenEdgeMargin = const EdgeDims.all(10.0); +const EdgeInsets _kDefaultTooltipScreenEdgeMargin = const EdgeInsets.all(10.0); const Duration _kDefaultTooltipFadeDuration = const Duration(milliseconds: 200); const Duration _kDefaultTooltipShowDuration = const Duration(seconds: 2); -class Tooltip extends StatefulComponent { +class Tooltip extends StatefulWidget { Tooltip({ Key key, this.message, @@ -56,9 +56,9 @@ class Tooltip extends StatefulComponent { final double opacity; final double borderRadius; final double height; - final EdgeDims padding; + final EdgeInsets padding; final double verticalOffset; - final EdgeDims screenEdgeMargin; + final EdgeInsets screenEdgeMargin; final bool preferBelow; final Duration fadeDuration; final Duration showDuration; @@ -132,7 +132,7 @@ class _TooltipState extends State { RenderBox box = context.findRenderObject(); Point target = box.localToGlobal(box.size.center(Point.origin)); _entry = new OverlayEntry(builder: (BuildContext context) { - TextStyle textStyle = (config.style ?? Theme.of(context).text.body1).copyWith(color: config.textColor ?? Colors.white); + TextStyle textStyle = (config.style ?? Theme.of(context).textTheme.body1).copyWith(color: config.textColor ?? Colors.white); return new _TooltipOverlay( message: config.message, backgroundColor: config.backgroundColor ?? Colors.grey[700], @@ -189,7 +189,7 @@ class _TooltipState extends State { } } -class _TooltipPositionDelegate extends OneChildLayoutDelegate { +class _TooltipPositionDelegate extends SingleChildLayoutDelegate { _TooltipPositionDelegate({ this.target, this.verticalOffset, @@ -198,7 +198,7 @@ class _TooltipPositionDelegate extends OneChildLayoutDelegate { }); final Point target; final double verticalOffset; - final EdgeDims screenEdgeMargin; + final EdgeInsets screenEdgeMargin; final bool preferBelow; BoxConstraints getConstraintsForChild(BoxConstraints constraints) => constraints.loosen(); @@ -234,7 +234,7 @@ class _TooltipPositionDelegate extends OneChildLayoutDelegate { } } -class _TooltipOverlay extends StatelessComponent { +class _TooltipOverlay extends StatelessWidget { _TooltipOverlay({ Key key, this.message, @@ -257,11 +257,11 @@ class _TooltipOverlay extends StatelessComponent { final double opacity; final double borderRadius; final double height; - final EdgeDims padding; + final EdgeInsets padding; final Animation animation; final Point target; final double verticalOffset; - final EdgeDims screenEdgeMargin; + final EdgeInsets screenEdgeMargin; final bool preferBelow; Widget build(BuildContext context) { @@ -271,7 +271,7 @@ class _TooltipOverlay extends StatelessComponent { right: 0.0, bottom: 0.0, child: new IgnorePointer( - child: new CustomOneChildLayout( + child: new CustomSingleChildLayout( delegate: new _TooltipPositionDelegate( target: target, verticalOffset: verticalOffset, diff --git a/packages/flutter/lib/src/material/two_level_list.dart b/packages/flutter/lib/src/material/two_level_list.dart index 104521db42..bd1236c03c 100644 --- a/packages/flutter/lib/src/material/two_level_list.dart +++ b/packages/flutter/lib/src/material/two_level_list.dart @@ -14,7 +14,7 @@ import 'theme_data.dart'; const Duration _kExpand = const Duration(milliseconds: 200); -class TwoLevelListItem extends StatelessComponent { +class TwoLevelListItem extends StatelessWidget { TwoLevelListItem({ Key key, this.left, @@ -49,7 +49,7 @@ class TwoLevelListItem extends StatelessComponent { } } -class TwoLevelSublist extends StatefulComponent { +class TwoLevelSublist extends StatefulWidget { TwoLevelSublist({ Key key, this.left, this.center, this.children }) : super(key: key); final Widget left; @@ -110,7 +110,7 @@ class _TwoLevelSublistState extends State { onTap: _handleOnTap, left: config.left, center: new DefaultTextStyle( - style: Theme.of(context).text.subhead.copyWith(color: _headerColor.evaluate(_easeInAnimation)), + style: Theme.of(context).textTheme.subhead.copyWith(color: _headerColor.evaluate(_easeInAnimation)), child: config.center ), right: new RotationTransition( @@ -136,7 +136,7 @@ class _TwoLevelSublistState extends State { final ThemeData theme = Theme.of(context); _borderColor.end = theme.dividerColor; _headerColor - ..begin = theme.text.subhead.color + ..begin = theme.textTheme.subhead.color ..end = theme.accentColor; _iconColor ..begin = theme.unselectedColor @@ -149,7 +149,7 @@ class _TwoLevelSublistState extends State { } } -class TwoLevelList extends StatelessComponent { +class TwoLevelList extends StatelessWidget { TwoLevelList({ Key key, this.items, this.type: MaterialListType.twoLine }) : super(key: key); final List items; diff --git a/packages/flutter/lib/src/painting/box_painter.dart b/packages/flutter/lib/src/painting/box_painter.dart index 7739b01793..13a3946359 100644 --- a/packages/flutter/lib/src/painting/box_painter.dart +++ b/packages/flutter/lib/src/painting/box_painter.dart @@ -9,9 +9,9 @@ import 'package:flutter/services.dart'; import 'basic_types.dart'; import 'decoration.dart'; -import 'edge_dims.dart'; +import 'edge_insets.dart'; -export 'edge_dims.dart' show EdgeDims; +export 'edge_insets.dart' show EdgeInsets; /// A side of a border of a box. class BorderSide { @@ -93,9 +93,9 @@ class Border { /// The left side of this border. final BorderSide left; - /// The widths of the sides of this border represented as an EdgeDims. - EdgeDims get dimensions { - return new EdgeDims.TRBL(top.width, right.width, bottom.width, left.width); + /// The widths of the sides of this border represented as an EdgeInsets. + EdgeInsets get dimensions { + return new EdgeInsets.TRBL(top.width, right.width, bottom.width, left.width); } Border scale(double t) { @@ -797,7 +797,7 @@ class BoxDecoration extends Decoration { final BoxShape shape; /// The inset space occupied by the border. - EdgeDims get padding => border?.dimensions; + EdgeInsets get padding => border?.dimensions; /// Returns a new box decoration that is scaled by the given factor. BoxDecoration scale(double factor) { diff --git a/packages/flutter/lib/src/painting/decoration.dart b/packages/flutter/lib/src/painting/decoration.dart index 00829e93d6..8600aa674c 100644 --- a/packages/flutter/lib/src/painting/decoration.dart +++ b/packages/flutter/lib/src/painting/decoration.dart @@ -3,16 +3,16 @@ // found in the LICENSE file. import 'basic_types.dart'; -import 'edge_dims.dart'; +import 'edge_insets.dart'; -export 'edge_dims.dart' show EdgeDims; +export 'edge_insets.dart' show EdgeInsets; // This group of classes is intended for painting in cartesian coordinates. abstract class Decoration { const Decoration(); bool debugAssertValid() => true; - EdgeDims get padding => null; + EdgeInsets get padding => null; Decoration lerpFrom(Decoration a, double t) => this; Decoration lerpTo(Decoration b, double t) => b; bool hitTest(Size size, Point position) => true; diff --git a/packages/flutter/lib/src/painting/edge_dims.dart b/packages/flutter/lib/src/painting/edge_insets.dart similarity index 63% rename from packages/flutter/lib/src/painting/edge_dims.dart rename to packages/flutter/lib/src/painting/edge_insets.dart index 5fd44573b2..767ea68fe7 100644 --- a/packages/flutter/lib/src/painting/edge_dims.dart +++ b/packages/flutter/lib/src/painting/edge_insets.dart @@ -10,22 +10,22 @@ import 'basic_types.dart'; /// /// Typically used for an offset from each of the four sides of a box. For /// example, the padding inside a box can be represented using this class. -class EdgeDims { - /// Constructs an EdgeDims from offsets from the top, right, bottom and left. - const EdgeDims.TRBL(this.top, this.right, this.bottom, this.left); +class EdgeInsets { + /// Constructs insets from offsets from the top, right, bottom and left. + const EdgeInsets.TRBL(this.top, this.right, this.bottom, this.left); - /// Constructs an EdgeDims where all the offsets are value. - const EdgeDims.all(double value) + /// Constructs insets where all the offsets are value. + const EdgeInsets.all(double value) : top = value, right = value, bottom = value, left = value; - /// Constructs an EdgeDims with only the given values non-zero. - const EdgeDims.only({ this.top: 0.0, + /// Constructs insets with only the given values non-zero. + const EdgeInsets.only({ this.top: 0.0, this.right: 0.0, this.bottom: 0.0, this.left: 0.0 }); - /// Constructs an EdgeDims with symmetrical vertical and horizontal offsets. - const EdgeDims.symmetric({ double vertical: 0.0, + /// Constructs insets with symmetrical vertical and horizontal offsets. + const EdgeInsets.symmetric({ double vertical: 0.0, double horizontal: 0.0 }) : top = vertical, left = horizontal, bottom = vertical, right = horizontal; @@ -50,18 +50,18 @@ class EdgeDims { /// The total offset in the horizontal direction. double get vertical => top + bottom; - /// The size that this EdgeDims would occupy with an empty interior. + /// The size that this EdgeInsets would occupy with an empty interior. Size get collapsedSize => new Size(horizontal, vertical); - /// An EdgeDims with top and bottom as well as left and right flipped. - EdgeDims get flipped => new EdgeDims.TRBL(bottom, left, top, right); + /// An EdgeInsets with top and bottom as well as left and right flipped. + EdgeInsets get flipped => new EdgeInsets.TRBL(bottom, left, top, right); Rect inflateRect(Rect rect) { return new Rect.fromLTRB(rect.left - left, rect.top - top, rect.right + right, rect.bottom + bottom); } - EdgeDims operator -(EdgeDims other) { - return new EdgeDims.TRBL( + EdgeInsets operator -(EdgeInsets other) { + return new EdgeInsets.TRBL( top - other.top, right - other.right, bottom - other.bottom, @@ -69,8 +69,8 @@ class EdgeDims { ); } - EdgeDims operator +(EdgeDims other) { - return new EdgeDims.TRBL( + EdgeInsets operator +(EdgeInsets other) { + return new EdgeInsets.TRBL( top + other.top, right + other.right, bottom + other.bottom, @@ -78,8 +78,8 @@ class EdgeDims { ); } - EdgeDims operator *(double other) { - return new EdgeDims.TRBL( + EdgeInsets operator *(double other) { + return new EdgeInsets.TRBL( top * other, right * other, bottom * other, @@ -87,8 +87,8 @@ class EdgeDims { ); } - EdgeDims operator /(double other) { - return new EdgeDims.TRBL( + EdgeInsets operator /(double other) { + return new EdgeInsets.TRBL( top / other, right / other, bottom / other, @@ -96,8 +96,8 @@ class EdgeDims { ); } - EdgeDims operator ~/(double other) { - return new EdgeDims.TRBL( + EdgeInsets operator ~/(double other) { + return new EdgeInsets.TRBL( (top ~/ other).toDouble(), (right ~/ other).toDouble(), (bottom ~/ other).toDouble(), @@ -105,8 +105,8 @@ class EdgeDims { ); } - EdgeDims operator %(double other) { - return new EdgeDims.TRBL( + EdgeInsets operator %(double other) { + return new EdgeInsets.TRBL( top % other, right % other, bottom % other, @@ -114,17 +114,17 @@ class EdgeDims { ); } - /// Linearly interpolate between two EdgeDims. + /// Linearly interpolate between two EdgeInsets. /// - /// If either is null, this function interpolates from [EdgeDims.zero]. - static EdgeDims lerp(EdgeDims a, EdgeDims b, double t) { + /// If either is null, this function interpolates from [EdgeInsets.zero]. + static EdgeInsets lerp(EdgeInsets a, EdgeInsets b, double t) { if (a == null && b == null) return null; if (a == null) return b * t; if (b == null) return a * (1.0 - t); - return new EdgeDims.TRBL( + return new EdgeInsets.TRBL( ui.lerpDouble(a.top, b.top, t), ui.lerpDouble(a.right, b.right, t), ui.lerpDouble(a.bottom, b.bottom, t), @@ -132,15 +132,15 @@ class EdgeDims { ); } - /// An EdgeDims with zero offsets in each direction. - static const EdgeDims zero = const EdgeDims.TRBL(0.0, 0.0, 0.0, 0.0); + /// An EdgeInsets with zero offsets in each direction. + static const EdgeInsets zero = const EdgeInsets.TRBL(0.0, 0.0, 0.0, 0.0); bool operator ==(dynamic other) { if (identical(this, other)) return true; - if (other is! EdgeDims) + if (other is! EdgeInsets) return false; - final EdgeDims typedOther = other; + final EdgeInsets typedOther = other; return top == typedOther.top && right == typedOther.right && bottom == typedOther.bottom && @@ -149,5 +149,5 @@ class EdgeDims { int get hashCode => hashValues(top, left, bottom, right); - String toString() => "EdgeDims($top, $right, $bottom, $left)"; + String toString() => "EdgeInsets($top, $right, $bottom, $left)"; } diff --git a/packages/flutter/lib/src/rendering/block.dart b/packages/flutter/lib/src/rendering/block.dart index f3b2d85c4b..a7b9090e97 100644 --- a/packages/flutter/lib/src/rendering/block.dart +++ b/packages/flutter/lib/src/rendering/block.dart @@ -28,14 +28,14 @@ typedef double _Constrainer(double value); abstract class RenderBlockBase extends RenderBox with ContainerRenderObjectMixin, RenderBoxContainerDefaultsMixin - implements HasScrollDirection { + implements HasMainAxis { RenderBlockBase({ List children, - Axis direction: Axis.vertical, + Axis mainAxis: Axis.vertical, double itemExtent, double minExtent: 0.0 - }) : _direction = direction, _itemExtent = itemExtent, _minExtent = minExtent { + }) : _mainAxis = mainAxis, _itemExtent = itemExtent, _minExtent = minExtent { addAll(children); } @@ -45,11 +45,11 @@ abstract class RenderBlockBase extends RenderBox } /// The direction to use as the main axis. - Axis get direction => _direction; - Axis _direction; - void set direction (Axis value) { - if (_direction != value) { - _direction = value; + Axis get mainAxis => _mainAxis; + Axis _mainAxis; + void set mainAxis (Axis value) { + if (_mainAxis != value) { + _mainAxis = value; markNeedsLayout(); } } @@ -75,9 +75,7 @@ abstract class RenderBlockBase extends RenderBox } /// Whether the main axis is vertical. - bool get isVertical => _direction == Axis.vertical; - - Axis get scrollDirection => _direction; + bool get isVertical => _mainAxis == Axis.vertical; BoxConstraints _getInnerConstraints(BoxConstraints constraints) { if (isVertical) @@ -117,7 +115,7 @@ abstract class RenderBlockBase extends RenderBox void debugFillDescription(List description) { super.debugFillDescription(description); - description.add('direction: $direction'); + description.add('mainAxis: $mainAxis'); } } @@ -126,10 +124,10 @@ class RenderBlock extends RenderBlockBase { RenderBlock({ List children, - Axis direction: Axis.vertical, + Axis mainAxis: Axis.vertical, double itemExtent, double minExtent: 0.0 - }) : super(children: children, direction: direction, itemExtent: itemExtent, minExtent: minExtent); + }) : super(children: children, mainAxis: mainAxis, itemExtent: itemExtent, minExtent: minExtent); double _getIntrinsicCrossAxis(BoxConstraints constraints, _ChildSizingFunction childSize, _Constrainer constrainer) { double extent = 0.0; @@ -241,8 +239,8 @@ class RenderBlockViewport extends RenderBlockBase { ExtentCallback totalExtentCallback, ExtentCallback maxCrossAxisDimensionCallback, ExtentCallback minCrossAxisDimensionCallback, - Painter overlayPainter, - Axis direction: Axis.vertical, + RenderObjectPainter overlayPainter, + Axis mainAxis: Axis.vertical, double itemExtent, double minExtent: 0.0, double startOffset: 0.0, @@ -253,7 +251,7 @@ class RenderBlockViewport extends RenderBlockBase { _minCrossAxisExtentCallback = minCrossAxisDimensionCallback, _overlayPainter = overlayPainter, _startOffset = startOffset, - super(children: children, direction: direction, itemExtent: itemExtent, minExtent: minExtent); + super(children: children, mainAxis: mainAxis, itemExtent: itemExtent, minExtent: minExtent); bool _inCallback = false; bool get isRepaintBoundary => true; @@ -311,9 +309,9 @@ class RenderBlockViewport extends RenderBlockBase { markNeedsLayout(); } - Painter get overlayPainter => _overlayPainter; - Painter _overlayPainter; - void set overlayPainter(Painter value) { + RenderObjectPainter get overlayPainter => _overlayPainter; + RenderObjectPainter _overlayPainter; + void set overlayPainter(RenderObjectPainter value) { if (_overlayPainter == value) return; if (attached) diff --git a/packages/flutter/lib/src/rendering/box.dart b/packages/flutter/lib/src/rendering/box.dart index 162cf04520..caf8111628 100644 --- a/packages/flutter/lib/src/rendering/box.dart +++ b/packages/flutter/lib/src/rendering/box.dart @@ -107,7 +107,7 @@ class BoxConstraints extends Constraints { } /// Returns new box constraints that are smaller by the given edge dimensions. - BoxConstraints deflate(EdgeDims edges) { + BoxConstraints deflate(EdgeInsets edges) { assert(edges != null); assert(debugAssertIsNormalized); double horizontal = edges.left + edges.right; diff --git a/packages/flutter/lib/src/rendering/custom_layout.dart b/packages/flutter/lib/src/rendering/custom_layout.dart index 88c481f975..d5d0608af6 100644 --- a/packages/flutter/lib/src/rendering/custom_layout.dart +++ b/packages/flutter/lib/src/rendering/custom_layout.dart @@ -5,7 +5,7 @@ import 'box.dart'; import 'object.dart'; -// For OneChildLayoutDelegate and RenderCustomOneChildLayoutBox, see shifted_box.dart +// For SingleChildLayoutDelegate and RenderCustomSingleChildLayoutBox, see shifted_box.dart /// [ParentData] used by [RenderCustomMultiChildLayoutBox]. class MultiChildLayoutParentData extends ContainerBoxParentDataMixin { @@ -32,7 +32,7 @@ abstract class MultiChildLayoutDelegate { /// Call this from the [performLayout] or [getSize] methods to /// determine which children are available, if the child list might /// vary. - bool isChild(Object childId) => _idToChild[childId] != null; + bool hasChild(Object childId) => _idToChild[childId] != null; /// Ask the child to update its layout within the limits specified by /// the constraints parameter. The child's size is returned. diff --git a/packages/flutter/lib/src/rendering/grid.dart b/packages/flutter/lib/src/rendering/grid.dart index 02059c917d..6ded3dbae4 100644 --- a/packages/flutter/lib/src/rendering/grid.dart +++ b/packages/flutter/lib/src/rendering/grid.dart @@ -40,7 +40,7 @@ class GridSpecification { this.rowOffsets, this.columnSpacing: 0.0, this.rowSpacing: 0.0, - this.padding: EdgeDims.zero + this.padding: EdgeInsets.zero }) { assert(_debugIsMonotonic(columnOffsets)); assert(_debugIsMonotonic(rowOffsets)); @@ -61,7 +61,7 @@ class GridSpecification { int rowCount, this.rowSpacing: 0.0, this.columnSpacing: 0.0, - this.padding: EdgeDims.zero + this.padding: EdgeInsets.zero }) : columnOffsets = _generateRegularOffsets(columnCount, tileWidth), rowOffsets = _generateRegularOffsets(rowCount, tileHeight) { assert(_debugIsMonotonic(columnOffsets)); @@ -105,7 +105,7 @@ class GridSpecification { /// /// The grid's size encloses the spaced rows and columns and is then inflated /// by the padding. - final EdgeDims padding; + final EdgeInsets padding; /// The size of the grid. Size get gridSize => new Size(columnOffsets.last + padding.horizontal, rowOffsets.last + padding.vertical); @@ -189,7 +189,7 @@ abstract class GridDelegateWithInOrderChildPlacement extends GridDelegate { GridDelegateWithInOrderChildPlacement({ this.columnSpacing: 0.0, this.rowSpacing: 0.0, - this.padding: EdgeDims.zero + this.padding: EdgeInsets.zero }) { assert(columnSpacing != null && columnSpacing >= 0.0); assert(rowSpacing != null && rowSpacing >= 0.0); @@ -203,7 +203,7 @@ abstract class GridDelegateWithInOrderChildPlacement extends GridDelegate { final double rowSpacing; // Insets for the entire grid. - final EdgeDims padding; + final EdgeInsets padding; GridChildPlacement getChildPlacement(GridSpecification specification, int index, Object placementData) { final int columnCount = specification.columnOffsets.length - 1; @@ -227,7 +227,7 @@ class FixedColumnCountGridDelegate extends GridDelegateWithInOrderChildPlacement this.columnCount, double columnSpacing: 0.0, double rowSpacing: 0.0, - EdgeDims padding: EdgeDims.zero, + EdgeInsets padding: EdgeInsets.zero, this.tileAspectRatio: 1.0 }) : super(columnSpacing: columnSpacing, rowSpacing: rowSpacing, padding: padding) { assert(columnCount != null && columnCount >= 0); @@ -285,7 +285,7 @@ class MaxTileWidthGridDelegate extends GridDelegateWithInOrderChildPlacement { this.tileAspectRatio: 1.0, double columnSpacing: 0.0, double rowSpacing: 0.0, - EdgeDims padding: EdgeDims.zero + EdgeInsets padding: EdgeInsets.zero }) : super(columnSpacing: columnSpacing, rowSpacing: rowSpacing, padding: padding) { assert(maxTileWidth != null && maxTileWidth >= 0.0); assert(tileAspectRatio != null && tileAspectRatio > 0.0); @@ -358,7 +358,7 @@ class RenderGrid extends RenderVirtualViewport { int virtualChildBase: 0, int virtualChildCount, Offset paintOffset: Offset.zero, - Painter overlayPainter, + RenderObjectPainter overlayPainter, LayoutCallback callback }) : _delegate = delegate, _virtualChildBase = virtualChildBase, super( virtualChildCount: virtualChildCount, @@ -384,13 +384,13 @@ class RenderGrid extends RenderVirtualViewport { _delegate = newDelegate; } - void set scrollDirection(Axis value) { + void set mainAxis(Axis value) { assert(() { if (value != Axis.vertical) throw new RenderingError('RenderGrid doesn\'t yet support horizontal scrolling.'); return true; }); - super.scrollDirection = value; + super.mainAxis = value; } int get virtualChildCount => super.virtualChildCount ?? childCount; diff --git a/packages/flutter/lib/src/rendering/list.dart b/packages/flutter/lib/src/rendering/list.dart index 48a867e00d..2e04d1c723 100644 --- a/packages/flutter/lib/src/rendering/list.dart +++ b/packages/flutter/lib/src/rendering/list.dart @@ -15,18 +15,20 @@ class RenderList extends RenderVirtualViewport { RenderList({ List children, double itemExtent, - EdgeDims padding, + EdgeInsets padding, int virtualChildCount, Offset paintOffset: Offset.zero, - Axis scrollDirection: Axis.vertical, - Painter overlayPainter, + Axis mainAxis: Axis.vertical, + ViewportAnchor anchor: ViewportAnchor.start, + RenderObjectPainter overlayPainter, LayoutCallback callback }) : _itemExtent = itemExtent, _padding = padding, super( virtualChildCount: virtualChildCount, paintOffset: paintOffset, - scrollDirection: scrollDirection, + mainAxis: mainAxis, + anchor: anchor, overlayPainter: overlayPainter, callback: callback ) { @@ -43,9 +45,9 @@ class RenderList extends RenderVirtualViewport { markNeedsLayout(); } - EdgeDims get padding => _padding; - EdgeDims _padding; - void set padding (EdgeDims newValue) { + EdgeInsets get padding => _padding; + EdgeInsets _padding; + void set padding (EdgeInsets newValue) { if (_padding == newValue) return; _padding = newValue; @@ -58,7 +60,7 @@ class RenderList extends RenderVirtualViewport { } double get _scrollAxisPadding { - switch (scrollDirection) { + switch (mainAxis) { case Axis.vertical: return padding.vertical; case Axis.horizontal: @@ -80,7 +82,7 @@ class RenderList extends RenderVirtualViewport { double _getIntrinsicWidth(BoxConstraints constraints) { assert(constraints.debugAssertIsNormalized); - switch (scrollDirection) { + switch (mainAxis) { case Axis.vertical: return constraints.constrainWidth(0.0); case Axis.horizontal: @@ -98,7 +100,7 @@ class RenderList extends RenderVirtualViewport { double _getIntrinsicHeight(BoxConstraints constraints) { assert(constraints.debugAssertIsNormalized); - switch (scrollDirection) { + switch (mainAxis) { case Axis.vertical: return constraints.constrainHeight(_preferredExtent); case Axis.horizontal: @@ -115,7 +117,7 @@ class RenderList extends RenderVirtualViewport { } void performLayout() { - switch (scrollDirection) { + switch (mainAxis) { case Axis.vertical: size = new Size(constraints.maxWidth, constraints.constrainHeight(_preferredExtent)); @@ -138,7 +140,7 @@ class RenderList extends RenderVirtualViewport { double y = 0.0; double dy = 0.0; - switch (scrollDirection) { + switch (mainAxis) { case Axis.vertical: itemWidth = math.max(0.0, size.width - (padding == null ? 0.0 : padding.horizontal)); itemHeight = itemExtent ?? size.height; diff --git a/packages/flutter/lib/src/rendering/object.dart b/packages/flutter/lib/src/rendering/object.dart index e944ac6f01..56b650b3b2 100644 --- a/packages/flutter/lib/src/rendering/object.dart +++ b/packages/flutter/lib/src/rendering/object.dart @@ -323,7 +323,7 @@ class PaintingContext { /// /// A renderer may allow its paint() method to be augmented or redefined by /// providing a Painter. See for example overlayPainter in BlockViewport. -abstract class Painter { +abstract class RenderObjectPainter { RenderObject get renderObject => _renderObject; RenderObject _renderObject; diff --git a/packages/flutter/lib/src/rendering/shifted_box.dart b/packages/flutter/lib/src/rendering/shifted_box.dart index 18f2154f88..744b10cb4a 100644 --- a/packages/flutter/lib/src/rendering/shifted_box.dart +++ b/packages/flutter/lib/src/rendering/shifted_box.dart @@ -84,7 +84,7 @@ abstract class RenderShiftedBox extends RenderBox with RenderObjectWithChildMixi /// padding, effectively creating empty space around the child. class RenderPadding extends RenderShiftedBox { RenderPadding({ - EdgeDims padding, + EdgeInsets padding, RenderBox child }) : _padding = padding, super(child) { assert(padding != null); @@ -92,9 +92,9 @@ class RenderPadding extends RenderShiftedBox { } /// The amount to pad the child in each dimension. - EdgeDims get padding => _padding; - EdgeDims _padding; - void set padding (EdgeDims value) { + EdgeInsets get padding => _padding; + EdgeInsets _padding; + void set padding (EdgeInsets value) { assert(value != null); assert(value.isNonNegative); if (_padding == value) @@ -506,7 +506,7 @@ class RenderOverflowBox extends RenderShiftedBox { } /// A delegate for computing the layout of a render object with a single child. -class OneChildLayoutDelegate { +class SingleChildLayoutDelegate { /// Returns the size of this object given the incoming constraints. Size getSize(BoxConstraints constraints) => constraints.biggest; @@ -517,7 +517,7 @@ class OneChildLayoutDelegate { Offset getPositionForChild(Size size, Size childSize) => Offset.zero; /// Override this method to return true when the child needs to be laid out. - bool shouldRelayout(OneChildLayoutDelegate oldDelegate) => true; + bool shouldRelayout(SingleChildLayoutDelegate oldDelegate) => true; } /// Defers the layout of its single child to a delegate. @@ -526,18 +526,18 @@ class OneChildLayoutDelegate { /// decide where to position the child. The delegate can also determine the size /// of the parent, but the size of the parent cannot depend on the size of the /// child. -class RenderCustomOneChildLayoutBox extends RenderShiftedBox { - RenderCustomOneChildLayoutBox({ +class RenderCustomSingleChildLayoutBox extends RenderShiftedBox { + RenderCustomSingleChildLayoutBox({ RenderBox child, - OneChildLayoutDelegate delegate + SingleChildLayoutDelegate delegate }) : _delegate = delegate, super(child) { assert(delegate != null); } /// A delegate that controls this object's layout. - OneChildLayoutDelegate get delegate => _delegate; - OneChildLayoutDelegate _delegate; - void set delegate (OneChildLayoutDelegate newDelegate) { + SingleChildLayoutDelegate get delegate => _delegate; + SingleChildLayoutDelegate _delegate; + void set delegate (SingleChildLayoutDelegate newDelegate) { assert(newDelegate != null); if (_delegate == newDelegate) return; diff --git a/packages/flutter/lib/src/rendering/viewport.dart b/packages/flutter/lib/src/rendering/viewport.dart index 0ecfa83211..eb4b3f49ad 100644 --- a/packages/flutter/lib/src/rendering/viewport.dart +++ b/packages/flutter/lib/src/rendering/viewport.dart @@ -71,9 +71,9 @@ class ViewportDimensions { } /// An interface that indicates that an object has a scroll direction. -abstract class HasScrollDirection { +abstract class HasMainAxis { /// Whether this object scrolls horizontally or vertically. - Axis get scrollDirection; + Axis get mainAxis; } /// A base class for render objects that are bigger on the inside. @@ -81,19 +81,19 @@ abstract class HasScrollDirection { /// This class holds the common fields for viewport render objects but does not /// have a child model. See [RenderViewport] for a viewport with a single child /// and [RenderVirtualViewport] for a viewport with multiple children. -class RenderViewportBase extends RenderBox implements HasScrollDirection { +class RenderViewportBase extends RenderBox implements HasMainAxis { RenderViewportBase( Offset paintOffset, - Axis scrollDirection, - ViewportAnchor scrollAnchor, - Painter overlayPainter + Axis mainAxis, + ViewportAnchor anchor, + RenderObjectPainter overlayPainter ) : _paintOffset = paintOffset, - _scrollDirection = scrollDirection, - _scrollAnchor = scrollAnchor, + _mainAxis = mainAxis, + _anchor = anchor, _overlayPainter = overlayPainter { assert(paintOffset != null); - assert(scrollDirection != null); - assert(_offsetIsSane(_paintOffset, scrollDirection)); + assert(mainAxis != null); + assert(_offsetIsSane(_paintOffset, mainAxis)); } bool _offsetIsSane(Offset offset, Axis direction) { @@ -107,14 +107,14 @@ class RenderViewportBase extends RenderBox implements HasScrollDirection { /// The offset at which to paint the child. /// - /// The offset can be non-zero only in the [scrollDirection]. + /// The offset can be non-zero only in the [mainAxis]. Offset get paintOffset => _paintOffset; Offset _paintOffset; void set paintOffset(Offset value) { assert(value != null); if (value == _paintOffset) return; - assert(_offsetIsSane(value, scrollDirection)); + assert(_offsetIsSane(value, mainAxis)); _paintOffset = value; markNeedsPaint(); markNeedsSemanticsUpdate(); @@ -125,34 +125,34 @@ class RenderViewportBase extends RenderBox implements HasScrollDirection { /// If the viewport is scrollable in a particular direction (e.g., vertically), /// the child is given layout constraints that are fully unconstrainted in /// that direction (e.g., the child can be as tall as it wants). - Axis get scrollDirection => _scrollDirection; - Axis _scrollDirection; - void set scrollDirection(Axis value) { + Axis get mainAxis => _mainAxis; + Axis _mainAxis; + void set mainAxis(Axis value) { assert(value != null); - if (value == _scrollDirection) + if (value == _mainAxis) return; assert(_offsetIsSane(_paintOffset, value)); - _scrollDirection = value; + _mainAxis = value; markNeedsLayout(); } /// The end of the viewport from which the paint offset is computed. /// /// See [ViewportAnchor] for more detail. - ViewportAnchor get scrollAnchor => _scrollAnchor; - ViewportAnchor _scrollAnchor; - void set scrollAnchor(ViewportAnchor value) { + ViewportAnchor get anchor => _anchor; + ViewportAnchor _anchor; + void set anchor(ViewportAnchor value) { assert(value != null); - if (value == _scrollAnchor) + if (value == _anchor) return; - _scrollAnchor = value; + _anchor = value; markNeedsPaint(); markNeedsSemanticsUpdate(); } - Painter get overlayPainter => _overlayPainter; - Painter _overlayPainter; - void set overlayPainter(Painter value) { + RenderObjectPainter get overlayPainter => _overlayPainter; + RenderObjectPainter _overlayPainter; + void set overlayPainter(RenderObjectPainter value) { if (_overlayPainter == value) return; if (attached) @@ -186,7 +186,7 @@ class RenderViewportBase extends RenderBox implements HasScrollDirection { int dyInDevicePixels = (_paintOffset.dy * devicePixelRatio).round(); return _dimensions.getAbsolutePaintOffset( paintOffset: new Offset(dxInDevicePixels / devicePixelRatio, dyInDevicePixels / devicePixelRatio), - anchor: _scrollAnchor + anchor: _anchor ); } @@ -198,8 +198,8 @@ class RenderViewportBase extends RenderBox implements HasScrollDirection { void debugFillDescription(List description) { super.debugFillDescription(description); description.add('paintOffset: $paintOffset'); - description.add('scrollDirection: $scrollDirection'); - description.add('scrollAnchor: $scrollAnchor'); + description.add('mainAxis: $mainAxis'); + description.add('anchor: $anchor'); if (overlayPainter != null) description.add('overlay painter: $overlayPainter'); } @@ -218,11 +218,11 @@ class RenderViewport extends RenderViewportBase with RenderObjectWithChildMixin< RenderViewport({ RenderBox child, Offset paintOffset: Offset.zero, - Axis scrollDirection: Axis.vertical, - ViewportAnchor scrollAnchor: ViewportAnchor.start, - Painter overlayPainter, + Axis mainAxis: Axis.vertical, + ViewportAnchor anchor: ViewportAnchor.start, + RenderObjectPainter overlayPainter, this.onPaintOffsetUpdateNeeded - }) : super(paintOffset, scrollDirection, scrollAnchor, overlayPainter) { + }) : super(paintOffset, mainAxis, anchor, overlayPainter) { this.child = child; } @@ -232,7 +232,7 @@ class RenderViewport extends RenderViewportBase with RenderObjectWithChildMixin< BoxConstraints _getInnerConstraints(BoxConstraints constraints) { BoxConstraints innerConstraints; - switch (scrollDirection) { + switch (mainAxis) { case Axis.horizontal: innerConstraints = constraints.heightConstraints(); break; @@ -338,12 +338,12 @@ abstract class RenderVirtualViewport _virtualChildCount; int _virtualChildCount; diff --git a/packages/flutter/lib/src/widgets/app.dart b/packages/flutter/lib/src/widgets/app.dart index 553676a3bb..cfc719c79a 100644 --- a/packages/flutter/lib/src/widgets/app.dart +++ b/packages/flutter/lib/src/widgets/app.dart @@ -36,7 +36,7 @@ typedef Widget RouteBuilder(RouteArguments args); typedef Future LocaleChangedCallback(Locale locale); -class WidgetsApp extends StatefulComponent { +class WidgetsApp extends StatefulWidget { WidgetsApp({ Key key, this.title, @@ -108,8 +108,8 @@ class WidgetsApp extends StatefulComponent { WidgetsAppState createState() => new WidgetsAppState(); } -EdgeDims _getPadding(ui.WindowPadding padding) { - return new EdgeDims.TRBL(padding.top, padding.right, padding.bottom, padding.left); +EdgeInsets _getPadding(ui.WindowPadding padding) { + return new EdgeInsets.TRBL(padding.top, padding.right, padding.bottom, padding.left); } class WidgetsAppState extends State implements BindingObserver { diff --git a/packages/flutter/lib/src/widgets/asset_vendor.dart b/packages/flutter/lib/src/widgets/asset_vendor.dart index 9ff288f0ea..00d66903af 100644 --- a/packages/flutter/lib/src/widgets/asset_vendor.dart +++ b/packages/flutter/lib/src/widgets/asset_vendor.dart @@ -191,7 +191,7 @@ class _ResolutionAwareAssetResolver extends _VariantAssetResolver { /// icons/1.5x/heart.png /// icons/2.0x/heart.png /// ``` -class AssetVendor extends StatefulComponent { +class AssetVendor extends StatefulWidget { AssetVendor({ Key key, this.bundle, diff --git a/packages/flutter/lib/src/widgets/basic.dart b/packages/flutter/lib/src/widgets/basic.dart index c127f289fb..a1fd8bac39 100644 --- a/packages/flutter/lib/src/widgets/basic.dart +++ b/packages/flutter/lib/src/widgets/basic.dart @@ -27,8 +27,8 @@ export 'package:flutter/rendering.dart' show HitTestBehavior, MaxTileWidthGridDelegate, MultiChildLayoutDelegate, - OneChildLayoutDelegate, - Painter, + SingleChildLayoutDelegate, + RenderObjectPainter, PaintingContext, PlainTextSpan, PointerCancelEvent, @@ -56,7 +56,7 @@ export 'package:flutter/rendering.dart' show /// /// This class is relatively expensive because it requires painting the child /// into an intermediate buffer. -class Opacity extends OneChildRenderObjectWidget { +class Opacity extends SingleChildRenderObjectWidget { Opacity({ Key key, this.opacity, Widget child }) : super(key: key, child: child) { assert(opacity >= 0.0 && opacity <= 1.0); @@ -80,7 +80,7 @@ class Opacity extends OneChildRenderObjectWidget { } } -class ShaderMask extends OneChildRenderObjectWidget { +class ShaderMask extends SingleChildRenderObjectWidget { ShaderMask({ Key key, this.shaderCallback, @@ -112,7 +112,7 @@ class ShaderMask extends OneChildRenderObjectWidget { /// Container insets its child by the widths of the borders, this Widget does not. /// /// Commonly used with [BoxDecoration]. -class DecoratedBox extends OneChildRenderObjectWidget { +class DecoratedBox extends SingleChildRenderObjectWidget { DecoratedBox({ Key key, this.decoration, @@ -153,7 +153,7 @@ class DecoratedBox extends OneChildRenderObjectWidget { /// /// Because custom paint calls its painters during paint, you cannot dirty /// layout or paint information during the callback. -class CustomPaint extends OneChildRenderObjectWidget { +class CustomPaint extends SingleChildRenderObjectWidget { CustomPaint({ Key key, this.painter, this.foregroundPainter, Widget child }) : super(key: key, child: child); @@ -184,7 +184,7 @@ class CustomPaint extends OneChildRenderObjectWidget { /// Clips its child using a rectangle. /// /// Prevents its child from painting outside its bounds. -class ClipRect extends OneChildRenderObjectWidget { +class ClipRect extends SingleChildRenderObjectWidget { ClipRect({ Key key, this.clipper, Widget child }) : super(key: key, child: child); /// If non-null, determines which clip to use. @@ -206,7 +206,7 @@ class ClipRect extends OneChildRenderObjectWidget { /// Creates a rounded rectangle from its layout dimensions and the given x and /// y radius values and prevents its child from painting outside that rounded /// rectangle. -class ClipRRect extends OneChildRenderObjectWidget { +class ClipRRect extends SingleChildRenderObjectWidget { ClipRRect({ Key key, this.xRadius, this.yRadius, Widget child }) : super(key: key, child: child); @@ -235,7 +235,7 @@ class ClipRRect extends OneChildRenderObjectWidget { /// /// Inscribes an oval into its layout dimensions and prevents its child from /// painting outside that oval. -class ClipOval extends OneChildRenderObjectWidget { +class ClipOval extends SingleChildRenderObjectWidget { ClipOval({ Key key, this.clipper, Widget child }) : super(key: key, child: child); /// If non-null, determines which clip to use. @@ -256,7 +256,7 @@ class ClipOval extends OneChildRenderObjectWidget { // POSITIONING AND SIZING NODES /// Applies a transformation before painting its child. -class Transform extends OneChildRenderObjectWidget { +class Transform extends SingleChildRenderObjectWidget { Transform({ Key key, this.transform, this.origin, this.alignment, this.transformHitTests: true, Widget child }) : super(key: key, child: child) { assert(transform != null); @@ -299,7 +299,7 @@ class Transform extends OneChildRenderObjectWidget { /// Applies a translation expressed as a fraction of the box's size before /// painting its child. -class FractionalTranslation extends OneChildRenderObjectWidget { +class FractionalTranslation extends SingleChildRenderObjectWidget { FractionalTranslation({ Key key, this.translation, this.transformHitTests: true, Widget child }) : super(key: key, child: child) { assert(translation != null); @@ -325,7 +325,7 @@ class FractionalTranslation extends OneChildRenderObjectWidget { /// Unlike [Transform], which applies a transform just prior to painting, /// this object applies its rotation prior to layout, which means the entire /// rotated box consumes only as much space as required by the rotated child. -class RotatedBox extends OneChildRenderObjectWidget { +class RotatedBox extends SingleChildRenderObjectWidget { RotatedBox({ Key key, this.quarterTurns, Widget child }) : super(key: key, child: child) { assert(quarterTurns != null); @@ -347,14 +347,14 @@ class RotatedBox extends OneChildRenderObjectWidget { /// constraints by the given padding, causing the child to layout at a smaller /// size. Padding then sizes itself to its child's size, inflated by the /// padding, effectively creating empty space around the child. -class Padding extends OneChildRenderObjectWidget { +class Padding extends SingleChildRenderObjectWidget { Padding({ Key key, this.padding, Widget child }) : super(key: key, child: child) { assert(padding != null); } /// The amount to pad the child in each dimension. - final EdgeDims padding; + final EdgeInsets padding; RenderPadding createRenderObject(BuildContext context) => new RenderPadding(padding: padding); @@ -373,7 +373,7 @@ class Padding extends OneChildRenderObjectWidget { /// unconstrained, then in that direction it will be sized to fit the child's /// dimensions. Using widthFactor and heightFactor you can force this latter /// behavior in all cases. -class Align extends OneChildRenderObjectWidget { +class Align extends SingleChildRenderObjectWidget { Align({ Key key, this.alignment: const FractionalOffset(0.5, 0.5), @@ -429,8 +429,8 @@ class Center extends Align { /// decide where to position the child. The delegate can also determine the size /// of the parent, but the size of the parent cannot depend on the size of the /// child. -class CustomOneChildLayout extends OneChildRenderObjectWidget { - CustomOneChildLayout({ +class CustomSingleChildLayout extends SingleChildRenderObjectWidget { + CustomSingleChildLayout({ Key key, this.delegate, Widget child @@ -438,11 +438,11 @@ class CustomOneChildLayout extends OneChildRenderObjectWidget { assert(delegate != null); } - final OneChildLayoutDelegate delegate; + final SingleChildLayoutDelegate delegate; - RenderCustomOneChildLayoutBox createRenderObject(BuildContext context) => new RenderCustomOneChildLayoutBox(delegate: delegate); + RenderCustomSingleChildLayoutBox createRenderObject(BuildContext context) => new RenderCustomSingleChildLayoutBox(delegate: delegate); - void updateRenderObject(BuildContext context, RenderCustomOneChildLayoutBox renderObject) { + void updateRenderObject(BuildContext context, RenderCustomSingleChildLayoutBox renderObject) { renderObject.delegate = delegate; } } @@ -511,7 +511,7 @@ class CustomMultiChildLayout extends MultiChildRenderObjectWidget { /// /// Forces its child to have a specific width and/or height and sizes itself to /// match the size of its child. -class SizedBox extends OneChildRenderObjectWidget { +class SizedBox extends SingleChildRenderObjectWidget { SizedBox({ Key key, this.width, this.height, Widget child }) : super(key: key, child: child); @@ -547,7 +547,7 @@ class SizedBox extends OneChildRenderObjectWidget { /// For example, if you wanted [child] to have a minimum height of 50.0 logical /// pixels, you could use `const BoxConstraints(minHeight: 50.0)`` as the /// [additionalConstraints]. -class ConstrainedBox extends OneChildRenderObjectWidget { +class ConstrainedBox extends SingleChildRenderObjectWidget { ConstrainedBox({ Key key, this.constraints, Widget child }) : super(key: key, child: child) { assert(constraints != null); @@ -571,7 +571,7 @@ class ConstrainedBox extends OneChildRenderObjectWidget { /// Sizes itself to a fraction of the total available space. /// /// See [RenderFractionallySizedBox] for details. -class FractionallySizedBox extends OneChildRenderObjectWidget { +class FractionallySizedBox extends SingleChildRenderObjectWidget { FractionallySizedBox({ Key key, this.width, this.height, Widget child }) : super(key: key, child: child); @@ -611,7 +611,7 @@ class FractionallySizedBox extends OneChildRenderObjectWidget { /// from its parent, possibly allowing the child to overflow the parent. /// /// See [RenderOverflowBox] for details. -class OverflowBox extends OneChildRenderObjectWidget { +class OverflowBox extends SingleChildRenderObjectWidget { OverflowBox({ Key key, this.minWidth, @@ -679,7 +679,7 @@ class OverflowBox extends OneChildRenderObjectWidget { } } -class SizedOverflowBox extends OneChildRenderObjectWidget { +class SizedOverflowBox extends SingleChildRenderObjectWidget { SizedOverflowBox({ Key key, this.size, Widget child }) : super(key: key, child: child); @@ -695,7 +695,7 @@ class SizedOverflowBox extends OneChildRenderObjectWidget { /// Lays the child out as if it was in the tree, but without painting anything, /// without making the child available for hit testing, and without taking any /// room in the parent. -class OffStage extends OneChildRenderObjectWidget { +class OffStage extends SingleChildRenderObjectWidget { OffStage({ Key key, Widget child }) : super(key: key, child: child); @@ -728,7 +728,7 @@ class OffStage extends OneChildRenderObjectWidget { /// find a feasible size after consulting each constraint, the widget /// will eventually select a size for the child that meets the layout /// constraints but fails to meet the aspect ratio constraints. -class AspectRatio extends OneChildRenderObjectWidget { +class AspectRatio extends SingleChildRenderObjectWidget { AspectRatio({ Key key, this.aspectRatio, Widget child }) : super(key: key, child: child) { assert(aspectRatio != null); @@ -764,7 +764,7 @@ class AspectRatio extends OneChildRenderObjectWidget { /// instead size itself to a more reasonable width. /// /// This class is relatively expensive. Avoid using it where possible. -class IntrinsicWidth extends OneChildRenderObjectWidget { +class IntrinsicWidth extends SingleChildRenderObjectWidget { IntrinsicWidth({ Key key, this.stepWidth, this.stepHeight, Widget child }) : super(key: key, child: child); @@ -790,13 +790,13 @@ class IntrinsicWidth extends OneChildRenderObjectWidget { /// instead size itself to a more reasonable height. /// /// This class is relatively expensive. Avoid using it where possible. -class IntrinsicHeight extends OneChildRenderObjectWidget { +class IntrinsicHeight extends SingleChildRenderObjectWidget { IntrinsicHeight({ Key key, Widget child }) : super(key: key, child: child); RenderIntrinsicHeight createRenderObject(BuildContext context) => new RenderIntrinsicHeight(); } /// Positions its child vertically according to the child's baseline. -class Baseline extends OneChildRenderObjectWidget { +class Baseline extends SingleChildRenderObjectWidget { Baseline({ Key key, this.baseline, this.baselineType: TextBaseline.alphabetic, Widget child }) : super(key: key, child: child) { assert(baseline != null); @@ -828,23 +828,23 @@ class Baseline extends OneChildRenderObjectWidget { /// /// Viewport is the core scrolling primitive in the system, but it can be used /// in other situations. -class Viewport extends OneChildRenderObjectWidget { +class Viewport extends SingleChildRenderObjectWidget { Viewport({ Key key, this.paintOffset: Offset.zero, - this.scrollDirection: Axis.vertical, - this.scrollAnchor: ViewportAnchor.start, + this.mainAxis: Axis.vertical, + this.anchor: ViewportAnchor.start, this.overlayPainter, this.onPaintOffsetUpdateNeeded, Widget child }) : super(key: key, child: child) { - assert(scrollDirection != null); + assert(mainAxis != null); assert(paintOffset != null); } /// The offset at which to paint the child. /// - /// The offset can be non-zero only in the [scrollDirection]. + /// The offset can be non-zero only in the [mainAxis]. final Offset paintOffset; /// The direction in which the child is permitted to be larger than the viewport @@ -852,32 +852,32 @@ class Viewport extends OneChildRenderObjectWidget { /// If the viewport is scrollable in a particular direction (e.g., vertically), /// the child is given layout constraints that are fully unconstrainted in /// that direction (e.g., the child can be as tall as it wants). - final Axis scrollDirection; + final Axis mainAxis; - final ViewportAnchor scrollAnchor; + final ViewportAnchor anchor; /// Paints an overlay over the viewport. /// /// Often used to paint scroll bars. - final Painter overlayPainter; + final RenderObjectPainter overlayPainter; final ViewportDimensionsChangeCallback onPaintOffsetUpdateNeeded; RenderViewport createRenderObject(BuildContext context) { return new RenderViewport( paintOffset: paintOffset, - scrollDirection: scrollDirection, - scrollAnchor: scrollAnchor, + mainAxis: mainAxis, + anchor: anchor, onPaintOffsetUpdateNeeded: onPaintOffsetUpdateNeeded, overlayPainter: overlayPainter ); } void updateRenderObject(BuildContext context, RenderViewport renderObject) { - // Order dependency: RenderViewport validates scrollOffset based on scrollDirection. + // Order dependency: RenderViewport validates scrollOffset based on mainAxis. renderObject - ..scrollDirection = scrollDirection - ..scrollAnchor = scrollAnchor + ..mainAxis = mainAxis + ..anchor = anchor ..paintOffset = paintOffset ..onPaintOffsetUpdateNeeded = onPaintOffsetUpdateNeeded ..overlayPainter = overlayPainter; @@ -888,7 +888,7 @@ class Viewport extends OneChildRenderObjectWidget { // CONTAINER /// A convenience widget that combines common painting, positioning, and sizing widgets. -class Container extends StatelessComponent { +class Container extends StatelessWidget { Container({ Key key, this.child, @@ -926,18 +926,18 @@ class Container extends StatelessComponent { final Decoration foregroundDecoration; /// Empty space to surround the decoration. - final EdgeDims margin; + final EdgeInsets margin; /// Empty space to inscribe inside the decoration. - final EdgeDims padding; + final EdgeInsets padding; /// The transformation matrix to apply before painting the container. final Matrix4 transform; - EdgeDims get _paddingIncludingDecoration { + EdgeInsets get _paddingIncludingDecoration { if (decoration == null || decoration.padding == null) return padding; - EdgeDims decorationPadding = decoration.padding; + EdgeInsets decorationPadding = decoration.padding; if (padding == null) return decorationPadding; return padding + decorationPadding; @@ -949,7 +949,7 @@ class Container extends StatelessComponent { if (child == null && (constraints == null || !constraints.isTight)) current = new ConstrainedBox(constraints: const BoxConstraints.expand()); - EdgeDims effectivePadding = _paddingIncludingDecoration; + EdgeInsets effectivePadding = _paddingIncludingDecoration; if (effectivePadding != null) current = new Padding(padding: effectivePadding, child: current); @@ -1006,18 +1006,18 @@ class BlockBody extends MultiChildRenderObjectWidget { BlockBody({ Key key, List children: _emptyWidgetList, - this.direction: Axis.vertical + this.mainAxis: Axis.vertical }) : super(key: key, children: children) { - assert(direction != null); + assert(mainAxis != null); } /// The direction to use as the main axis. - final Axis direction; + final Axis mainAxis; - RenderBlock createRenderObject(BuildContext context) => new RenderBlock(direction: direction); + RenderBlock createRenderObject(BuildContext context) => new RenderBlock(mainAxis: mainAxis); void updateRenderObject(BuildContext context, RenderBlock renderObject) { - renderObject.direction = direction; + renderObject.mainAxis = mainAxis; } } @@ -1090,8 +1090,8 @@ class IndexedStack extends StackRenderObjectWidgetBase { /// Controls where a child of a [Stack] is positioned. /// /// This widget must be a descendant of a [Stack], and the path from this widget -/// to its enclosing [Stack] must contain only components (e.g., not other -/// kinds of widgets, like [RenderObjectWidget]s). +/// to its enclosing [Stack] must contain only [StatelessWidget]s or +/// [StatefulWidget]s (not other kinds of widgets, like [RenderObjectWidget]s). class Positioned extends ParentDataWidget { Positioned({ Key key, @@ -1248,7 +1248,7 @@ class FixedColumnCountGrid extends GridRenderObjectWidgetBase { this.columnSpacing, this.rowSpacing, this.tileAspectRatio: 1.0, - this.padding: EdgeDims.zero + this.padding: EdgeInsets.zero }) : super(key: key, children: children) { assert(columnCount != null); } @@ -1266,7 +1266,7 @@ class FixedColumnCountGrid extends GridRenderObjectWidgetBase { final double tileAspectRatio; /// The amount of padding to apply to each child. - final EdgeDims padding; + final EdgeInsets padding; FixedColumnCountGridDelegate createDelegate() { return new FixedColumnCountGridDelegate( @@ -1290,7 +1290,7 @@ class MaxTileWidthGrid extends GridRenderObjectWidgetBase { this.columnSpacing, this.rowSpacing, this.tileAspectRatio: 1.0, - this.padding: EdgeDims.zero + this.padding: EdgeInsets.zero }) : super(key: key, children: children) { assert(maxTileWidth != null); } @@ -1308,7 +1308,7 @@ class MaxTileWidthGrid extends GridRenderObjectWidgetBase { final double rowSpacing; /// The amount of padding to apply to each child. - final EdgeDims padding; + final EdgeInsets padding; MaxTileWidthGridDelegate createDelegate() { return new MaxTileWidthGridDelegate( @@ -1426,8 +1426,8 @@ class Column extends Flex { /// /// This widget must be a descendant of a [Flex], [Row], or [Column], and the /// path from this widget to its enclosing [Flex], [Row], or [Column] must -/// contain only components (e.g., not other kinds of widgets, like -/// [RenderObjectWidget]s). +/// contain only [StatelessWidget]s or [StatefulWidget]s (not other kinds of +/// widgets, like [RenderObjectWidget]s). class Flexible extends ParentDataWidget { Flexible({ Key key, this.flex: 1, Widget child }) : super(key: key, child: child); @@ -1507,7 +1507,7 @@ class DefaultTextStyle extends InheritedWidget { /// /// By default, the text will be styled using the closest enclosing /// [DefaultTextStyle]. -class Text extends StatelessComponent { +class Text extends StatelessWidget { Text(this.data, { Key key, this.style }) : super(key: key) { assert(data != null); } @@ -1666,7 +1666,7 @@ class RawImage extends LeafRenderObjectWidget { /// This widget is rarely used directly. Instead, consider using [AssetImage] or /// [NetworkImage], depending on whather you wish to display an image from the /// assert bundle or from the network. -class RawImageResource extends StatefulComponent { +class RawImageResource extends StatefulWidget { RawImageResource({ Key key, this.image, @@ -1785,7 +1785,7 @@ class _RawImageResourceState extends State { } /// Displays an image loaded from the network. -class NetworkImage extends StatelessComponent { +class NetworkImage extends StatelessWidget { NetworkImage({ Key key, this.src, @@ -1910,7 +1910,7 @@ class DefaultAssetBundle extends InheritedWidget { /// This widget lets you customize how images are loaded by supplying your own /// image provider. Internally, [NetworkImage] uses an [ImageProvider] that /// loads the image from the network. -class AsyncImage extends StatelessComponent { +class AsyncImage extends StatelessWidget { AsyncImage({ Key key, this.provider, @@ -2000,7 +2000,7 @@ class AsyncImage extends StatelessComponent { /// /// By default, asset image will load the image from the closest enclosing /// [DefaultAssetBundle]. -class AssetImage extends StatelessComponent { +class AssetImage extends StatelessWidget { // Don't add asserts here unless absolutely necessary, since it will // require removing the const constructor, which is an API change. const AssetImage({ @@ -2133,7 +2133,7 @@ class WidgetToRenderBoxAdapter extends LeafRenderObjectWidget { // EVENT HANDLING -class Listener extends OneChildRenderObjectWidget { +class Listener extends SingleChildRenderObjectWidget { Listener({ Key key, Widget child, @@ -2206,12 +2206,12 @@ class Listener extends OneChildRenderObjectWidget { /// previously. Similarly, when the child repaints but the surround tree does /// not, we can re-record its display list without re-recording the display list /// for the surround tree. -class RepaintBoundary extends OneChildRenderObjectWidget { +class RepaintBoundary extends SingleChildRenderObjectWidget { RepaintBoundary({ Key key, Widget child }) : super(key: key, child: child); RenderRepaintBoundary createRenderObject(BuildContext context) => new RenderRepaintBoundary(); } -class IgnorePointer extends OneChildRenderObjectWidget { +class IgnorePointer extends SingleChildRenderObjectWidget { IgnorePointer({ Key key, Widget child, this.ignoring: true, this.ignoringSemantics }) : super(key: key, child: child); @@ -2237,7 +2237,7 @@ class IgnorePointer extends OneChildRenderObjectWidget { /// of the meaning of the widgets, so that accessibility tools, search /// engines, and other semantic analysis software can determine the /// meaning of the application. -class Semantics extends OneChildRenderObjectWidget { +class Semantics extends SingleChildRenderObjectWidget { Semantics({ Key key, Widget child, @@ -2293,7 +2293,7 @@ class Semantics extends OneChildRenderObjectWidget { /// Causes all the semantics of the subtree rooted at this node to be /// merged into one node in the semantics tree. For example, if you -/// have a component with a Text node next to a checkbox widget, this +/// have a widget with a Text node next to a checkbox widget, this /// could be used to merge the label from the Text node with the /// "checked" semantic state of the checkbox into a single node that /// had both the label and the checked state. Otherwise, the label @@ -2308,7 +2308,7 @@ class Semantics extends OneChildRenderObjectWidget { /// multiple nodes in the merged subtree can handle semantic gestures, /// the first one in tree order will be the one to receive the /// callbacks. -class MergeSemantics extends OneChildRenderObjectWidget { +class MergeSemantics extends SingleChildRenderObjectWidget { MergeSemantics({ Key key, Widget child }) : super(key: key, child: child); RenderMergeSemantics createRenderObject(BuildContext context) => new RenderMergeSemantics(); } @@ -2319,12 +2319,12 @@ class MergeSemantics extends OneChildRenderObjectWidget { /// reported but that would only be confusing. For example, the /// material library's [Chip] widget hides the avatar since it is /// redundant with the chip label. -class ExcludeSemantics extends OneChildRenderObjectWidget { +class ExcludeSemantics extends SingleChildRenderObjectWidget { ExcludeSemantics({ Key key, Widget child }) : super(key: key, child: child); RenderExcludeSemantics createRenderObject(BuildContext context) => new RenderExcludeSemantics(); } -class MetaData extends OneChildRenderObjectWidget { +class MetaData extends SingleChildRenderObjectWidget { MetaData({ Key key, Widget child, @@ -2353,7 +2353,7 @@ class MetaData extends OneChildRenderObjectWidget { } } -class KeyedSubtree extends StatelessComponent { +class KeyedSubtree extends StatelessWidget { KeyedSubtree({ Key key, this.child }) : super(key: key); @@ -2363,7 +2363,7 @@ class KeyedSubtree extends StatelessComponent { } /// A platonic widget that invokes a closure to obtain its child widget. -class Builder extends StatelessComponent { +class Builder extends StatelessWidget { Builder({ Key key, this.builder }) : super(key: key); /// Called to obtain the child widget. @@ -2377,7 +2377,7 @@ class Builder extends StatelessComponent { } typedef Widget StatefulWidgetBuilder(BuildContext context, StateSetter setState); -class StatefulBuilder extends StatefulComponent { +class StatefulBuilder extends StatefulWidget { StatefulBuilder({ Key key, this.builder }) : super(key: key); final StatefulWidgetBuilder builder; _StatefulBuilderState createState() => new _StatefulBuilderState(); diff --git a/packages/flutter/lib/src/widgets/checked_mode_banner.dart b/packages/flutter/lib/src/widgets/checked_mode_banner.dart index 5ec239deef..51a21b45ea 100644 --- a/packages/flutter/lib/src/widgets/checked_mode_banner.dart +++ b/packages/flutter/lib/src/widgets/checked_mode_banner.dart @@ -50,7 +50,7 @@ class _CheckedModeBannerPainter extends CustomPainter { /// Displays a banner saying "CHECKED" when running in checked mode. /// Does nothing in release mode. -class CheckedModeBanner extends StatelessComponent { +class CheckedModeBanner extends StatelessWidget { CheckedModeBanner({ Key key, this.child diff --git a/packages/flutter/lib/src/widgets/child_view.dart b/packages/flutter/lib/src/widgets/child_view.dart index af639d5a5d..a02b02b3c8 100644 --- a/packages/flutter/lib/src/widgets/child_view.dart +++ b/packages/flutter/lib/src/widgets/child_view.dart @@ -9,7 +9,7 @@ import 'framework.dart'; export 'package:flutter/rendering.dart' show ChildViewConnection; -class ChildView extends StatelessComponent { +class ChildView extends StatelessWidget { ChildView({ Key key, this.child }) : super(key: key); final ChildViewConnection child; diff --git a/packages/flutter/lib/src/widgets/dismissable.dart b/packages/flutter/lib/src/widgets/dismissable.dart index 217b2caca1..dd289948be 100644 --- a/packages/flutter/lib/src/widgets/dismissable.dart +++ b/packages/flutter/lib/src/widgets/dismissable.dart @@ -52,7 +52,7 @@ enum DismissDirection { /// The [onDimissed] callback runs after Dismissable's size has collapsed to zero. /// If the Dismissable is a list item, it must have a key that distinguishes it from /// the other items and its onDismissed callback must remove the item from the list. -class Dismissable extends StatefulComponent { +class Dismissable extends StatefulWidget { Dismissable({ Key key, this.child, diff --git a/packages/flutter/lib/src/widgets/drag_target.dart b/packages/flutter/lib/src/widgets/drag_target.dart index 738fe4b3c7..c75161d231 100644 --- a/packages/flutter/lib/src/widgets/drag_target.dart +++ b/packages/flutter/lib/src/widgets/drag_target.dart @@ -35,8 +35,8 @@ enum DragAnchor { pointer, } -/// Subclass this component to customize the gesture used to start a drag. -abstract class DraggableBase extends StatefulComponent { +/// Subclass this widget to customize the gesture used to start a drag. +abstract class DraggableBase extends StatefulWidget { DraggableBase({ Key key, this.data, @@ -261,7 +261,7 @@ class _DraggableState extends State> { } /// Receives data when a [Draggable] widget is dropped. -class DragTarget extends StatefulComponent { +class DragTarget extends StatefulWidget { const DragTarget({ Key key, this.builder, diff --git a/packages/flutter/lib/src/widgets/focus.dart b/packages/flutter/lib/src/widgets/focus.dart index 93b929fafd..767676b7f7 100644 --- a/packages/flutter/lib/src/widgets/focus.dart +++ b/packages/flutter/lib/src/widgets/focus.dart @@ -10,7 +10,7 @@ import 'media_query.dart'; import 'scrollable.dart'; // _noFocusedScope is used by Focus to track the case where none of the Focus -// component's subscopes (e.g. dialogs) are focused. This is distinct from the +// widget's subscopes (e.g. dialogs) are focused. This is distinct from the // focused scope being null, which means that we haven't yet decided which scope // is focused and whichever is the first scope to ask for focus will get it. final GlobalKey _noFocusedScope = new GlobalKey(); @@ -91,7 +91,7 @@ class _FocusScope extends InheritedWidget { /// focused at each level and it hasn't focused any of its enclosed Focus /// widgets), then the widget this this global key actually has the focus in the /// entire system. -class Focus extends StatefulComponent { +class Focus extends StatefulWidget { Focus({ GlobalKey key, this.child @@ -205,7 +205,7 @@ class _FocusState extends State { super.dispose(); } - GlobalKey _focusedWidget; // when null, the first component to ask if it's focused will get the focus + GlobalKey _focusedWidget; // when null, the first widget to ask if it's focused will get the focus GlobalKey _currentlyRegisteredWidgetRemovalListenerKey; void _setFocusedWidget(GlobalKey key) { @@ -280,7 +280,7 @@ class _FocusState extends State { } Size _mediaSize; - EdgeDims _mediaPadding; + EdgeInsets _mediaPadding; void _ensureVisibleIfFocused() { if (!Focus._atScope(context)) @@ -295,7 +295,7 @@ class _FocusState extends State { MediaQueryData data = MediaQuery.of(context); if (data != null) { Size newMediaSize = data.size; - EdgeDims newMediaPadding = data.padding; + EdgeInsets newMediaPadding = data.padding; if (newMediaSize != _mediaSize || newMediaPadding != _mediaPadding) { _mediaSize = newMediaSize; _mediaPadding = newMediaPadding; diff --git a/packages/flutter/lib/src/widgets/framework.dart b/packages/flutter/lib/src/widgets/framework.dart index 70256d77e1..2babda78ff 100644 --- a/packages/flutter/lib/src/widgets/framework.dart +++ b/packages/flutter/lib/src/widgets/framework.dart @@ -69,9 +69,9 @@ class ObjectKey extends Key { typedef void GlobalKeyRemoveListener(GlobalKey key); /// A GlobalKey is one that must be unique across the entire application. It is -/// used by components that need to communicate with other components across the +/// used by widgets that need to communicate with other widgets across the /// application's element tree. -abstract class GlobalKey> extends Key { +abstract class GlobalKey> extends Key { /// Constructs a LabeledGlobalKey, which is a GlobalKey with a label used for debugging. /// The label is not used for comparing the identity of the key. factory GlobalKey({ String debugLabel }) => new LabeledGlobalKey(debugLabel); // the label is purely for debugging purposes and is otherwise ignored @@ -119,8 +119,8 @@ abstract class GlobalKey> extends Key { Widget get currentWidget => _currentElement?.widget; T get currentState { Element element = _currentElement; - if (element is StatefulComponentElement) { - StatefulComponentElement statefulElement = element; + if (element is StatefulElement) { + StatefulElement statefulElement = element; return statefulElement.state; } return null; @@ -179,7 +179,7 @@ abstract class GlobalKey> extends Key { /// Each LabeledGlobalKey instance is a unique key. /// The optional label can be used for documentary purposes. It does not affect /// the key's identity. -class LabeledGlobalKey> extends GlobalKey { +class LabeledGlobalKey> extends GlobalKey { const LabeledGlobalKey(this._debugLabel) : super.constructor(); final String _debugLabel; String toString() => '[GlobalKey ${_debugLabel != null ? _debugLabel : hashCode}]'; @@ -241,42 +241,42 @@ abstract class Widget { } } -/// StatelessComponents describe a way to compose other Widgets to form reusable +/// StatelessWidgets describe a way to compose other Widgets to form reusable /// parts, which doesn't depend on anything other than the configuration /// information in the object itself. (For compositions that can change /// dynamically, e.g. due to having an internal clock-driven state, or depending -/// on some system state, use [StatefulComponent].) -abstract class StatelessComponent extends Widget { - const StatelessComponent({ Key key }) : super(key: key); +/// on some system state, use [StatefulWidget].) +abstract class StatelessWidget extends Widget { + const StatelessWidget({ Key key }) : super(key: key); - /// StatelessComponents always use StatelessComponentElements to represent + /// StatelessWidget always use [StatelessElement]s to represent /// themselves in the Element tree. - StatelessComponentElement createElement() => new StatelessComponentElement(this); + StatelessElement createElement() => new StatelessElement(this); - /// Returns another Widget out of which this StatelessComponent is built. + /// Returns another Widget out of which this StatelessWidget is built. /// Typically that Widget will have been configured with further children, /// such that really this function returns a tree of configuration. /// /// The given build context object contains information about the location in - /// the tree at which this component is being built. For example, the context + /// the tree at which this widget is being built. For example, the context /// provides the set of inherited widgets for this location in the tree. Widget build(BuildContext context); } -/// StatefulComponents provide the configuration for -/// [StatefulComponentElement]s, which wrap [State]s, which hold mutable state +/// StatefulWidgets provide the configuration for +/// [StatefulElement]s, which wrap [State]s, which hold mutable state /// and can dynamically and spontaneously ask to be rebuilt. -abstract class StatefulComponent extends Widget { - const StatefulComponent({ Key key }) : super(key: key); +abstract class StatefulWidget extends Widget { + const StatefulWidget({ Key key }) : super(key: key); - /// StatefulComponents always use StatefulComponentElements to represent + /// StatefulWidget always use [StatefulElement]s to represent /// themselves in the Element tree. - StatefulComponentElement createElement() => new StatefulComponentElement(this); + StatefulElement createElement() => new StatefulElement(this); - /// Returns an instance of the state to which this StatefulComponent is + /// Returns an instance of the state to which this StatefulWidget is /// related, using this object as the configuration. Subclasses should /// override this to return a new instance of the State class associated with - /// this StatefulComponent class, like this: + /// this StatefulWidget class, like this: /// /// _MyState createState() => new _MyState(); State createState(); @@ -292,10 +292,10 @@ enum _StateLifecycle { /// The signature of setState() methods. typedef void StateSetter(VoidCallback fn); -/// The logic and internal state for a [StatefulComponent]. -abstract class State { +/// The logic and internal state for a [StatefulWidget]. +abstract class State { /// The current configuration (an instance of the corresponding - /// StatefulComponent class). + /// [StatefulWidget] class). T get config => _config; T _config; @@ -307,7 +307,7 @@ abstract class State { bool _debugTypesAreRight(Widget widget) => widget is T; /// Pointer to the owner Element object - StatefulComponentElement _element; + StatefulElement _element; /// The context in which this object will be built BuildContext get context => _element; @@ -335,7 +335,7 @@ abstract class State { /// setState(() { myState = newValue }); /// /// If you just change the state directly without calling setState(), then the - /// component will not be scheduled for rebuilding, meaning that its rendering + /// widget will not be scheduled for rebuilding, meaning that its rendering /// will not be updated. void setState(VoidCallback fn) { assert(() { @@ -376,12 +376,12 @@ abstract class State { assert(() { _debugLifecycleState = _StateLifecycle.defunct; return true; }); } - /// Returns another Widget out of which this StatefulComponent is built. + /// Returns another Widget out of which this [StatefulWidget] is built. /// Typically that Widget will have been configured with further children, /// such that really this function returns a tree of configuration. /// /// The given build context object contains information about the location in - /// the tree at which this component is being built. For example, the context + /// the tree at which this widget is being built. For example, the context /// provides the set of inherited widgets for this location in the tree. Widget build(BuildContext context); @@ -410,13 +410,13 @@ abstract class State { } } -abstract class _ProxyComponent extends Widget { - const _ProxyComponent({ Key key, this.child }) : super(key: key); +abstract class _ProxyWidget extends Widget { + const _ProxyWidget({ Key key, this.child }) : super(key: key); final Widget child; } -abstract class ParentDataWidget extends _ProxyComponent { +abstract class ParentDataWidget extends _ProxyWidget { const ParentDataWidget({ Key key, Widget child }) : super(key: key, child: child); @@ -464,7 +464,7 @@ abstract class ParentDataWidget extends _ProxyComp void applyParentData(RenderObject renderObject); } -abstract class InheritedWidget extends _ProxyComponent { +abstract class InheritedWidget extends _ProxyWidget { const InheritedWidget({ Key key, Widget child }) : super(key: key, child: child); @@ -506,12 +506,12 @@ abstract class LeafRenderObjectWidget extends RenderObjectWidget { /// A superclass for RenderObjectWidgets that configure RenderObject subclasses /// that have a single child slot. (This superclass only provides the storage /// for that child, it doesn't actually provide the updating logic.) -abstract class OneChildRenderObjectWidget extends RenderObjectWidget { - const OneChildRenderObjectWidget({ Key key, this.child }) : super(key: key); +abstract class SingleChildRenderObjectWidget extends RenderObjectWidget { + const SingleChildRenderObjectWidget({ Key key, this.child }) : super(key: key); final Widget child; - OneChildRenderObjectElement createElement() => new OneChildRenderObjectElement(this); + SingleChildRenderObjectElement createElement() => new SingleChildRenderObjectElement(this); } /// A superclass for RenderObjectWidgets that configure RenderObject subclasses @@ -938,11 +938,11 @@ abstract class Element implements BuildContext { State ancestorStateOfType(TypeMatcher matcher) { Element ancestor = _parent; while (ancestor != null) { - if (ancestor is StatefulComponentElement && matcher.check(ancestor.state)) + if (ancestor is StatefulElement && matcher.check(ancestor.state)) break; ancestor = ancestor._parent; } - StatefulComponentElement statefulAncestor = ancestor; + StatefulElement statefulAncestor = ancestor; return statefulAncestor?.state; } @@ -1047,7 +1047,7 @@ abstract class BuildableElement extends Element { bool get dirty => _dirty; bool _dirty = true; - // We let component authors call setState from initState, didUpdateConfig, and + // We let widget authors call setState from initState, didUpdateConfig, and // build even when state is locked because its convenient and a no-op anyway. // This flag ensures that this convenience is only allowed on the element // currently undergoing initState, didUpdateConfig, or build. @@ -1065,9 +1065,9 @@ abstract class BuildableElement extends Element { static bool _debugBuilding = false; static BuildableElement _debugCurrentBuildTarget; - /// Establishes a scope in which component build functions can run. + /// Establishes a scope in which widget build functions can run. /// - /// Inside a build scope, component build functions are allowed to run, but + /// Inside a build scope, widget build functions are allowed to run, but /// State.setState() is forbidden. This mechanism prevents build functions /// from transitively requiring other build functions to run, potentially /// causing infinite loops. @@ -1106,8 +1106,8 @@ abstract class BuildableElement extends Element { /// rebuild in the next frame. /// /// Since it is inefficient to build an element twice in one frame, - /// applications and components should be structured so as to only mark - /// components dirty during event handlers before the frame begins, not during + /// applications and widgets should be structured so as to only mark + /// widgets dirty during event handlers before the frame begins, not during /// the build itself. void markNeedsBuild() { assert(_debugLifecycleState != _ElementLifecycle.defunct); @@ -1130,7 +1130,7 @@ abstract class BuildableElement extends Element { if (_debugStateLocked && (!_debugAllowIgnoredCallsToMarkNeedsBuild || !dirty)) { throw new WidgetError( 'setState() or markNeedsBuild() called during build.\n' - 'This component cannot be marked as needing to build because the framework ' + 'This widget cannot be marked as needing to build because the framework ' 'is already in the process of building widgets. A widget can be marked as ' 'needing to be built during the build phase only if one if its ancestors ' 'is currently building. This exception is allowed because the framework ' @@ -1149,7 +1149,7 @@ abstract class BuildableElement extends Element { } /// Called by the binding when scheduleBuild() has been called to mark this - /// element dirty, and, in Components, by update() when the Widget has + /// element dirty, and, in components, by update() when the widget has /// changed. void rebuild() { assert(_debugLifecycleState != _ElementLifecycle.initial); @@ -1195,8 +1195,8 @@ abstract class BuildableElement extends Element { typedef Widget WidgetBuilder(BuildContext context); -/// Base class for the instantiation of StatelessComponent, StatefulComponent, -/// and ProxyComponent widgets. +/// Base class for the instantiation of [StatelessWidget], [StatefulWidget], +/// and [_ProxyWidget] widgets. abstract class ComponentElement extends BuildableElement { ComponentElement(Widget widget) : super(widget); @@ -1215,8 +1215,8 @@ abstract class ComponentElement extends BuildableElement { rebuild(); } - /// Reinvokes the build() method of the StatelessComponent object (for - /// stateless components) or the State object (for stateful components) and + /// Reinvokes the build() method of the [StatelessWidget] object (for + /// stateless widgets) or the [State] object (for stateful widgets) and /// then updates the widget tree. /// /// Called automatically during mount() to generate the first build, and by @@ -1270,15 +1270,15 @@ abstract class ComponentElement extends BuildableElement { } } -/// Instantiation of StatelessComponent widgets. -class StatelessComponentElement extends ComponentElement { - StatelessComponentElement(StatelessComponent widget) : super(widget) { +/// Instantiation of [StatelessWidget]s. +class StatelessElement extends ComponentElement { + StatelessElement(StatelessWidget widget) : super(widget) { _builder = widget.build; } - StatelessComponent get widget => super.widget; + StatelessWidget get widget => super.widget; - void update(StatelessComponent newWidget) { + void update(StatelessWidget newWidget) { super.update(newWidget); assert(widget == newWidget); _builder = widget.build; @@ -1287,9 +1287,9 @@ class StatelessComponentElement extends ComponentElement { } } -/// Instantiation of StatefulComponent widgets. -class StatefulComponentElement extends ComponentElement { - StatefulComponentElement(StatefulComponent widget) +/// Instantiation of [StatefulWidget]s. +class StatefulElement extends ComponentElement { + StatefulElement(StatefulWidget widget) : _state = widget.createState(), super(widget) { assert(_state._debugTypesAreRight(widget)); assert(_state._element == null); @@ -1301,8 +1301,8 @@ class StatefulComponentElement extends ComponentElement { assert(_state._debugLifecycleState == _StateLifecycle.created); } - State get state => _state; - State _state; + State get state => _state; + State _state; void _firstBuild() { assert(_state._debugLifecycleState == _StateLifecycle.created); @@ -1325,10 +1325,10 @@ class StatefulComponentElement extends ComponentElement { super._firstBuild(); } - void update(StatefulComponent newWidget) { + void update(StatefulWidget newWidget) { super.update(newWidget); assert(widget == newWidget); - StatefulComponent oldConfig = _state._config; + StatefulWidget oldConfig = _state._config; // Notice that we mark ourselves as dirty before calling didUpdateConfig to // let authors call setState from within didUpdateConfig without triggering // asserts. @@ -1378,16 +1378,16 @@ class StatefulComponentElement extends ComponentElement { } abstract class _ProxyElement extends ComponentElement { - _ProxyElement(_ProxyComponent widget) : super(widget) { + _ProxyElement(_ProxyWidget widget) : super(widget) { _builder = _build; } - _ProxyComponent get widget => super.widget; + _ProxyWidget get widget => super.widget; Widget _build(BuildContext context) => widget.child; - void update(_ProxyComponent newWidget) { - _ProxyComponent oldWidget = widget; + void update(_ProxyWidget newWidget) { + _ProxyWidget oldWidget = widget; assert(widget != null); assert(widget != newWidget); super.update(newWidget); @@ -1397,7 +1397,7 @@ abstract class _ProxyElement extends ComponentElement { rebuild(); } - void notifyDescendants(_ProxyComponent oldWidget); + void notifyDescendants(_ProxyWidget oldWidget); } class ParentDataElement extends _ProxyElement { @@ -1772,10 +1772,10 @@ class LeafRenderObjectElement extends RenderObjectElement { } /// Instantiation of RenderObjectWidgets that have up to one child -class OneChildRenderObjectElement extends RenderObjectElement { - OneChildRenderObjectElement(OneChildRenderObjectWidget widget) : super(widget); +class SingleChildRenderObjectElement extends RenderObjectElement { + SingleChildRenderObjectElement(SingleChildRenderObjectWidget widget) : super(widget); - OneChildRenderObjectWidget get widget => super.widget; + SingleChildRenderObjectWidget get widget => super.widget; Element _child; @@ -1796,7 +1796,7 @@ class OneChildRenderObjectElement extends RenderObjectElement { _child = updateChild(_child, widget.child, null); } - void update(OneChildRenderObjectWidget newWidget) { + void update(SingleChildRenderObjectWidget newWidget) { super.update(newWidget); assert(widget == newWidget); _child = updateChild(_child, widget.child, null); diff --git a/packages/flutter/lib/src/widgets/gesture_detector.dart b/packages/flutter/lib/src/widgets/gesture_detector.dart index 7f035d7905..71a4998330 100644 --- a/packages/flutter/lib/src/widgets/gesture_detector.dart +++ b/packages/flutter/lib/src/widgets/gesture_detector.dart @@ -39,7 +39,7 @@ typedef GestureRecognizer GestureRecognizerFactory(GestureRecognizer recognizer) /// [excludeFromSemantics] to true. /// /// See http://flutter.io/gestures/ for additional information. -class GestureDetector extends StatelessComponent { +class GestureDetector extends StatelessWidget { GestureDetector({ Key key, this.child, @@ -235,7 +235,7 @@ class GestureDetector extends StatelessComponent { /// For common gestures, use a [GestureRecognizer]. /// RawGestureDetector is useful primarily when developing your /// own gesture recognizers. -class RawGestureDetector extends StatefulComponent { +class RawGestureDetector extends StatefulWidget { RawGestureDetector({ Key key, this.child, @@ -375,7 +375,7 @@ class RawGestureDetectorState extends State { } } -class _GestureSemantics extends OneChildRenderObjectWidget { +class _GestureSemantics extends SingleChildRenderObjectWidget { _GestureSemantics({ Key key, Widget child, diff --git a/packages/flutter/lib/src/widgets/gridpaper.dart b/packages/flutter/lib/src/widgets/gridpaper.dart index eea8af196b..39138b44f6 100644 --- a/packages/flutter/lib/src/widgets/gridpaper.dart +++ b/packages/flutter/lib/src/widgets/gridpaper.dart @@ -46,7 +46,7 @@ class _GridPaperPainter extends CustomPainter { /// Draws a rectalinear grid of 1px width lines at the specified color and interval. /// Useful with a Stack for visualizing your layout along a grid. -class GridPaper extends StatelessComponent { +class GridPaper extends StatelessWidget { GridPaper({ Key key, this.color: const Color(0x7FC3E8F3), diff --git a/packages/flutter/lib/src/widgets/heroes.dart b/packages/flutter/lib/src/widgets/heroes.dart index 1f06e9897f..f80e087db6 100644 --- a/packages/flutter/lib/src/widgets/heroes.dart +++ b/packages/flutter/lib/src/widgets/heroes.dart @@ -14,7 +14,7 @@ import 'pages.dart'; import 'transitions.dart'; // Heroes are the parts of an application's screen-to-screen transitions where a -// component from one screen shifts to a position on the other. For example, +// widget from one screen shifts to a position on the other. For example, // album art from a list of albums growing to become the centerpiece of the // album's details view. In this context, a screen is a navigator ModalRoute. @@ -76,7 +76,7 @@ abstract class HeroHandle { _HeroManifest _takeChild(Rect animationArea, Animation currentAnimation); } -class Hero extends StatefulComponent { +class Hero extends StatefulWidget { Hero({ Key key, this.tag, @@ -104,7 +104,7 @@ class Hero extends StatefulComponent { Map> heroes = >{}; void visitor(Element element) { if (element.widget is Hero) { - StatefulComponentElement hero = element; + StatefulElement hero = element; Hero heroWidget = element.widget; Object tag = heroWidget.tag; assert(tag != null); diff --git a/packages/flutter/lib/src/widgets/implicit_animations.dart b/packages/flutter/lib/src/widgets/implicit_animations.dart index dca532d40a..7508246eb8 100644 --- a/packages/flutter/lib/src/widgets/implicit_animations.dart +++ b/packages/flutter/lib/src/widgets/implicit_animations.dart @@ -27,11 +27,11 @@ class DecorationTween extends Tween { } } -/// An interpolation between two [EdgeDims]s. -class EdgeDimsTween extends Tween { - EdgeDimsTween({ EdgeDims begin, EdgeDims end }) : super(begin: begin, end: end); +/// An interpolation between two [EdgeInsets]s. +class EdgeInsetsTween extends Tween { + EdgeInsetsTween({ EdgeInsets begin, EdgeInsets end }) : super(begin: begin, end: end); - EdgeDims lerp(double t) => EdgeDims.lerp(begin, end, t); + EdgeInsets lerp(double t) => EdgeInsets.lerp(begin, end, t); } /// An interpolation between two [Matrix4]s. @@ -50,9 +50,9 @@ class Matrix4Tween extends Tween { } } -/// An abstract widget for building components that gradually change their +/// An abstract widget for building widgets that gradually change their /// values over a period of time. -abstract class AnimatedWidgetBase extends StatefulComponent { +abstract class AnimatedWidgetBase extends StatefulWidget { AnimatedWidgetBase({ Key key, this.curve: Curves.linear, @@ -215,10 +215,10 @@ class AnimatedContainer extends AnimatedWidgetBase { final Decoration foregroundDecoration; /// Empty space to surround the decoration. - final EdgeDims margin; + final EdgeInsets margin; /// Empty space to inscribe inside the decoration. - final EdgeDims padding; + final EdgeInsets padding; /// The transformation matrix to apply before painting the container. final Matrix4 transform; @@ -256,8 +256,8 @@ class _AnimatedContainerState extends AnimatedWidgetBaseState BoxConstraintsTween _constraints; DecorationTween _decoration; DecorationTween _foregroundDecoration; - EdgeDimsTween _margin; - EdgeDimsTween _padding; + EdgeInsetsTween _margin; + EdgeInsetsTween _padding; Matrix4Tween _transform; Tween _width; Tween _height; @@ -267,8 +267,8 @@ class _AnimatedContainerState extends AnimatedWidgetBaseState _constraints = visitor(_constraints, config.constraints, (dynamic value) => new BoxConstraintsTween(begin: value)); _decoration = visitor(_decoration, config.decoration, (dynamic value) => new DecorationTween(begin: value)); _foregroundDecoration = visitor(_foregroundDecoration, config.foregroundDecoration, (dynamic value) => new DecorationTween(begin: value)); - _margin = visitor(_margin, config.margin, (dynamic value) => new EdgeDimsTween(begin: value)); - _padding = visitor(_padding, config.padding, (dynamic value) => new EdgeDimsTween(begin: value)); + _margin = visitor(_margin, config.margin, (dynamic value) => new EdgeInsetsTween(begin: value)); + _padding = visitor(_padding, config.padding, (dynamic value) => new EdgeInsetsTween(begin: value)); _transform = visitor(_transform, config.transform, (dynamic value) => new Matrix4Tween(begin: value)); _width = visitor(_width, config.width, (dynamic value) => new Tween(begin: value)); _height = visitor(_height, config.height, (dynamic value) => new Tween(begin: value)); diff --git a/packages/flutter/lib/src/widgets/media_query.dart b/packages/flutter/lib/src/widgets/media_query.dart index 8b97943b4d..39531d6dc8 100644 --- a/packages/flutter/lib/src/widgets/media_query.dart +++ b/packages/flutter/lib/src/widgets/media_query.dart @@ -27,7 +27,7 @@ class MediaQueryData { final double devicePixelRatio; /// The padding around the edges of the media (e.g., the screen). - final EdgeDims padding; + final EdgeInsets padding; /// The orientation of the media (e.g., whether the device is in landscape or portrait mode). Orientation get orientation { diff --git a/packages/flutter/lib/src/widgets/mimic.dart b/packages/flutter/lib/src/widgets/mimic.dart index 5c00f139d8..7faae046e5 100644 --- a/packages/flutter/lib/src/widgets/mimic.dart +++ b/packages/flutter/lib/src/widgets/mimic.dart @@ -123,7 +123,7 @@ class MimicOverlayEntry { } /// A widget that copies the appearance of another widget. -class Mimic extends StatelessComponent { +class Mimic extends StatelessWidget { Mimic({ Key key, this.original }) : super(key: key); /// A handle to the widget that this widget should copy. @@ -140,7 +140,7 @@ class Mimic extends StatelessComponent { /// /// This widget's State, [MimicableState], contains an API for initiating the /// mimic operation. -class Mimicable extends StatefulComponent { +class Mimicable extends StatefulWidget { Mimicable({ Key key, this.child }) : super(key: key); final Widget child; diff --git a/packages/flutter/lib/src/widgets/mixed_viewport.dart b/packages/flutter/lib/src/widgets/mixed_viewport.dart index 9ae013f964..8df1ba343d 100644 --- a/packages/flutter/lib/src/widgets/mixed_viewport.dart +++ b/packages/flutter/lib/src/widgets/mixed_viewport.dart @@ -144,7 +144,7 @@ class _MixedViewportElement extends RenderObjectElement { void mount(Element parent, dynamic newSlot) { super.mount(parent, newSlot); renderObject - ..direction = widget.direction + ..mainAxis = widget.direction ..callback = layout ..postLayoutCallback = postLayout ..totalExtentCallback = _noIntrinsicExtent @@ -181,7 +181,7 @@ class _MixedViewportElement extends RenderObjectElement { void update(MixedViewport newWidget) { _ChangeDescription changes = newWidget.evaluateChangesFrom(widget); super.update(newWidget); - renderObject.direction = widget.direction; + renderObject.mainAxis = widget.direction; _overrideStartOffset = null; if (changes == _ChangeDescription.resized) _resetCache(); @@ -190,8 +190,8 @@ class _MixedViewportElement extends RenderObjectElement { renderObject.markNeedsLayout(); } else { // We have to reinvoke our builders because they might return new data. - // Consider a stateful component that owns us. The builder it gives us - // includes some of the state from that component. The component calls + // Consider a stateful widget that owns us. The builder it gives us + // includes some of the state from that widget. The widget calls // setState() on itself. It rebuilds. Part of that involves rebuilding // us, but now what? If we don't reinvoke the builders. then they will // not be rebuilt, and so the new state won't be used. Therefore, we use diff --git a/packages/flutter/lib/src/widgets/modal_barrier.dart b/packages/flutter/lib/src/widgets/modal_barrier.dart index 942432d6b9..38e0699c8b 100644 --- a/packages/flutter/lib/src/widgets/modal_barrier.dart +++ b/packages/flutter/lib/src/widgets/modal_barrier.dart @@ -9,7 +9,7 @@ import 'navigator.dart'; import 'transitions.dart'; /// Prevents the user from interacting with widgets behind itself. -class ModalBarrier extends StatelessComponent { +class ModalBarrier extends StatelessWidget { ModalBarrier({ Key key, this.color, @@ -45,7 +45,7 @@ class ModalBarrier extends StatelessComponent { } /// Prevents the user from interacting with widgets behind itself. -class AnimatedModalBarrier extends AnimatedComponent { +class AnimatedModalBarrier extends AnimatedWidget { AnimatedModalBarrier({ Key key, Animation color, diff --git a/packages/flutter/lib/src/widgets/navigator.dart b/packages/flutter/lib/src/widgets/navigator.dart index ea06393c4e..cf5eb51119 100644 --- a/packages/flutter/lib/src/widgets/navigator.dart +++ b/packages/flutter/lib/src/widgets/navigator.dart @@ -135,7 +135,7 @@ class NavigatorObserver { /// the navigator visually transition from one page to another by the widgets /// around in the overlay. Similarly, the navigator can be used to show a dialog /// by positioning the dialog widget above the current page. -class Navigator extends StatefulComponent { +class Navigator extends StatefulWidget { Navigator({ Key key, this.initialRoute, diff --git a/packages/flutter/lib/src/widgets/notification_listener.dart b/packages/flutter/lib/src/widgets/notification_listener.dart index 9f2a83fc9c..c35d0d1823 100644 --- a/packages/flutter/lib/src/widgets/notification_listener.dart +++ b/packages/flutter/lib/src/widgets/notification_listener.dart @@ -12,7 +12,7 @@ abstract class Notification { /// Start bubbling this notification at the given build context. void dispatch(BuildContext target) { target.visitAncestorElements((Element element) { - if (element is StatelessComponentElement && + if (element is StatelessElement && element.widget is NotificationListener) { final NotificationListener widget = element.widget; if (widget._dispatch(this)) // that function checks the type dynamically @@ -24,7 +24,7 @@ abstract class Notification { } /// Listens for [Notification]s bubbling up the tree. -class NotificationListener extends StatelessComponent { +class NotificationListener extends StatelessWidget { NotificationListener({ Key key, this.child, diff --git a/packages/flutter/lib/src/widgets/overlay.dart b/packages/flutter/lib/src/widgets/overlay.dart index 6b9bad218c..d7bf3e8d0a 100644 --- a/packages/flutter/lib/src/widgets/overlay.dart +++ b/packages/flutter/lib/src/widgets/overlay.dart @@ -49,7 +49,7 @@ class OverlayEntry { String toString() => '$runtimeType@$hashCode(opaque: $opaque)'; } -class _OverlayEntry extends StatefulComponent { +class _OverlayEntry extends StatefulWidget { _OverlayEntry(OverlayEntry entry) : entry = entry, super(key: entry._key); final OverlayEntry entry; _OverlayEntryState createState() => new _OverlayEntryState(); @@ -59,7 +59,7 @@ class _OverlayEntryState extends State<_OverlayEntry> { } /// A [Stack] of entries that can be managed independently. -class Overlay extends StatefulComponent { +class Overlay extends StatefulWidget { Overlay({ Key key, this.initialEntries: const [] diff --git a/packages/flutter/lib/src/widgets/page_storage.dart b/packages/flutter/lib/src/widgets/page_storage.dart index b1587f2ec0..6a2233b23f 100644 --- a/packages/flutter/lib/src/widgets/page_storage.dart +++ b/packages/flutter/lib/src/widgets/page_storage.dart @@ -82,7 +82,7 @@ class PageStorageBucket { } /// Establishes a page storage bucket for this widget subtree. -class PageStorage extends StatelessComponent { +class PageStorage extends StatelessWidget { PageStorage({ Key key, this.child, diff --git a/packages/flutter/lib/src/widgets/pageable_list.dart b/packages/flutter/lib/src/widgets/pageable_list.dart index a740e808a6..b325a535d6 100644 --- a/packages/flutter/lib/src/widgets/pageable_list.dart +++ b/packages/flutter/lib/src/widgets/pageable_list.dart @@ -165,8 +165,8 @@ class PageableListState extends ScrollableState { Widget buildContent(BuildContext context) { return new PageViewport( itemsWrap: config.itemsWrap, - scrollDirection: config.scrollDirection, - scrollAnchor: config.scrollAnchor, + mainAxis: config.scrollDirection, + anchor: config.scrollAnchor, startOffset: scrollOffset, overlayPainter: config.scrollableListPainter, children: config.children @@ -226,20 +226,20 @@ class PageableListState extends ScrollableState { class PageViewport extends VirtualViewportFromIterable { PageViewport({ this.startOffset: 0.0, - this.scrollDirection: Axis.vertical, - this.scrollAnchor: ViewportAnchor.start, + this.mainAxis: Axis.vertical, + this.anchor: ViewportAnchor.start, this.itemsWrap: false, this.overlayPainter, this.children }) { - assert(scrollDirection != null); + assert(mainAxis != null); } final double startOffset; - final Axis scrollDirection; - final ViewportAnchor scrollAnchor; + final Axis mainAxis; + final ViewportAnchor anchor; final bool itemsWrap; - final Painter overlayPainter; + final RenderObjectPainter overlayPainter; final Iterable children; RenderList createRenderObject(BuildContext context) => new RenderList(); @@ -274,7 +274,7 @@ class _PageViewportElement extends VirtualViewportElement { void updateRenderObject(PageViewport oldWidget) { renderObject - ..scrollDirection = widget.scrollDirection + ..mainAxis = widget.mainAxis ..overlayPainter = widget.overlayPainter; super.updateRenderObject(oldWidget); } @@ -285,7 +285,7 @@ class _PageViewportElement extends VirtualViewportElement { final Size containerSize = renderObject.size; Size materializedContentSize; - switch (widget.scrollDirection) { + switch (widget.mainAxis) { case Axis.vertical: materializedContentSize = new Size(containerSize.width, _materializedChildCount * containerSize.height); break; @@ -299,7 +299,7 @@ class _PageViewportElement extends VirtualViewportElement { void layout(BoxConstraints constraints) { final int length = renderObject.virtualChildCount; - switch (widget.scrollDirection) { + switch (widget.mainAxis) { case Axis.vertical: _containerExtent = renderObject.size.height; break; @@ -326,7 +326,7 @@ class _PageViewportElement extends VirtualViewportElement { _materializedChildCount = limitItem - startItem; _startOffsetBase = startItem.toDouble(); _startOffsetLimit = (limitItem - 1).toDouble(); - if (widget.scrollAnchor == ViewportAnchor.end) + if (widget.anchor == ViewportAnchor.end) _materializedChildBase = (length - _materializedChildBase - _materializedChildCount) % length; } diff --git a/packages/flutter/lib/src/widgets/placeholder.dart b/packages/flutter/lib/src/widgets/placeholder.dart index f9ca3104bd..aaccb3b354 100644 --- a/packages/flutter/lib/src/widgets/placeholder.dart +++ b/packages/flutter/lib/src/widgets/placeholder.dart @@ -6,7 +6,7 @@ import 'basic.dart'; import 'framework.dart'; /// A widget whose child can be mutated. -class Placeholder extends StatefulComponent { +class Placeholder extends StatefulWidget { Placeholder({ Key key }) : super(key: key); PlaceholderState createState() => new PlaceholderState(); diff --git a/packages/flutter/lib/src/widgets/raw_keyboard_listener.dart b/packages/flutter/lib/src/widgets/raw_keyboard_listener.dart index 59344afbea..3e3088f18e 100644 --- a/packages/flutter/lib/src/widgets/raw_keyboard_listener.dart +++ b/packages/flutter/lib/src/widgets/raw_keyboard_listener.dart @@ -9,7 +9,7 @@ import 'package:sky_services/sky/input_event.mojom.dart' as mojom; import 'basic.dart'; import 'framework.dart'; -class RawKeyboardListener extends StatefulComponent { +class RawKeyboardListener extends StatefulWidget { RawKeyboardListener({ Key key, this.focused: false, diff --git a/packages/flutter/lib/src/widgets/routes.dart b/packages/flutter/lib/src/widgets/routes.dart index 4e4a8ac237..0da4a7a83d 100644 --- a/packages/flutter/lib/src/widgets/routes.dart +++ b/packages/flutter/lib/src/widgets/routes.dart @@ -336,7 +336,7 @@ class _ModalScopeStatus extends InheritedWidget { } } -class _ModalScope extends StatefulComponent { +class _ModalScope extends StatefulWidget { _ModalScope({ Key key, this.route diff --git a/packages/flutter/lib/src/widgets/scroll_behavior.dart b/packages/flutter/lib/src/widgets/scroll_behavior.dart index 1d108a2e55..01228d2931 100644 --- a/packages/flutter/lib/src/widgets/scroll_behavior.dart +++ b/packages/flutter/lib/src/widgets/scroll_behavior.dart @@ -19,7 +19,7 @@ abstract class ScrollBehavior { /// This function is called when a drag gesture ends. /// /// Returns null if the behavior is to do nothing. - Simulation createFlingScrollSimulation(T position, U velocity) => null; + Simulation createScrollSimulation(T position, U velocity) => null; /// Returns an animation that ends at the snap offset. /// @@ -129,7 +129,7 @@ class BoundedBehavior extends ExtentScrollBehavior { } } -Simulation _createFlingScrollSimulation(double position, double velocity, double minScrollOffset, double maxScrollOffset) { +Simulation _createScrollSimulation(double position, double velocity, double minScrollOffset, double maxScrollOffset) { final double startVelocity = velocity * _kSecondsPerMillisecond; final SpringDescription spring = new SpringDescription.withDampingRatio(mass: 1.0, springConstant: 170.0, ratio: 1.1); return new ScrollSimulation(position, startVelocity, minScrollOffset, maxScrollOffset, spring, _kScrollDrag); @@ -145,7 +145,7 @@ class UnboundedBehavior extends ExtentScrollBehavior { UnboundedBehavior({ double contentExtent: 0.0, double containerExtent: 0.0 }) : super(contentExtent: contentExtent, containerExtent: containerExtent); - Simulation createFlingScrollSimulation(double position, double velocity) { + Simulation createScrollSimulation(double position, double velocity) { double velocityPerSecond = velocity * 1000.0; return new BoundedFrictionSimulation( _kScrollDrag, position, velocityPerSecond, double.NEGATIVE_INFINITY, double.INFINITY @@ -169,8 +169,8 @@ class OverscrollBehavior extends BoundedBehavior { OverscrollBehavior({ double contentExtent: 0.0, double containerExtent: 0.0, double minScrollOffset: 0.0 }) : super(contentExtent: contentExtent, containerExtent: containerExtent, minScrollOffset: minScrollOffset); - Simulation createFlingScrollSimulation(double position, double velocity) { - return _createFlingScrollSimulation(position, velocity, minScrollOffset, maxScrollOffset); + Simulation createScrollSimulation(double position, double velocity) { + return _createScrollSimulation(position, velocity, minScrollOffset, maxScrollOffset); } Simulation createSnapScrollSimulation(double startOffset, double endOffset, double startVelocity, double endVelocity) { @@ -201,9 +201,9 @@ class OverscrollWhenScrollableBehavior extends OverscrollBehavior { bool get isScrollable => contentExtent > containerExtent; - Simulation createFlingScrollSimulation(double position, double velocity) { + Simulation createScrollSimulation(double position, double velocity) { if (isScrollable || position < minScrollOffset || position > maxScrollOffset) - return super.createFlingScrollSimulation(position, velocity); + return super.createScrollSimulation(position, velocity); return null; } diff --git a/packages/flutter/lib/src/widgets/scrollable.dart b/packages/flutter/lib/src/widgets/scrollable.dart index bb52511d05..b1792259a7 100644 --- a/packages/flutter/lib/src/widgets/scrollable.dart +++ b/packages/flutter/lib/src/widgets/scrollable.dart @@ -8,7 +8,7 @@ import 'dart:ui' as ui show window; import 'package:newton/newton.dart'; import 'package:flutter/gestures.dart'; -import 'package:flutter/rendering.dart' show HasScrollDirection; +import 'package:flutter/rendering.dart' show HasMainAxis; import 'basic.dart'; import 'framework.dart'; @@ -34,7 +34,7 @@ typedef double SnapOffsetCallback(double scrollOffset, Size containerSize); /// /// Widgets that subclass [Scrollable] typically use state objects that subclass /// [ScrollableState]. -abstract class Scrollable extends StatefulComponent { +abstract class Scrollable extends StatefulWidget { Scrollable({ Key key, this.initialScrollOffset, @@ -439,7 +439,7 @@ abstract class ScrollableState extends State { } Simulation _createFlingSimulation(double scrollVelocity) { - final Simulation simulation = scrollBehavior.createFlingScrollSimulation(scrollOffset, scrollVelocity); + final Simulation simulation = scrollBehavior.createScrollSimulation(scrollOffset, scrollVelocity); if (simulation != null) { final double endVelocity = pixelOffsetToScrollOffset(kPixelScrollTolerance.velocity).abs() * (scrollVelocity < 0.0 ? -1.0 : 1.0); final double endDistance = pixelOffsetToScrollOffset(kPixelScrollTolerance.distance).abs(); @@ -604,7 +604,7 @@ class ScrollNotification extends Notification { final double scrollOffset; } -/// A simple scrollable widget that has a single child. Use this component if +/// A simple scrollable widget that has a single child. Use this widget if /// you are not worried about offscreen widgets consuming resources. class ScrollableViewport extends Scrollable { ScrollableViewport({ @@ -657,8 +657,8 @@ class _ScrollableViewportState extends ScrollableState { Widget buildContent(BuildContext context) { return new Viewport( paintOffset: scrollOffsetToPixelDelta(scrollOffset), - scrollDirection: config.scrollDirection, - scrollAnchor: config.scrollAnchor, + mainAxis: config.scrollDirection, + anchor: config.scrollAnchor, onPaintOffsetUpdateNeeded: _handlePaintOffsetUpdateNeeded, child: config.child ); @@ -668,7 +668,7 @@ class _ScrollableViewportState extends ScrollableState { /// A mashup of [ScrollableViewport] and [BlockBody]. Useful when you have a small, /// fixed number of children that you wish to arrange in a block layout and that /// might exceed the height of its container (and therefore need to scroll). -class Block extends StatelessComponent { +class Block extends StatelessWidget { Block({ Key key, this.children: const [], @@ -684,7 +684,7 @@ class Block extends StatelessComponent { } final List children; - final EdgeDims padding; + final EdgeInsets padding; final double initialScrollOffset; final Axis scrollDirection; final ViewportAnchor scrollAnchor; @@ -692,7 +692,7 @@ class Block extends StatelessComponent { final Key scrollableKey; Widget build(BuildContext context) { - Widget contents = new BlockBody(children: children, direction: scrollDirection); + Widget contents = new BlockBody(children: children, mainAxis: scrollDirection); if (padding != null) contents = new Padding(padding: padding, child: contents); return new ScrollableViewport( @@ -706,18 +706,18 @@ class Block extends StatelessComponent { } } -abstract class ScrollableListPainter extends Painter { +abstract class ScrollableListPainter extends RenderObjectPainter { void attach(RenderObject renderObject) { assert(renderObject is RenderBox); - assert(renderObject is HasScrollDirection); + assert(renderObject is HasMainAxis); super.attach(renderObject); } RenderBox get renderObject => super.renderObject; Axis get scrollDirection { - HasScrollDirection scrollable = renderObject as dynamic; - return scrollable?.scrollDirection; + HasMainAxis scrollable = renderObject as dynamic; + return scrollable?.mainAxis; } Size get viewportSize => renderObject.size; diff --git a/packages/flutter/lib/src/widgets/scrollable_grid.dart b/packages/flutter/lib/src/widgets/scrollable_grid.dart index 5b12a9d98e..5999cad2a8 100644 --- a/packages/flutter/lib/src/widgets/scrollable_grid.dart +++ b/packages/flutter/lib/src/widgets/scrollable_grid.dart @@ -77,8 +77,8 @@ class GridViewport extends VirtualViewportFromIterable { final ExtentsChangedCallback onExtentsChanged; final Iterable children; - // TODO(abarth): Support horizontal scrolling; - Axis get scrollDirection => Axis.vertical; + // TODO(abarth): Support horizontal grids. + Axis get mainAxis => Axis.vertical; RenderGrid createRenderObject(BuildContext context) => new RenderGrid(delegate: delegate); diff --git a/packages/flutter/lib/src/widgets/scrollable_list.dart b/packages/flutter/lib/src/widgets/scrollable_list.dart index 6e73eb66b1..5641b1eb42 100644 --- a/packages/flutter/lib/src/widgets/scrollable_list.dart +++ b/packages/flutter/lib/src/widgets/scrollable_list.dart @@ -37,7 +37,7 @@ class ScrollableList extends Scrollable { final double itemExtent; final bool itemsWrap; - final EdgeDims padding; + final EdgeInsets padding; final ScrollableListPainter scrollableListPainter; final Iterable children; @@ -78,8 +78,8 @@ class _ScrollableListState extends ScrollableState { return new ListViewport( onExtentsChanged: _handleExtentsChanged, scrollOffset: scrollOffset, - scrollDirection: config.scrollDirection, - scrollAnchor: config.scrollAnchor, + mainAxis: config.scrollDirection, + anchor: config.scrollAnchor, itemExtent: config.itemExtent, itemsWrap: config.itemsWrap, padding: config.padding, @@ -93,30 +93,30 @@ class _VirtualListViewport extends VirtualViewport { _VirtualListViewport( this.onExtentsChanged, this.scrollOffset, - this.scrollDirection, - this.scrollAnchor, + this.mainAxis, + this.anchor, this.itemExtent, this.itemsWrap, this.padding, this.overlayPainter ) { - assert(scrollDirection != null); + assert(mainAxis != null); assert(itemExtent != null); } final ExtentsChangedCallback onExtentsChanged; final double scrollOffset; - final Axis scrollDirection; - final ViewportAnchor scrollAnchor; + final Axis mainAxis; + final ViewportAnchor anchor; final double itemExtent; final bool itemsWrap; - final EdgeDims padding; - final Painter overlayPainter; + final EdgeInsets padding; + final RenderObjectPainter overlayPainter; double get _leadingPadding { - switch (scrollDirection) { + switch (mainAxis) { case Axis.vertical: - switch (scrollAnchor) { + switch (anchor) { case ViewportAnchor.start: return padding.top; case ViewportAnchor.end: @@ -124,7 +124,7 @@ class _VirtualListViewport extends VirtualViewport { } break; case Axis.horizontal: - switch (scrollAnchor) { + switch (anchor) { case ViewportAnchor.start: return padding.left; case ViewportAnchor.end: @@ -166,8 +166,8 @@ class _VirtualListViewportElement extends VirtualViewportElement { void updateRenderObject(_VirtualListViewport oldWidget) { renderObject - ..scrollDirection = widget.scrollDirection - ..scrollAnchor = widget.scrollAnchor + ..mainAxis = widget.mainAxis + ..anchor = widget.anchor ..itemExtent = widget.itemExtent ..padding = widget.padding ..overlayPainter = widget.overlayPainter; @@ -180,13 +180,13 @@ class _VirtualListViewportElement extends VirtualViewportElement { void layout(BoxConstraints constraints) { final int length = renderObject.virtualChildCount; final double itemExtent = widget.itemExtent; - final EdgeDims padding = widget.padding ?? EdgeDims.zero; + final EdgeInsets padding = widget.padding ?? EdgeInsets.zero; final Size containerSize = renderObject.size; double containerExtent; double contentExtent; - switch (widget.scrollDirection) { + switch (widget.mainAxis) { case Axis.vertical: containerExtent = containerSize.height; contentExtent = length == null ? double.INFINITY : widget.itemExtent * length + padding.vertical; @@ -217,12 +217,12 @@ class _VirtualListViewportElement extends VirtualViewportElement { _startOffsetBase = startItem * itemExtent; _startOffsetLimit = limitItem * itemExtent - containerExtent; - if (widget.scrollAnchor == ViewportAnchor.end) + if (widget.anchor == ViewportAnchor.end) _materializedChildBase = (length - _materializedChildBase - _materializedChildCount) % length; } Size materializedContentSize; - switch (widget.scrollDirection) { + switch (widget.mainAxis) { case Axis.vertical: materializedContentSize = new Size(containerSize.width, _materializedChildCount * itemExtent); break; @@ -246,18 +246,18 @@ class ListViewport extends _VirtualListViewport with VirtualViewportFromIterable ListViewport({ ExtentsChangedCallback onExtentsChanged, double scrollOffset: 0.0, - Axis scrollDirection: Axis.vertical, - ViewportAnchor scrollAnchor: ViewportAnchor.start, + Axis mainAxis: Axis.vertical, + ViewportAnchor anchor: ViewportAnchor.start, double itemExtent, bool itemsWrap: false, - EdgeDims padding, - Painter overlayPainter, + EdgeInsets padding, + RenderObjectPainter overlayPainter, this.children }) : super( onExtentsChanged, scrollOffset, - scrollDirection, - scrollAnchor, + mainAxis, + anchor, itemExtent, itemsWrap, padding, @@ -301,7 +301,7 @@ class ScrollableLazyList extends Scrollable { final double itemExtent; final int itemCount; final ItemListBuilder itemBuilder; - final EdgeDims padding; + final EdgeInsets padding; final ScrollableListPainter scrollableListPainter; ScrollableState createState() => new _ScrollableLazyListState(); @@ -341,8 +341,8 @@ class _ScrollableLazyListState extends ScrollableState { return new LazyListViewport( onExtentsChanged: _handleExtentsChanged, scrollOffset: scrollOffset, - scrollDirection: config.scrollDirection, - scrollAnchor: config.scrollAnchor, + mainAxis: config.scrollDirection, + anchor: config.scrollAnchor, itemExtent: config.itemExtent, itemCount: config.itemCount, itemBuilder: config.itemBuilder, @@ -356,18 +356,18 @@ class LazyListViewport extends _VirtualListViewport with VirtualViewportFromBuil LazyListViewport({ ExtentsChangedCallback onExtentsChanged, double scrollOffset: 0.0, - Axis scrollDirection: Axis.vertical, - ViewportAnchor scrollAnchor: ViewportAnchor.start, + Axis mainAxis: Axis.vertical, + ViewportAnchor anchor: ViewportAnchor.start, double itemExtent, - EdgeDims padding, - Painter overlayPainter, + EdgeInsets padding, + RenderObjectPainter overlayPainter, this.itemCount, this.itemBuilder }) : super( onExtentsChanged, scrollOffset, - scrollDirection, - scrollAnchor, + mainAxis, + anchor, itemExtent, false, // Don't support wrapping yet. padding, diff --git a/packages/flutter/lib/src/widgets/semantics_debugger.dart b/packages/flutter/lib/src/widgets/semantics_debugger.dart index 66e1cb5d33..e3f86bee92 100644 --- a/packages/flutter/lib/src/widgets/semantics_debugger.dart +++ b/packages/flutter/lib/src/widgets/semantics_debugger.dart @@ -15,7 +15,7 @@ import 'gesture_detector.dart'; /// /// This widget is useful for understand how an app presents itself to /// accessibility technology. -class SemanticsDebugger extends StatefulComponent { +class SemanticsDebugger extends StatefulWidget { const SemanticsDebugger({ Key key, this.child }) : super(key: key); final Widget child; diff --git a/packages/flutter/lib/src/widgets/status_transitions.dart b/packages/flutter/lib/src/widgets/status_transitions.dart index a3a0bc524a..211474e20a 100644 --- a/packages/flutter/lib/src/widgets/status_transitions.dart +++ b/packages/flutter/lib/src/widgets/status_transitions.dart @@ -5,16 +5,16 @@ import 'basic.dart'; import 'framework.dart'; -/// A component that rebuilds when the given animation changes status. -abstract class StatusTransitionComponent extends StatefulComponent { - StatusTransitionComponent({ +/// A widget that rebuilds when the given animation changes status. +abstract class StatusTransitionWidget extends StatefulWidget { + StatusTransitionWidget({ Key key, this.animation }) : super(key: key) { assert(animation != null); } - /// The animation to which this component is listening. + /// The animation to which this widget is listening. final Animation animation; Widget build(BuildContext context); @@ -22,13 +22,13 @@ abstract class StatusTransitionComponent extends StatefulComponent { _StatusTransitionState createState() => new _StatusTransitionState(); } -class _StatusTransitionState extends State { +class _StatusTransitionState extends State { void initState() { super.initState(); config.animation.addStatusListener(_animationStatusChanged); } - void didUpdateConfig(StatusTransitionComponent oldConfig) { + void didUpdateConfig(StatusTransitionWidget oldConfig) { if (config.animation != oldConfig.animation) { oldConfig.animation.removeStatusListener(_animationStatusChanged); config.animation.addStatusListener(_animationStatusChanged); diff --git a/packages/flutter/lib/src/widgets/title.dart b/packages/flutter/lib/src/widgets/title.dart index 223ae26da4..74cda745d6 100644 --- a/packages/flutter/lib/src/widgets/title.dart +++ b/packages/flutter/lib/src/widgets/title.dart @@ -6,7 +6,7 @@ import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; /// Controls the description of this app in the operating system. -class Title extends StatelessComponent { +class Title extends StatelessWidget { Title({ Key key, this.title, diff --git a/packages/flutter/lib/src/widgets/transitions.dart b/packages/flutter/lib/src/widgets/transitions.dart index 35f8ca5c73..2223cda1a9 100644 --- a/packages/flutter/lib/src/widgets/transitions.dart +++ b/packages/flutter/lib/src/widgets/transitions.dart @@ -12,22 +12,22 @@ import 'framework.dart'; export 'package:flutter/animation.dart' show AnimationDirection; export 'package:flutter/rendering.dart' show RelativeRect; -/// A component that rebuilds when the given animation changes value. +/// A widget that rebuilds when the given animation changes value. /// -/// AnimatedComponent is most useful for stateless animated widgets. To use -/// AnimatedComponent, simply subclass it and implement the build function. +/// AnimatedWidget is most useful for stateless animated widgets. To use +/// AnimatedWidget, simply subclass it and implement the build function. /// /// For more complex case involving additional state, consider using /// [AnimatedBuilder]. -abstract class AnimatedComponent extends StatefulComponent { - AnimatedComponent({ +abstract class AnimatedWidget extends StatefulWidget { + AnimatedWidget({ Key key, this.animation }) : super(key: key) { assert(animation != null); } - /// The animation to which this component is listening. + /// The animation to which this widget is listening. final Animation animation; /// Override this function to build widgets that depend on the current value @@ -35,7 +35,7 @@ abstract class AnimatedComponent extends StatefulComponent { Widget build(BuildContext context); /// Subclasses typically do not override this method. - _AnimatedComponentState createState() => new _AnimatedComponentState(); + _AnimatedState createState() => new _AnimatedState(); void debugFillDescription(List description) { super.debugFillDescription(description); @@ -43,13 +43,13 @@ abstract class AnimatedComponent extends StatefulComponent { } } -class _AnimatedComponentState extends State { +class _AnimatedState extends State { void initState() { super.initState(); config.animation.addListener(_handleTick); } - void didUpdateConfig(AnimatedComponent oldConfig) { + void didUpdateConfig(AnimatedWidget oldConfig) { if (config.animation != oldConfig.animation) { oldConfig.animation.removeListener(_handleTick); config.animation.addListener(_handleTick); @@ -73,7 +73,7 @@ class _AnimatedComponentState extends State { } /// Animates the position of a widget relative to its normal position. -class SlideTransition extends AnimatedComponent { +class SlideTransition extends AnimatedWidget { SlideTransition({ Key key, Animation position, @@ -109,7 +109,7 @@ class SlideTransition extends AnimatedComponent { } /// Animates the scale of transformed widget. -class ScaleTransition extends AnimatedComponent { +class ScaleTransition extends AnimatedWidget { ScaleTransition({ Key key, Animation scale, @@ -145,7 +145,7 @@ class ScaleTransition extends AnimatedComponent { } /// Animates the rotation of a widget. -class RotationTransition extends AnimatedComponent { +class RotationTransition extends AnimatedWidget { RotationTransition({ Key key, Animation turns, @@ -172,7 +172,7 @@ class RotationTransition extends AnimatedComponent { } /// Animates a widget's width or height. -class SizeTransition extends AnimatedComponent { +class SizeTransition extends AnimatedWidget { SizeTransition({ Key key, this.axis: Axis.vertical, @@ -209,7 +209,7 @@ class SizeTransition extends AnimatedComponent { } /// Animates the opacity of a widget. -class FadeTransition extends AnimatedComponent { +class FadeTransition extends AnimatedWidget { FadeTransition({ Key key, Animation opacity, @@ -248,7 +248,7 @@ class RelativeRectTween extends Tween { /// position to and end position over the lifetime of the animation. /// /// Only works if it's the child of a [Stack]. -class PositionedTransition extends AnimatedComponent { +class PositionedTransition extends AnimatedWidget { PositionedTransition({ Key key, Animation rect, @@ -278,7 +278,7 @@ typedef Widget TransitionBuilder(BuildContext context, Widget child); /// A general-purpose widget for building animations. /// -/// AnimatedBuilder is useful for more complex components that wish to include +/// AnimatedBuilder is useful for more complex widgets that wish to include /// an animation as part of a larger build function. To use AnimatedBuilder, /// simply construct the widget and pass it a builder function. /// @@ -294,8 +294,8 @@ typedef Widget TransitionBuilder(BuildContext context, Widget child); /// performance significantly in some cases and is therefore a good practice. /// /// For simple cases without additional state, consider using -/// [AnimatedComponent]. -class AnimatedBuilder extends AnimatedComponent { +/// [AnimatedWidget]. +class AnimatedBuilder extends AnimatedWidget { AnimatedBuilder({ Key key, Animation animation, diff --git a/packages/flutter/lib/src/widgets/unique_component.dart b/packages/flutter/lib/src/widgets/unique_widget.dart similarity index 77% rename from packages/flutter/lib/src/widgets/unique_component.dart rename to packages/flutter/lib/src/widgets/unique_widget.dart index 054d615f8f..ecf546be9f 100644 --- a/packages/flutter/lib/src/widgets/unique_component.dart +++ b/packages/flutter/lib/src/widgets/unique_widget.dart @@ -5,8 +5,8 @@ import 'framework.dart'; /// A widget that has exactly one inflated instance in the tree. -abstract class UniqueComponent extends StatefulComponent { - UniqueComponent({ GlobalKey key }) : super(key: key) { +abstract class UniqueWidget extends StatefulWidget { + UniqueWidget({ GlobalKey key }) : super(key: key) { assert(key != null); } diff --git a/packages/flutter/lib/src/widgets/virtual_viewport.dart b/packages/flutter/lib/src/widgets/virtual_viewport.dart index 07a5ecd7b7..447f3bc7f2 100644 --- a/packages/flutter/lib/src/widgets/virtual_viewport.dart +++ b/packages/flutter/lib/src/widgets/virtual_viewport.dart @@ -51,7 +51,7 @@ abstract class VirtualViewportElement extends RenderObjectElement { /// Returns the pixel offset for a scroll offset, accounting for the scroll /// anchor. double scrollOffsetToPixelOffset(double scrollOffset) { - switch (renderObject.scrollAnchor) { + switch (renderObject.anchor) { case ViewportAnchor.start: return -scrollOffset; case ViewportAnchor.end: @@ -62,7 +62,7 @@ abstract class VirtualViewportElement extends RenderObjectElement { /// Returns a two-dimensional representation of the scroll offset, accounting /// for the scroll direction and scroll anchor. Offset scrollOffsetToPixelDelta(double scrollOffset) { - switch (renderObject.scrollDirection) { + switch (renderObject.mainAxis) { case Axis.horizontal: return new Offset(scrollOffsetToPixelOffset(scrollOffset), 0.0); case Axis.vertical: diff --git a/packages/flutter/lib/widgets.dart b/packages/flutter/lib/widgets.dart index fcea6581e2..e722227715 100644 --- a/packages/flutter/lib/widgets.dart +++ b/packages/flutter/lib/widgets.dart @@ -44,7 +44,7 @@ export 'src/widgets/semantics_debugger.dart'; export 'src/widgets/status_transitions.dart'; export 'src/widgets/title.dart'; export 'src/widgets/transitions.dart'; -export 'src/widgets/unique_component.dart'; +export 'src/widgets/unique_widget.dart'; export 'src/widgets/virtual_viewport.dart'; export 'package:vector_math/vector_math_64.dart' show Matrix4; diff --git a/packages/flutter/test/gestures/arena_test.dart b/packages/flutter/test/gestures/arena_test.dart index 27b1ec2299..6692f383c4 100644 --- a/packages/flutter/test/gestures/arena_test.dart +++ b/packages/flutter/test/gestures/arena_test.dart @@ -11,19 +11,19 @@ const int primaryKey = 4; class TestGestureArenaMember extends GestureArenaMember { bool acceptRan = false; - void acceptGesture(Object key) { + void acceptGesture(int key) { expect(key, equals(primaryKey)); acceptRan = true; } bool rejectRan = false; - void rejectGesture(Object key) { + void rejectGesture(int key) { expect(key, equals(primaryKey)); rejectRan = true; } } class GestureTester { - GestureArena arena = new GestureArena(); + GestureArenaManager arena = new GestureArenaManager(); TestGestureArenaMember first = new TestGestureArenaMember(); TestGestureArenaMember second = new TestGestureArenaMember(); diff --git a/packages/flutter/test/gestures/double_tap_test.dart b/packages/flutter/test/gestures/double_tap_test.dart index ec2d2ae604..e080d2cde8 100644 --- a/packages/flutter/test/gestures/double_tap_test.dart +++ b/packages/flutter/test/gestures/double_tap_test.dart @@ -9,10 +9,10 @@ import 'package:test/test.dart'; import 'gesture_tester.dart'; class TestGestureArenaMember extends GestureArenaMember { - void acceptGesture(Object key) { + void acceptGesture(int key) { accepted = true; } - void rejectGesture(Object key) { + void rejectGesture(int key) { rejected = true; } bool accepted = false; diff --git a/packages/flutter/test/gestures/scale_test.dart b/packages/flutter/test/gestures/scale_test.dart index fd0223da31..b722244fdd 100644 --- a/packages/flutter/test/gestures/scale_test.dart +++ b/packages/flutter/test/gestures/scale_test.dart @@ -12,7 +12,7 @@ void main() { setUp(ensureGesturer); test('Should recognize scale gestures', () { - GestureArena gestureArena = Gesturer.instance.gestureArena; + GestureArenaManager gestureArena = Gesturer.instance.gestureArena; PointerRouter pointerRouter = Gesturer.instance.pointerRouter; ScaleGestureRecognizer scale = new ScaleGestureRecognizer(); TapGestureRecognizer tap = new TapGestureRecognizer(); diff --git a/packages/flutter/test/gestures/scroll_test.dart b/packages/flutter/test/gestures/scroll_test.dart index 9df1f21dfa..0d8fba2b65 100644 --- a/packages/flutter/test/gestures/scroll_test.dart +++ b/packages/flutter/test/gestures/scroll_test.dart @@ -12,7 +12,7 @@ void main() { setUp(ensureGesturer); test('Should recognize pan', () { - GestureArena gestureArena = Gesturer.instance.gestureArena; + GestureArenaManager gestureArena = Gesturer.instance.gestureArena; PointerRouter pointerRouter = Gesturer.instance.pointerRouter; PanGestureRecognizer pan = new PanGestureRecognizer(); TapGestureRecognizer tap = new TapGestureRecognizer(); diff --git a/packages/flutter/test/gestures/tap_test.dart b/packages/flutter/test/gestures/tap_test.dart index 46df856bba..9b8382a35b 100644 --- a/packages/flutter/test/gestures/tap_test.dart +++ b/packages/flutter/test/gestures/tap_test.dart @@ -9,8 +9,8 @@ import 'package:test/test.dart'; import 'gesture_tester.dart'; class TestGestureArenaMember extends GestureArenaMember { - void acceptGesture(Object key) {} - void rejectGesture(Object key) {} + void acceptGesture(int key) {} + void rejectGesture(int key) {} } void main() { diff --git a/packages/flutter/test/painting/edge_dims_test.dart b/packages/flutter/test/painting/edge_dims_test.dart deleted file mode 100644 index 1c75cfb934..0000000000 --- a/packages/flutter/test/painting/edge_dims_test.dart +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'package:flutter/painting.dart'; - -import 'package:test/test.dart'; - -void main() { - test("EdgeDims.lerp()", () { - EdgeDims a = new EdgeDims.all(10.0); - EdgeDims b = new EdgeDims.all(20.0); - expect(EdgeDims.lerp(a, b, 0.25), equals(a * 1.25)); - expect(EdgeDims.lerp(a, b, 0.25), equals(b * 0.625)); - expect(EdgeDims.lerp(a, b, 0.25), equals(a + const EdgeDims.all(2.5))); - expect(EdgeDims.lerp(a, b, 0.25), equals(b - const EdgeDims.all(7.5))); - }); -} diff --git a/packages/flutter/test/painting/edge_insets_test.dart b/packages/flutter/test/painting/edge_insets_test.dart new file mode 100644 index 0000000000..672e2c5104 --- /dev/null +++ b/packages/flutter/test/painting/edge_insets_test.dart @@ -0,0 +1,18 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter/painting.dart'; + +import 'package:test/test.dart'; + +void main() { + test("EdgeInsets.lerp()", () { + EdgeInsets a = new EdgeInsets.all(10.0); + EdgeInsets b = new EdgeInsets.all(20.0); + expect(EdgeInsets.lerp(a, b, 0.25), equals(a * 1.25)); + expect(EdgeInsets.lerp(a, b, 0.25), equals(b * 0.625)); + expect(EdgeInsets.lerp(a, b, 0.25), equals(a + const EdgeInsets.all(2.5))); + expect(EdgeInsets.lerp(a, b, 0.25), equals(b - const EdgeInsets.all(7.5))); + }); +} diff --git a/packages/flutter/test/rendering/block_test.dart b/packages/flutter/test/rendering/block_test.dart index aa4b98f940..9a67565aeb 100644 --- a/packages/flutter/test/rendering/block_test.dart +++ b/packages/flutter/test/rendering/block_test.dart @@ -8,7 +8,7 @@ import 'package:test/test.dart'; import 'rendering_tester.dart'; -class TestBlockPainter extends Painter { +class TestBlockPainter extends RenderObjectPainter { void paint(PaintingContext context, Offset offset) { } } diff --git a/packages/flutter/test/rendering/box_test.dart b/packages/flutter/test/rendering/box_test.dart index e9db8bef8b..0842a55ac5 100644 --- a/packages/flutter/test/rendering/box_test.dart +++ b/packages/flutter/test/rendering/box_test.dart @@ -34,7 +34,7 @@ void main() { child: size ); RenderBox padding = new RenderPadding( - padding: new EdgeDims.all(50.0), + padding: new EdgeInsets.all(50.0), child: inner ); RenderBox flex = new RenderFlex( @@ -67,7 +67,7 @@ void main() { RenderBox coloredBox = new RenderDecoratedBox( decoration: new BoxDecoration() ); - RenderBox paddingBox = new RenderPadding(padding: const EdgeDims.all(10.0), + RenderBox paddingBox = new RenderPadding(padding: const EdgeInsets.all(10.0), child: coloredBox); RenderBox root = new RenderDecoratedBox( decoration: new BoxDecoration(), @@ -82,7 +82,7 @@ void main() { RenderDecoratedBox coloredBox = new RenderDecoratedBox( decoration: new BoxDecoration()); RenderPadding paddedBox = new RenderPadding( - child: coloredBox, padding: const EdgeDims.all(10.0)); + child: coloredBox, padding: const EdgeInsets.all(10.0)); layout(paddedBox); diff --git a/packages/flutter/test/widget/aspect_ratio_test.dart b/packages/flutter/test/widget/aspect_ratio_test.dart index 515cc2b1eb..ec4144b850 100644 --- a/packages/flutter/test/widget/aspect_ratio_test.dart +++ b/packages/flutter/test/widget/aspect_ratio_test.dart @@ -40,7 +40,7 @@ void main() { tester.pumpWidget( new Center( child: new Viewport( - scrollDirection: Axis.horizontal, + mainAxis: Axis.horizontal, child: new AspectRatio( aspectRatio: 2.0, child: new Container( diff --git a/packages/flutter/test/widget/asset_vendor_test.dart b/packages/flutter/test/widget/asset_vendor_test.dart index 009f636910..206b516736 100644 --- a/packages/flutter/test/widget/asset_vendor_test.dart +++ b/packages/flutter/test/widget/asset_vendor_test.dart @@ -83,7 +83,7 @@ Widget buildImageAtRatio(String image, Key key, double ratio, bool inferSize) { data: new MediaQueryData( size: const Size(windowSize, windowSize), devicePixelRatio: ratio, - padding: const EdgeDims.all(0.0) + padding: const EdgeInsets.all(0.0) ), child: new AssetVendor( bundle: new TestAssetBundle(), diff --git a/packages/flutter/test/widget/bottom_sheet_test.dart b/packages/flutter/test/widget/bottom_sheet_test.dart index a2da8db09f..1f04bf318b 100644 --- a/packages/flutter/test/widget/bottom_sheet_test.dart +++ b/packages/flutter/test/widget/bottom_sheet_test.dart @@ -81,7 +81,7 @@ void main() { scaffoldKey.currentState.showBottomSheet((BuildContext context) { return new Container( - margin: new EdgeDims.all(40.0), + margin: new EdgeInsets.all(40.0), child: new Text('BottomSheet') ); }).closed.then((_) { diff --git a/packages/flutter/test/widget/box_decoration_test.dart b/packages/flutter/test/widget/box_decoration_test.dart index d6357c8365..c18740872c 100644 --- a/packages/flutter/test/widget/box_decoration_test.dart +++ b/packages/flutter/test/widget/box_decoration_test.dart @@ -12,7 +12,7 @@ void main() { testWidgets((WidgetTester tester) { tester.pumpWidget( new Container( - padding: new EdgeDims.all(50.0), + padding: new EdgeInsets.all(50.0), decoration: new BoxDecoration( shape: BoxShape.circle, border: new Border.all(width: 10.0, color: const Color(0x80FF00FF)), diff --git a/packages/flutter/test/widget/build_scope_test.dart b/packages/flutter/test/widget/build_scope_test.dart index b79e30df05..d95d2fb6ae 100644 --- a/packages/flutter/test/widget/build_scope_test.dart +++ b/packages/flutter/test/widget/build_scope_test.dart @@ -9,7 +9,7 @@ import 'package:test/test.dart'; import 'test_widgets.dart'; -class ProbeWidget extends StatefulComponent { +class ProbeWidget extends StatefulWidget { ProbeWidgetState createState() => new ProbeWidgetState(); } @@ -32,7 +32,7 @@ class ProbeWidgetState extends State { } } -class BadWidget extends StatelessComponent { +class BadWidget extends StatelessWidget { BadWidget(this.parentState); final State parentState; @@ -43,7 +43,7 @@ class BadWidget extends StatelessComponent { } } -class BadWidgetParent extends StatefulComponent { +class BadWidgetParent extends StatefulWidget { BadWidgetParentState createState() => new BadWidgetParentState(); } @@ -53,7 +53,7 @@ class BadWidgetParentState extends State { } } -class BadDisposeWidget extends StatefulComponent { +class BadDisposeWidget extends StatefulWidget { BadDisposeWidgetState createState() => new BadDisposeWidgetState(); } @@ -98,17 +98,17 @@ void main() { expect(ProbeWidgetState.buildCount, equals(1)); tester.pumpWidget(new ProbeWidget()); expect(ProbeWidgetState.buildCount, equals(2)); - tester.pumpWidget(new FlipComponent( + tester.pumpWidget(new FlipWidget( key: flipKey, left: new Container(), right: new ProbeWidget() )); expect(ProbeWidgetState.buildCount, equals(2)); - FlipComponentState flipState1 = flipKey.currentState; + FlipWidgetState flipState1 = flipKey.currentState; flipState1.flip(); tester.pump(); expect(ProbeWidgetState.buildCount, equals(3)); - FlipComponentState flipState2 = flipKey.currentState; + FlipWidgetState flipState2 = flipKey.currentState; flipState2.flip(); tester.pump(); expect(ProbeWidgetState.buildCount, equals(3)); diff --git a/packages/flutter/test/widget/custom_multi_child_layout_test.dart b/packages/flutter/test/widget/custom_multi_child_layout_test.dart index bf3e208e56..9b741c896d 100644 --- a/packages/flutter/test/widget/custom_multi_child_layout_test.dart +++ b/packages/flutter/test/widget/custom_multi_child_layout_test.dart @@ -28,7 +28,7 @@ class TestMultiChildLayoutDelegate extends MultiChildLayoutDelegate { BoxConstraints constraints = new BoxConstraints.loose(size); performLayoutSize0 = layoutChild(0, constraints); performLayoutSize1 = layoutChild(1, constraints); - performLayoutIsChild = isChild('fred'); + performLayoutIsChild = hasChild('fred'); }, returnsNormally); } diff --git a/packages/flutter/test/widget/custom_one_child_layout_test.dart b/packages/flutter/test/widget/custom_one_child_layout_test.dart index 086831fb7c..71e1e94b50 100644 --- a/packages/flutter/test/widget/custom_one_child_layout_test.dart +++ b/packages/flutter/test/widget/custom_one_child_layout_test.dart @@ -7,7 +7,7 @@ import 'package:flutter/rendering.dart'; import 'package:flutter/widgets.dart'; import 'package:test/test.dart'; -class TestOneChildLayoutDelegate extends OneChildLayoutDelegate { +class TestSingleChildLayoutDelegate extends SingleChildLayoutDelegate { BoxConstraints constraintsFromGetSize; BoxConstraints constraintsFromGetConstraintsForChild; Size sizeFromGetPositionForChild; @@ -46,14 +46,14 @@ class TestOneChildLayoutDelegate extends OneChildLayoutDelegate { } } -Widget buildFrame(OneChildLayoutDelegate delegate) { - return new Center(child: new CustomOneChildLayout(delegate: delegate, child: new Container())); +Widget buildFrame(SingleChildLayoutDelegate delegate) { + return new Center(child: new CustomSingleChildLayout(delegate: delegate, child: new Container())); } void main() { - test('Control test for CustomOneChildLayout', () { + test('Control test for CustomSingleChildLayout', () { testWidgets((WidgetTester tester) { - TestOneChildLayoutDelegate delegate = new TestOneChildLayoutDelegate(); + TestSingleChildLayoutDelegate delegate = new TestSingleChildLayoutDelegate(); tester.pumpWidget(buildFrame(delegate)); expect(delegate.constraintsFromGetSize.minWidth, 0.0); @@ -74,9 +74,9 @@ void main() { }); }); - test('Test OneChildDelegate shouldRelayout method', () { + test('Test SingleChildDelegate shouldRelayout method', () { testWidgets((WidgetTester tester) { - TestOneChildLayoutDelegate delegate = new TestOneChildLayoutDelegate(); + TestSingleChildLayoutDelegate delegate = new TestSingleChildLayoutDelegate(); tester.pumpWidget(buildFrame(delegate)); // Layout happened because the delegate was set. @@ -84,14 +84,14 @@ void main() { expect(delegate.shouldRelayoutCalled, isFalse); // Layout did not happen because shouldRelayout() returned false. - delegate = new TestOneChildLayoutDelegate(); + delegate = new TestSingleChildLayoutDelegate(); delegate.shouldRelayoutValue = false; tester.pumpWidget(buildFrame(delegate)); expect(delegate.shouldRelayoutCalled, isTrue); expect(delegate.constraintsFromGetConstraintsForChild, isNull); // Layout happened because shouldRelayout() returned true. - delegate = new TestOneChildLayoutDelegate(); + delegate = new TestSingleChildLayoutDelegate(); delegate.shouldRelayoutValue = true; tester.pumpWidget(buildFrame(delegate)); expect(delegate.shouldRelayoutCalled, isTrue); diff --git a/packages/flutter/test/widget/dismissable_test.dart b/packages/flutter/test/widget/dismissable_test.dart index 8871277bcb..b8e1634f51 100644 --- a/packages/flutter/test/widget/dismissable_test.dart +++ b/packages/flutter/test/widget/dismissable_test.dart @@ -39,7 +39,7 @@ Widget buildDismissableItem(int item) { Widget widgetBuilder() { return new Container( - padding: const EdgeDims.all(10.0), + padding: const EdgeInsets.all(10.0), child: new ScrollableList( scrollDirection: scrollDirection, itemExtent: itemExtent, @@ -105,8 +105,8 @@ void dismissItem(WidgetTester tester, int item, { DismissDirection gestureDirect tester.pumpWidget(widgetBuilder()); // rebuild after the callback removes the entry } -class Test1215DismissableComponent extends StatelessComponent { - Test1215DismissableComponent(this.text); +class Test1215DismissableWidget extends StatelessWidget { + Test1215DismissableWidget(this.text); final String text; Widget build(BuildContext context) { return new Dismissable( @@ -270,8 +270,8 @@ void main() { }); }); - // This one is for a case where dssmissing a component above a previously - // dismissed component threw an exception, which was documented at the + // This one is for a case where dssmissing a widget above a previously + // dismissed widget threw an exception, which was documented at the // now-obsolete URL https://github.com/flutter/engine/issues/1215 (the URL // died in the migration to the new repo). Don't copy this test; it doesn't // actually remove the dismissed widget, which is a violation of the @@ -284,8 +284,8 @@ void main() { height: 1000.0, child: new Column( children: [ - new Test1215DismissableComponent('1'), - new Test1215DismissableComponent('2') + new Test1215DismissableWidget('1'), + new Test1215DismissableWidget('2') ] ) ) diff --git a/packages/flutter/test/widget/duplicate_key_test.dart b/packages/flutter/test/widget/duplicate_key_test.dart index 081e9684f6..0f4bd80530 100644 --- a/packages/flutter/test/widget/duplicate_key_test.dart +++ b/packages/flutter/test/widget/duplicate_key_test.dart @@ -13,7 +13,7 @@ class Item { } List items = [new Item(), new Item()]; -class StatefulLeaf extends StatefulComponent { +class StatefulLeaf extends StatefulWidget { StatefulLeaf({ GlobalKey key }) : super(key: key); StatefulLeafState createState() => new StatefulLeafState(); } @@ -23,7 +23,7 @@ class StatefulLeafState extends State { Widget build(BuildContext context) => new Text('leaf'); } -class KeyedWrapper extends StatelessComponent { +class KeyedWrapper extends StatelessWidget { KeyedWrapper(this.key1, this.key2); Key key1, key2; Widget build(BuildContext context) { diff --git a/packages/flutter/test/widget/focus_test.dart b/packages/flutter/test/widget/focus_test.dart index f0084c60d0..bfe82b848a 100644 --- a/packages/flutter/test/widget/focus_test.dart +++ b/packages/flutter/test/widget/focus_test.dart @@ -6,7 +6,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:flutter/widgets.dart'; import 'package:test/test.dart'; -class TestFocusable extends StatelessComponent { +class TestFocusable extends StatelessWidget { TestFocusable({ GlobalKey key, this.no, diff --git a/packages/flutter/test/widget/init_state_test.dart b/packages/flutter/test/widget/init_state_test.dart index 23b9cb0f94..418f2ceda4 100644 --- a/packages/flutter/test/widget/init_state_test.dart +++ b/packages/flutter/test/widget/init_state_test.dart @@ -8,11 +8,11 @@ import 'package:test/test.dart'; List ancestors = []; -class TestComponent extends StatefulComponent { - TestComponentState createState() => new TestComponentState(); +class TestWidget extends StatefulWidget { + TestWidgetState createState() => new TestWidgetState(); } -class TestComponentState extends State { +class TestWidgetState extends State { void initState() { super.initState(); context.visitAncestorElements((Element element) { @@ -27,7 +27,7 @@ class TestComponentState extends State { void main() { test('initState() is called when we are in the tree', () { testWidgets((WidgetTester tester) { - tester.pumpWidget(new Container(child: new TestComponent())); + tester.pumpWidget(new Container(child: new TestWidget())); expect(ancestors, equals(['Container', 'RenderObjectToWidgetAdapter'])); }); }); diff --git a/packages/flutter/test/widget/mixed_viewport_test.dart b/packages/flutter/test/widget/mixed_viewport_test.dart index a376ef9da1..10e98e972b 100644 --- a/packages/flutter/test/widget/mixed_viewport_test.dart +++ b/packages/flutter/test/widget/mixed_viewport_test.dart @@ -17,7 +17,7 @@ void main() { // so if our widget is 100 pixels tall, it should fit exactly 6 times. Widget builder() { - return new FlipComponent( + return new FlipWidget( left: new MixedViewport( builder: (BuildContext context, int i) { callbackTracker.add(i); @@ -35,19 +35,19 @@ void main() { tester.pumpWidget(builder()); - StatefulComponentElement element = tester.findElement((Element element) => element.widget is FlipComponent); - FlipComponentState testComponent = element.state; + StatefulElement element = tester.findElement((Element element) => element.widget is FlipWidget); + FlipWidgetState testWidget = element.state; expect(callbackTracker, equals([0, 1, 2, 3, 4, 5])); callbackTracker.clear(); - testComponent.flip(); + testWidget.flip(); tester.pump(); expect(callbackTracker, equals([])); callbackTracker.clear(); - testComponent.flip(); + testWidget.flip(); tester.pump(); expect(callbackTracker, equals([0, 1, 2, 3, 4, 5])); @@ -75,7 +75,7 @@ void main() { }; Widget builder() { - return new FlipComponent( + return new FlipWidget( left: new MixedViewport( builder: itemBuilder, startOffset: offset @@ -123,7 +123,7 @@ void main() { }; Widget builder() { - return new FlipComponent( + return new FlipWidget( left: new MixedViewport( builder: itemBuilder, startOffset: offset, diff --git a/packages/flutter/test/widget/modal_barrier_test.dart b/packages/flutter/test/widget/modal_barrier_test.dart index 904f865f5d..de87cb4999 100644 --- a/packages/flutter/test/widget/modal_barrier_test.dart +++ b/packages/flutter/test/widget/modal_barrier_test.dart @@ -62,8 +62,8 @@ void main() { test('ModalBarrier pops the Navigator when dismissed', () { testWidgets((WidgetTester tester) { final Map routes = { - '/': (RouteArguments args) => new FirstComponent(), - '/modal': (RouteArguments args) => new SecondComponent(), + '/': (RouteArguments args) => new FirstWidget(), + '/modal': (RouteArguments args) => new SecondWidget(), }; tester.pumpWidget(new MaterialApp(routes: routes)); @@ -87,7 +87,7 @@ void main() { }); } -class FirstComponent extends StatelessComponent { +class FirstWidget extends StatelessWidget { Widget build(BuildContext context) { return new GestureDetector( onTap: () { @@ -100,7 +100,7 @@ class FirstComponent extends StatelessComponent { } } -class SecondComponent extends StatelessComponent { +class SecondWidget extends StatelessWidget { Widget build(BuildContext context) { return new ModalBarrier( key: const ValueKey('barrier'), diff --git a/packages/flutter/test/widget/multichild_test.dart b/packages/flutter/test/widget/multichild_test.dart index 9756c8a47b..ced5f2089b 100644 --- a/packages/flutter/test/widget/multichild_test.dart +++ b/packages/flutter/test/widget/multichild_test.dart @@ -113,7 +113,7 @@ void main() { }); }); - test('MultiChildRenderObjectElement with stateless components', () { + test('MultiChildRenderObjectElement with stateless widgets', () { testWidgets((WidgetTester tester) { tester.pumpWidget( @@ -234,7 +234,7 @@ void main() { }); }); - test('MultiChildRenderObjectElement with stateful components', () { + test('MultiChildRenderObjectElement with stateful widgets', () { testWidgets((WidgetTester tester) { tester.pumpWidget( new Stack( @@ -250,7 +250,7 @@ void main() { tester.pumpWidget( new Stack( children: [ - new FlipComponent( + new FlipWidget( left: new DecoratedBox(decoration: kBoxDecorationA), right: new DecoratedBox(decoration: kBoxDecorationB) ), @@ -261,7 +261,7 @@ void main() { checkTree(tester, [kBoxDecorationA, kBoxDecorationC]); - flipStatefulComponent(tester); + flipStatefulWidget(tester); tester.pump(); checkTree(tester, [kBoxDecorationB, kBoxDecorationC]); @@ -269,7 +269,7 @@ void main() { tester.pumpWidget( new Stack( children: [ - new FlipComponent( + new FlipWidget( left: new DecoratedBox(decoration: kBoxDecorationA), right: new DecoratedBox(decoration: kBoxDecorationB) ), @@ -279,7 +279,7 @@ void main() { checkTree(tester, [kBoxDecorationB]); - flipStatefulComponent(tester); + flipStatefulWidget(tester); tester.pump(); checkTree(tester, [kBoxDecorationA]); @@ -287,7 +287,7 @@ void main() { tester.pumpWidget( new Stack( children: [ - new FlipComponent( + new FlipWidget( key: new Key('flip'), left: new DecoratedBox(decoration: kBoxDecorationA), right: new DecoratedBox(decoration: kBoxDecorationB) @@ -300,7 +300,7 @@ void main() { new Stack( children: [ new DecoratedBox(key: new Key('c'), decoration: kBoxDecorationC), - new FlipComponent( + new FlipWidget( key: new Key('flip'), left: new DecoratedBox(decoration: kBoxDecorationA), right: new DecoratedBox(decoration: kBoxDecorationB) @@ -311,7 +311,7 @@ void main() { checkTree(tester, [kBoxDecorationC, kBoxDecorationA]); - flipStatefulComponent(tester); + flipStatefulWidget(tester); tester.pump(); checkTree(tester, [kBoxDecorationC, kBoxDecorationB]); @@ -319,7 +319,7 @@ void main() { tester.pumpWidget( new Stack( children: [ - new FlipComponent( + new FlipWidget( key: new Key('flip'), left: new DecoratedBox(decoration: kBoxDecorationA), right: new DecoratedBox(decoration: kBoxDecorationB) diff --git a/packages/flutter/test/widget/navigator_test.dart b/packages/flutter/test/widget/navigator_test.dart index 80c6dc152d..9dce4cb708 100644 --- a/packages/flutter/test/widget/navigator_test.dart +++ b/packages/flutter/test/widget/navigator_test.dart @@ -6,7 +6,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:flutter/material.dart'; import 'package:test/test.dart'; -class FirstComponent extends StatelessComponent { +class FirstWidget extends StatelessWidget { Widget build(BuildContext context) { return new GestureDetector( onTap: () { @@ -22,11 +22,11 @@ class FirstComponent extends StatelessComponent { } } -class SecondComponent extends StatefulComponent { - SecondComponentState createState() => new SecondComponentState(); +class SecondWidget extends StatefulWidget { + SecondWidgetState createState() => new SecondWidgetState(); } -class SecondComponentState extends State { +class SecondWidgetState extends State { Widget build(BuildContext context) { return new GestureDetector( onTap: () => Navigator.pop(context), @@ -42,8 +42,8 @@ class SecondComponentState extends State { typedef void ExceptionCallback(dynamic exception); -class ThirdComponent extends StatelessComponent { - ThirdComponent({ this.targetKey, this.onException }); +class ThirdWidget extends StatelessWidget { + ThirdWidget({ this.targetKey, this.onException }); final Key targetKey; final ExceptionCallback onException; @@ -64,11 +64,11 @@ class ThirdComponent extends StatelessComponent { } void main() { - test('Can navigator navigate to and from a stateful component', () { + test('Can navigator navigate to and from a stateful widget', () { testWidgets((WidgetTester tester) { final Map routes = { - '/': (RouteArguments args) => new FirstComponent(), - '/second': (RouteArguments args) => new SecondComponent(), + '/': (RouteArguments args) => new FirstWidget(), + '/second': (RouteArguments args) => new SecondWidget(), }; tester.pumpWidget(new MaterialApp(routes: routes)); @@ -101,7 +101,7 @@ void main() { testWidgets((WidgetTester tester) { Key targetKey = new Key('foo'); dynamic exception; - Widget widget = new ThirdComponent( + Widget widget = new ThirdWidget( targetKey: targetKey, onException: (dynamic e) { exception = e; diff --git a/packages/flutter/test/widget/page_forward_transitions_test.dart b/packages/flutter/test/widget/page_forward_transitions_test.dart index 7b3bf5d0e7..d350d317cd 100644 --- a/packages/flutter/test/widget/page_forward_transitions_test.dart +++ b/packages/flutter/test/widget/page_forward_transitions_test.dart @@ -6,7 +6,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:flutter/material.dart'; import 'package:test/test.dart' hide TypeMatcher; -class TestTransition extends AnimatedComponent { +class TestTransition extends AnimatedWidget { TestTransition({ Key key, this.childFirstHalf, diff --git a/packages/flutter/test/widget/parent_data_test.dart b/packages/flutter/test/widget/parent_data_test.dart index 940d88d70b..491ad45b05 100644 --- a/packages/flutter/test/widget/parent_data_test.dart +++ b/packages/flutter/test/widget/parent_data_test.dart @@ -210,7 +210,7 @@ void main() { children: [ new Positioned( right: 10.0, - child: new FlipComponent(left: kDecoratedBoxA, right: kDecoratedBoxB) + child: new FlipWidget(left: kDecoratedBoxA, right: kDecoratedBoxB) ), ] ) @@ -220,7 +220,7 @@ void main() { new TestParentData(right: 10.0), ]); - flipStatefulComponent(tester); + flipStatefulWidget(tester); tester.pump(); checkTree(tester, [ @@ -232,7 +232,7 @@ void main() { children: [ new Positioned( top: 7.0, - child: new FlipComponent(left: kDecoratedBoxA, right: kDecoratedBoxB) + child: new FlipWidget(left: kDecoratedBoxA, right: kDecoratedBoxB) ), ] ) @@ -242,7 +242,7 @@ void main() { new TestParentData(top: 7.0), ]); - flipStatefulComponent(tester); + flipStatefulWidget(tester); tester.pump(); checkTree(tester, [ diff --git a/packages/flutter/test/widget/remember_scroll_position_test.dart b/packages/flutter/test/widget/remember_scroll_position_test.dart index 4c166f3aaf..6e6b7e3bb8 100644 --- a/packages/flutter/test/widget/remember_scroll_position_test.dart +++ b/packages/flutter/test/widget/remember_scroll_position_test.dart @@ -6,7 +6,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:flutter/material.dart'; import 'package:test/test.dart'; -class ThePositiveNumbers extends StatelessComponent { +class ThePositiveNumbers extends StatelessWidget { Widget build(BuildContext context) { return new ScrollableLazyList( itemExtent: 100.0, @@ -47,7 +47,7 @@ void main() { expect(tester.findText('10'), isNull); expect(tester.findText('100'), isNull); - StatefulComponentElement target = + StatefulElement target = tester.findElement((Element element) => element.widget is ScrollableLazyList); ScrollableState targetState = target.state; targetState.scrollTo(1000.0); diff --git a/packages/flutter/test/widget/render_object_widget_test.dart b/packages/flutter/test/widget/render_object_widget_test.dart index e6e531ee6d..ed70615805 100644 --- a/packages/flutter/test/widget/render_object_widget_test.dart +++ b/packages/flutter/test/widget/render_object_widget_test.dart @@ -11,8 +11,8 @@ final BoxDecoration kBoxDecorationA = new BoxDecoration(); final BoxDecoration kBoxDecorationB = new BoxDecoration(); final BoxDecoration kBoxDecorationC = new BoxDecoration(); -class TestComponent extends StatelessComponent { - const TestComponent({ this.child }); +class TestWidget extends StatelessWidget { + const TestWidget({ this.child }); final Widget child; Widget build(BuildContext context) => child; } @@ -21,8 +21,8 @@ void main() { test('RenderObjectWidget smoke test', () { testWidgets((WidgetTester tester) { tester.pumpWidget(new DecoratedBox(decoration: kBoxDecorationA)); - OneChildRenderObjectElement element = - tester.findElement((Element element) => element is OneChildRenderObjectElement); + SingleChildRenderObjectElement element = + tester.findElement((Element element) => element is SingleChildRenderObjectElement); expect(element, isNotNull); expect(element.renderObject is RenderDecoratedBox, isTrue); RenderDecoratedBox renderObject = element.renderObject; @@ -30,7 +30,7 @@ void main() { expect(renderObject.position, equals(DecorationPosition.background)); tester.pumpWidget(new DecoratedBox(decoration: kBoxDecorationB)); - element = tester.findElement((Element element) => element is OneChildRenderObjectElement); + element = tester.findElement((Element element) => element is SingleChildRenderObjectElement); expect(element, isNotNull); expect(element.renderObject is RenderDecoratedBox, isTrue); renderObject = element.renderObject; @@ -43,8 +43,8 @@ void main() { testWidgets((WidgetTester tester) { void checkFullTree() { - OneChildRenderObjectElement element = - tester.findElement((Element element) => element is OneChildRenderObjectElement); + SingleChildRenderObjectElement element = + tester.findElement((Element element) => element is SingleChildRenderObjectElement); expect(element, isNotNull); expect(element.renderObject is RenderDecoratedBox, isTrue); RenderDecoratedBox renderObject = element.renderObject; @@ -59,8 +59,8 @@ void main() { } void childBareTree() { - OneChildRenderObjectElement element = - tester.findElement((Element element) => element is OneChildRenderObjectElement); + SingleChildRenderObjectElement element = + tester.findElement((Element element) => element is SingleChildRenderObjectElement); expect(element, isNotNull); expect(element.renderObject is RenderDecoratedBox, isTrue); RenderDecoratedBox renderObject = element.renderObject; @@ -80,7 +80,7 @@ void main() { tester.pumpWidget(new DecoratedBox( decoration: kBoxDecorationA, - child: new TestComponent( + child: new TestWidget( child: new DecoratedBox( decoration: kBoxDecorationB ) @@ -106,8 +106,8 @@ void main() { tester.pumpWidget(new DecoratedBox( decoration: kBoxDecorationA, - child: new TestComponent( - child: new TestComponent( + child: new TestWidget( + child: new TestWidget( child: new DecoratedBox( decoration: kBoxDecorationB ) @@ -138,8 +138,8 @@ void main() { ) )); - OneChildRenderObjectElement element = - tester.findElement((Element element) => element is OneChildRenderObjectElement); + SingleChildRenderObjectElement element = + tester.findElement((Element element) => element is SingleChildRenderObjectElement); expect(element.renderObject is RenderDecoratedBox, isTrue); RenderDecoratedBox parent = element.renderObject; expect(parent.child is RenderDecoratedBox, isTrue); @@ -155,7 +155,7 @@ void main() { )); element = - tester.findElement((Element element) => element is OneChildRenderObjectElement); + tester.findElement((Element element) => element is SingleChildRenderObjectElement); expect(element.renderObject is RenderDecoratedBox, isTrue); expect(element.renderObject, equals(parent)); expect(parent.child, isNull); diff --git a/packages/flutter/test/widget/reparent_state_test.dart b/packages/flutter/test/widget/reparent_state_test.dart index 99a84e01e6..5bc58715c9 100644 --- a/packages/flutter/test/widget/reparent_state_test.dart +++ b/packages/flutter/test/widget/reparent_state_test.dart @@ -6,7 +6,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:flutter/widgets.dart'; import 'package:test/test.dart'; -class StateMarker extends StatefulComponent { +class StateMarker extends StatefulWidget { StateMarker({ Key key, this.child }) : super(key: key); final Widget child; diff --git a/packages/flutter/test/widget/scrollable_lazy_list_test.dart b/packages/flutter/test/widget/scrollable_lazy_list_test.dart index 077b23a343..8655777600 100644 --- a/packages/flutter/test/widget/scrollable_lazy_list_test.dart +++ b/packages/flutter/test/widget/scrollable_lazy_list_test.dart @@ -17,7 +17,7 @@ void main() { // so if our widget is 100 pixels tall, it should fit exactly 6 times. Widget builder() { - return new FlipComponent( + return new FlipWidget( left: new ScrollableLazyList( itemBuilder: (BuildContext context, int start, int count) { List result = []; @@ -39,19 +39,19 @@ void main() { tester.pumpWidget(builder()); - StatefulComponentElement element = tester.findElement((Element element) => element.widget is FlipComponent); - FlipComponentState testComponent = element.state; + StatefulElement element = tester.findElement((Element element) => element.widget is FlipWidget); + FlipWidgetState testWidget = element.state; expect(callbackTracker, equals([0, 1, 2, 3, 4, 5])); callbackTracker.clear(); - testComponent.flip(); + testWidget.flip(); tester.pump(); expect(callbackTracker, equals([])); callbackTracker.clear(); - testComponent.flip(); + testWidget.flip(); tester.pump(); expect(callbackTracker, equals([0, 1, 2, 3, 4, 5])); @@ -81,7 +81,7 @@ void main() { }; GlobalKey> scrollableKey = new GlobalKey>(); - FlipComponent testComponent = new FlipComponent( + FlipWidget testWidget = new FlipWidget( left: new ScrollableLazyList( key: scrollableKey, itemBuilder: itemBuilder, @@ -91,7 +91,7 @@ void main() { right: new Text('Not Today') ); - tester.pumpWidget(testComponent); + tester.pumpWidget(testWidget); expect(callbackTracker, equals([1, 2, 3, 4])); @@ -100,7 +100,7 @@ void main() { scrollableKey.currentState.scrollTo(400.0); // now only 3 should fit, numbered 2-4. - tester.pumpWidget(testComponent); + tester.pumpWidget(testWidget); expect(callbackTracker, equals([2, 3, 4])); @@ -131,7 +131,7 @@ void main() { }; GlobalKey> scrollableKey = new GlobalKey>(); - FlipComponent testComponent = new FlipComponent( + FlipWidget testWidget = new FlipWidget( left: new ScrollableLazyList( key: scrollableKey, itemBuilder: itemBuilder, @@ -142,7 +142,7 @@ void main() { right: new Text('Not Today') ); - tester.pumpWidget(testComponent); + tester.pumpWidget(testWidget); expect(callbackTracker, equals([1, 2, 3, 4, 5])); @@ -151,7 +151,7 @@ void main() { scrollableKey.currentState.scrollTo(400.0); // now only 4 should fit, numbered 2-5. - tester.pumpWidget(testComponent); + tester.pumpWidget(testWidget); expect(callbackTracker, equals([2, 3, 4, 5])); diff --git a/packages/flutter/test/widget/scrollable_list_hit_testing_test.dart b/packages/flutter/test/widget/scrollable_list_hit_testing_test.dart index 2ae288bd72..bbdd92ec5d 100644 --- a/packages/flutter/test/widget/scrollable_list_hit_testing_test.dart +++ b/packages/flutter/test/widget/scrollable_list_hit_testing_test.dart @@ -100,7 +100,7 @@ void main() { new ScrollableList( key: new GlobalKey(), itemExtent: 290.0, - padding: new EdgeDims.TRBL(20.0, 15.0, 10.0, 5.0), + padding: new EdgeInsets.TRBL(20.0, 15.0, 10.0, 5.0), children: items.map((int item) { return new Container( child: new GestureDetector( @@ -135,7 +135,7 @@ void main() { key: new GlobalKey(), itemExtent: 290.0, scrollAnchor: ViewportAnchor.end, - padding: new EdgeDims.TRBL(20.0, 15.0, 10.0, 5.0), + padding: new EdgeInsets.TRBL(20.0, 15.0, 10.0, 5.0), children: items.map((int item) { return new Container( child: new GestureDetector( diff --git a/packages/flutter/test/widget/scrollable_list_vertical_test.dart b/packages/flutter/test/widget/scrollable_list_vertical_test.dart index 7d9d878988..afdda7de5b 100644 --- a/packages/flutter/test/widget/scrollable_list_vertical_test.dart +++ b/packages/flutter/test/widget/scrollable_list_vertical_test.dart @@ -71,7 +71,7 @@ void main() { tester.pumpWidget( new ScrollableList( itemExtent: 290.0, - padding: new EdgeDims.only(top: 250.0), + padding: new EdgeInsets.only(top: 250.0), scrollDirection: Axis.vertical, children: items.map((int item) { return new Container( diff --git a/packages/flutter/test/widget/set_state_3_test.dart b/packages/flutter/test/widget/set_state_3_test.dart index 9b7bacf682..0d8b221989 100644 --- a/packages/flutter/test/widget/set_state_3_test.dart +++ b/packages/flutter/test/widget/set_state_3_test.dart @@ -8,7 +8,7 @@ import 'package:test/test.dart'; ChangerState changer; -class Changer extends StatefulComponent { +class Changer extends StatefulWidget { Changer(this.child); final Widget child; @@ -29,7 +29,7 @@ class ChangerState extends State { Widget build(BuildContext context) => _state ? new Wrapper(config.child) : config.child; } -class Wrapper extends StatelessComponent { +class Wrapper extends StatelessWidget { Wrapper(this.child); final Widget child; @@ -37,7 +37,7 @@ class Wrapper extends StatelessComponent { Widget build(BuildContext context) => child; } -class Leaf extends StatefulComponent { +class Leaf extends StatefulWidget { LeafState createState() => new LeafState(); } diff --git a/packages/flutter/test/widget/set_state_test.dart b/packages/flutter/test/widget/set_state_test.dart index 16f45a057f..c046ce8cb1 100644 --- a/packages/flutter/test/widget/set_state_test.dart +++ b/packages/flutter/test/widget/set_state_test.dart @@ -6,7 +6,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:flutter/widgets.dart'; import 'package:test/test.dart'; -class Inside extends StatefulComponent { +class Inside extends StatefulWidget { InsideState createState() => new InsideState(); } @@ -23,7 +23,7 @@ class InsideState extends State { } } -class Middle extends StatefulComponent { +class Middle extends StatefulWidget { Middle({ this.child }); final Inside child; @@ -44,7 +44,7 @@ class MiddleState extends State { } } -class Outside extends StatefulComponent { +class Outside extends StatefulWidget { OutsideState createState() => new OutsideState(); } diff --git a/packages/flutter/test/widget/stateful_component_test.dart b/packages/flutter/test/widget/stateful_component_test.dart index c85b290cb7..5dcee4591e 100644 --- a/packages/flutter/test/widget/stateful_component_test.dart +++ b/packages/flutter/test/widget/stateful_component_test.dart @@ -10,12 +10,12 @@ import 'package:test/test.dart'; import 'test_widgets.dart'; void main() { - test('Stateful component smoke test', () { + test('Stateful widget smoke test', () { testWidgets((WidgetTester tester) { void checkTree(BoxDecoration expectedDecoration) { - OneChildRenderObjectElement element = - tester.findElement((Element element) => element is OneChildRenderObjectElement); + SingleChildRenderObjectElement element = + tester.findElement((Element element) => element is SingleChildRenderObjectElement); expect(element, isNotNull); expect(element.renderObject is RenderDecoratedBox, isTrue); RenderDecoratedBox renderObject = element.renderObject; @@ -23,7 +23,7 @@ void main() { } tester.pumpWidget( - new FlipComponent( + new FlipWidget( left: new DecoratedBox(decoration: kBoxDecorationA), right: new DecoratedBox(decoration: kBoxDecorationB) ) @@ -32,7 +32,7 @@ void main() { checkTree(kBoxDecorationA); tester.pumpWidget( - new FlipComponent( + new FlipWidget( left: new DecoratedBox(decoration: kBoxDecorationB), right: new DecoratedBox(decoration: kBoxDecorationA) ) @@ -40,14 +40,14 @@ void main() { checkTree(kBoxDecorationB); - flipStatefulComponent(tester); + flipStatefulWidget(tester); tester.pump(); checkTree(kBoxDecorationA); tester.pumpWidget( - new FlipComponent( + new FlipWidget( left: new DecoratedBox(decoration: kBoxDecorationA), right: new DecoratedBox(decoration: kBoxDecorationB) ) @@ -57,11 +57,11 @@ void main() { }); }); - test('Don\'t rebuild subcomponents', () { + test('Don\'t rebuild subwidgets', () { testWidgets((WidgetTester tester) { tester.pumpWidget( - new FlipComponent( - key: new Key('rebuild test'), // this is so we don't get the state from the TestComponentConfig in the last test, but instead instantiate a new element with a new state. + new FlipWidget( + key: new Key('rebuild test'), left: new TestBuildCounter(), right: new DecoratedBox(decoration: kBoxDecorationB) ) @@ -69,7 +69,7 @@ void main() { expect(TestBuildCounter.buildCount, equals(1)); - flipStatefulComponent(tester); + flipStatefulWidget(tester); tester.pump(); diff --git a/packages/flutter/test/widget/stateful_components_test.dart b/packages/flutter/test/widget/stateful_components_test.dart index 1e4716cc37..179e7e4636 100644 --- a/packages/flutter/test/widget/stateful_components_test.dart +++ b/packages/flutter/test/widget/stateful_components_test.dart @@ -6,12 +6,12 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:flutter/widgets.dart'; import 'package:test/test.dart'; -class InnerComponent extends StatefulComponent { - InnerComponent({ Key key }) : super(key: key); - InnerComponentState createState() => new InnerComponentState(); +class InnerWidget extends StatefulWidget { + InnerWidget({ Key key }) : super(key: key); + InnerWidgetState createState() => new InnerWidgetState(); } -class InnerComponentState extends State { +class InnerWidgetState extends State { bool _didInitState = false; void initState() { @@ -24,10 +24,10 @@ class InnerComponentState extends State { } } -class OuterContainer extends StatefulComponent { +class OuterContainer extends StatefulWidget { OuterContainer({ Key key, this.child }) : super(key: key); - final InnerComponent child; + final InnerWidget child; OuterContainerState createState() => new OuterContainerState(); } @@ -44,20 +44,20 @@ void main() { Key innerKey = new Key('inner'); Key outerKey = new Key('outer'); - InnerComponent inner1 = new InnerComponent(key: innerKey); - InnerComponent inner2; + InnerWidget inner1 = new InnerWidget(key: innerKey); + InnerWidget inner2; OuterContainer outer1 = new OuterContainer(key: outerKey, child: inner1); OuterContainer outer2; tester.pumpWidget(outer1); - StatefulComponentElement innerElement = tester.findElementByKey(innerKey); - InnerComponentState innerElementState = innerElement.state; + StatefulElement innerElement = tester.findElementByKey(innerKey); + InnerWidgetState innerElementState = innerElement.state; expect(innerElementState.config, equals(inner1)); expect(innerElementState._didInitState, isTrue); expect(innerElement.renderObject.attached, isTrue); - inner2 = new InnerComponent(key: innerKey); + inner2 = new InnerWidget(key: innerKey); outer2 = new OuterContainer(key: outerKey, child: inner2); tester.pumpWidget(outer2); @@ -69,7 +69,7 @@ void main() { expect(innerElementState._didInitState, isTrue); expect(innerElement.renderObject.attached, isTrue); - StatefulComponentElement outerElement = tester.findElementByKey(outerKey); + StatefulElement outerElement = tester.findElementByKey(outerKey); expect(outerElement.state.config, equals(outer2)); outerElement.state.setState(() {}); tester.pump(); diff --git a/packages/flutter/test/widget/syncing_test.dart b/packages/flutter/test/widget/syncing_test.dart index dd03c96a2b..b6fedcb2ad 100644 --- a/packages/flutter/test/widget/syncing_test.dart +++ b/packages/flutter/test/widget/syncing_test.dart @@ -6,7 +6,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:flutter/widgets.dart'; import 'package:test/test.dart'; -class TestWidget extends StatefulComponent { +class TestWidget extends StatefulWidget { TestWidget({ this.child, this.persistentState, this.syncedState }); final Widget child; diff --git a/packages/flutter/test/widget/test_widgets.dart b/packages/flutter/test/widget/test_widgets.dart index 9eaaaf4d78..4b6fa29cb2 100644 --- a/packages/flutter/test/widget/test_widgets.dart +++ b/packages/flutter/test/widget/test_widgets.dart @@ -18,7 +18,7 @@ final BoxDecoration kBoxDecorationC = new BoxDecoration( backgroundColor: const Color(0xFF0000FF) ); -class TestBuildCounter extends StatelessComponent { +class TestBuildCounter extends StatelessWidget { static int buildCount = 0; Widget build(BuildContext context) { @@ -28,16 +28,16 @@ class TestBuildCounter extends StatelessComponent { } -class FlipComponent extends StatefulComponent { - FlipComponent({ Key key, this.left, this.right }) : super(key: key); +class FlipWidget extends StatefulWidget { + FlipWidget({ Key key, this.left, this.right }) : super(key: key); final Widget left; final Widget right; - FlipComponentState createState() => new FlipComponentState(); + FlipWidgetState createState() => new FlipWidgetState(); } -class FlipComponentState extends State { +class FlipWidgetState extends State { bool _showLeft = true; void flip() { @@ -51,11 +51,11 @@ class FlipComponentState extends State { } } -void flipStatefulComponent(WidgetTester tester) { - StatefulComponentElement stateElement = - tester.findElement((Element element) => element is StatefulComponentElement); +void flipStatefulWidget(WidgetTester tester) { + StatefulElement stateElement = + tester.findElement((Element element) => element is StatefulElement); expect(stateElement, isNotNull); - expect(stateElement.state is FlipComponentState, isTrue); - FlipComponentState state = stateElement.state; + expect(stateElement.state is FlipWidgetState, isTrue); + FlipWidgetState state = stateElement.state; state.flip(); } diff --git a/packages/flutter/test/widget/tooltip_test.dart b/packages/flutter/test/widget/tooltip_test.dart index 98c27097ba..dd191defb7 100644 --- a/packages/flutter/test/widget/tooltip_test.dart +++ b/packages/flutter/test/widget/tooltip_test.dart @@ -28,9 +28,9 @@ void main() { key: key, message: 'TIP', height: 20.0, - padding: const EdgeDims.all(5.0), + padding: const EdgeInsets.all(5.0), verticalOffset: 20.0, - screenEdgeMargin: const EdgeDims.all(10.0), + screenEdgeMargin: const EdgeInsets.all(10.0), preferBelow: false, fadeDuration: const Duration(seconds: 1), showDuration: const Duration(seconds: 2), @@ -82,9 +82,9 @@ void main() { key: key, message: 'TIP', height: 100.0, - padding: const EdgeDims.all(0.0), + padding: const EdgeInsets.all(0.0), verticalOffset: 100.0, - screenEdgeMargin: const EdgeDims.all(100.0), + screenEdgeMargin: const EdgeInsets.all(100.0), preferBelow: false, fadeDuration: const Duration(seconds: 1), showDuration: const Duration(seconds: 2), @@ -138,9 +138,9 @@ void main() { key: key, message: 'TIP', height: 100.0, - padding: const EdgeDims.all(0.0), + padding: const EdgeInsets.all(0.0), verticalOffset: 100.0, - screenEdgeMargin: const EdgeDims.all(100.0), + screenEdgeMargin: const EdgeInsets.all(100.0), preferBelow: false, fadeDuration: const Duration(seconds: 1), showDuration: const Duration(seconds: 2), @@ -205,9 +205,9 @@ void main() { key: key, message: 'TIP', height: 100.0, - padding: const EdgeDims.all(0.0), + padding: const EdgeInsets.all(0.0), verticalOffset: 100.0, - screenEdgeMargin: const EdgeDims.all(100.0), + screenEdgeMargin: const EdgeInsets.all(100.0), preferBelow: true, fadeDuration: const Duration(seconds: 1), showDuration: const Duration(seconds: 2), @@ -260,9 +260,9 @@ void main() { key: key, message: 'TIP', height: 10.0, - padding: const EdgeDims.all(0.0), + padding: const EdgeInsets.all(0.0), verticalOffset: 10.0, - screenEdgeMargin: const EdgeDims.all(10.0), + screenEdgeMargin: const EdgeInsets.all(10.0), preferBelow: true, fadeDuration: const Duration(seconds: 1), showDuration: const Duration(seconds: 2), @@ -317,9 +317,9 @@ void main() { key: key, message: 'TIP', height: 10.0, - padding: const EdgeDims.all(0.0), + padding: const EdgeInsets.all(0.0), verticalOffset: 10.0, - screenEdgeMargin: const EdgeDims.all(10.0), + screenEdgeMargin: const EdgeInsets.all(10.0), preferBelow: true, fadeDuration: const Duration(seconds: 1), showDuration: const Duration(seconds: 2), diff --git a/packages/flutter_markdown/lib/src/markdown.dart b/packages/flutter_markdown/lib/src/markdown.dart index aa8962729b..5edfffdef2 100644 --- a/packages/flutter_markdown/lib/src/markdown.dart +++ b/packages/flutter_markdown/lib/src/markdown.dart @@ -68,7 +68,7 @@ class MarkdownBody extends MarkdownBodyRaw { /// /// new ScrollableViewport( /// child: new Padding( - /// padding: new EdgeDims.all(16.0), + /// padding: new EdgeInsets.all(16.0), /// child: new Markdown(data: markdownSource) /// ) /// ) diff --git a/packages/flutter_markdown/lib/src/markdown_raw.dart b/packages/flutter_markdown/lib/src/markdown_raw.dart index d80555bb6c..c7554acdd2 100644 --- a/packages/flutter_markdown/lib/src/markdown_raw.dart +++ b/packages/flutter_markdown/lib/src/markdown_raw.dart @@ -15,7 +15,7 @@ typedef void MarkdownLinkCallback(String href); /// https://daringfireball.net/projects/markdown/ The rendered markdown is /// placed in a padded scrolling view port. If you do not want the scrolling /// behaviour, use the [MarkdownBodyRaw] class instead. -class MarkdownRaw extends StatelessComponent { +class MarkdownRaw extends StatelessWidget { /// Creates a new Markdown [Widget] that renders the markdown formatted string /// passed in as [data]. By default the markdown will be rendered using the @@ -29,7 +29,7 @@ class MarkdownRaw extends StatelessComponent { this.data, this.markdownStyle, this.syntaxHighlighter, - this.padding: const EdgeDims.all(16.0), + this.padding: const EdgeInsets.all(16.0), this.onTapLink }); @@ -43,7 +43,7 @@ class MarkdownRaw extends StatelessComponent { final SyntaxHighlighter syntaxHighlighter; /// Padding used - final EdgeDims padding; + final EdgeInsets padding; /// Callback when a link is tapped final MarkdownLinkCallback onTapLink; @@ -82,7 +82,7 @@ class MarkdownRaw extends StatelessComponent { /// https://daringfireball.net/projects/markdown/ This class doesn't implement /// any scrolling behavior, if you want scrolling either wrap the widget in /// a [ScrollableViewport] or use the [MarkdownRaw] widget. -class MarkdownBodyRaw extends StatefulComponent { +class MarkdownBodyRaw extends StatefulWidget { /// Creates a new Markdown [Widget] that renders the markdown formatted string /// passed in as [data]. You need to pass in a [markdownStyle] that defines @@ -94,7 +94,7 @@ class MarkdownBodyRaw extends StatefulComponent { /// /// new ScrollableViewport( /// child: new Padding( - /// padding: new EdgeDims.all(16.0), + /// padding: new EdgeInsets.all(16.0), /// child: new MarkdownBodyRaw( /// data: markdownSource, /// markdownStyle: myStyle @@ -382,7 +382,7 @@ class _Block { } else { bullet = new Padding( - padding: new EdgeDims.only(right: 5.0), + padding: new EdgeInsets.only(right: 5.0), child: new Text( "${blockPosition + 1}.", style: new TextStyle(textAlign: TextAlign.right) @@ -404,19 +404,19 @@ class _Block { } BoxDecoration decoration; - EdgeDims padding; + EdgeInsets padding; if (tag == 'blockquote') { decoration = markdownStyle.blockquoteDecoration; - padding = new EdgeDims.all(markdownStyle.blockquotePadding); + padding = new EdgeInsets.all(markdownStyle.blockquotePadding); } else if (tag == 'pre') { decoration = markdownStyle.codeblockDecoration; - padding = new EdgeDims.all(markdownStyle.codeblockPadding); + padding = new EdgeInsets.all(markdownStyle.codeblockPadding); } return new Container( padding: padding, - margin: new EdgeDims.only(bottom: spacing), + margin: new EdgeInsets.only(bottom: spacing), child: contents, decoration: decoration ); diff --git a/packages/flutter_markdown/lib/src/markdown_style.dart b/packages/flutter_markdown/lib/src/markdown_style.dart index d71afce174..b2281b68c0 100644 --- a/packages/flutter_markdown/lib/src/markdown_style.dart +++ b/packages/flutter_markdown/lib/src/markdown_style.dart @@ -12,21 +12,21 @@ class MarkdownStyle extends MarkdownStyleRaw{ /// Creates a [MarkdownStyle] from the [TextStyle]s in the provided [theme]. MarkdownStyle.defaultFromTheme(ThemeData theme) : super( a: new TextStyle(color: Colors.blue[500]), - p: theme.text.body1, + p: theme.textTheme.body1, code: new TextStyle( color: Colors.grey[700], fontFamily: "monospace", - fontSize: theme.text.body1.fontSize * 0.85 + fontSize: theme.textTheme.body1.fontSize * 0.85 ), - h1: theme.text.headline, - h2: theme.text.title, - h3: theme.text.subhead, - h4: theme.text.body2, - h5: theme.text.body2, - h6: theme.text.body2, + h1: theme.textTheme.headline, + h2: theme.textTheme.title, + h3: theme.textTheme.subhead, + h4: theme.textTheme.body2, + h5: theme.textTheme.body2, + h6: theme.textTheme.body2, em: new TextStyle(fontStyle: FontStyle.italic), strong: new TextStyle(fontWeight: FontWeight.bold), - blockquote: theme.text.body1, + blockquote: theme.textTheme.body1, blockSpacing: 8.0, listIndent: 32.0, blockquotePadding: 8.0, @@ -46,21 +46,21 @@ class MarkdownStyle extends MarkdownStyleRaw{ /// [MarkdownStyle.defaultFromTheme]. MarkdownStyle.largeFromTheme(ThemeData theme) : super ( a: new TextStyle(color: Colors.blue[500]), - p: theme.text.body1, + p: theme.textTheme.body1, code: new TextStyle( color: Colors.grey[700], fontFamily: "monospace", - fontSize: theme.text.body1.fontSize * 0.85 + fontSize: theme.textTheme.body1.fontSize * 0.85 ), - h1: theme.text.display3, - h2: theme.text.display2, - h3: theme.text.display1, - h4: theme.text.headline, - h5: theme.text.title, - h6: theme.text.subhead, + h1: theme.textTheme.display3, + h2: theme.textTheme.display2, + h3: theme.textTheme.display1, + h4: theme.textTheme.headline, + h5: theme.textTheme.title, + h6: theme.textTheme.subhead, em: new TextStyle(fontStyle: FontStyle.italic), strong: new TextStyle(fontWeight: FontWeight.bold), - blockquote: theme.text.body1, + blockquote: theme.textTheme.body1, blockSpacing: 8.0, listIndent: 32.0, blockquotePadding: 8.0, diff --git a/packages/flutter_sprites/lib/src/sprite_widget.dart b/packages/flutter_sprites/lib/src/sprite_widget.dart index be362b652c..37336aff11 100644 --- a/packages/flutter_sprites/lib/src/sprite_widget.dart +++ b/packages/flutter_sprites/lib/src/sprite_widget.dart @@ -1,7 +1,7 @@ part of flutter_sprites; /// A widget that uses a [SpriteBox] to render a sprite node tree to the screen. -class SpriteWidget extends OneChildRenderObjectWidget { +class SpriteWidget extends SingleChildRenderObjectWidget { /// The rootNode of the sprite node tree. /// diff --git a/packages/flutter_test/lib/src/instrumentation.dart b/packages/flutter_test/lib/src/instrumentation.dart index f41554508f..b926465268 100644 --- a/packages/flutter_test/lib/src/instrumentation.dart +++ b/packages/flutter_test/lib/src/instrumentation.dart @@ -92,8 +92,8 @@ class Instrumentation { /// the given [runtimeType], if any. Returns null if there is no /// matching element. State findStateOfType(Type type) { - StatefulComponentElement element = findElement((Element element) { - return element is StatefulComponentElement && element.state.runtimeType == type; + StatefulElement element = findElement((Element element) { + return element is StatefulElement && element.state.runtimeType == type; }); return element?.state; } @@ -103,8 +103,8 @@ class Instrumentation { /// given configuration is not that of a stateful widget or if there /// is no matching element. State findStateByConfig(Widget config) { - StatefulComponentElement element = findElement((Element element) { - return element is StatefulComponentElement && element.state.config == config; + StatefulElement element = findElement((Element element) { + return element is StatefulElement && element.state.config == config; }); return element?.state; } diff --git a/packages/flutter_tools/lib/src/commands/analyze.dart b/packages/flutter_tools/lib/src/commands/analyze.dart index 206024655c..fb6e667b58 100644 --- a/packages/flutter_tools/lib/src/commands/analyze.dart +++ b/packages/flutter_tools/lib/src/commands/analyze.dart @@ -336,7 +336,7 @@ class AnalyzeCommand extends FlutterCommand { RegExp generalPattern = new RegExp(r'^\[(error|warning|hint|lint)\] (.+) \(([^(),]+), line ([0-9]+), col ([0-9]+)\)$'); RegExp allowedIdentifiersPattern = new RegExp(r'_?([A-Z]|_+)\b'); - RegExp classesWithOptionalTypeArgumentsPattern = new RegExp(r'\b(GlobalKey|State|ScrollableState|Element|StatelessComponentElement|TypeMatcher)\b'); + RegExp classesWithOptionalTypeArgumentsPattern = new RegExp(r'\b(GlobalKey|State|ScrollableState|Element|StatelessElement|TypeMatcher)\b'); RegExp constructorTearOffsPattern = new RegExp('.+#.+// analyzer doesn\'t like constructor tear-offs'); RegExp conflictingNamesPattern = new RegExp('^The imported libraries \'([^\']+)\' and \'([^\']+)\' cannot have the same name \'([^\']+)\'\$'); RegExp missingFilePattern = new RegExp('^Target of URI does not exist: \'([^\')]+)\'\$'); diff --git a/packages/flutter_tools/templates/create/lib/main.dart.tmpl b/packages/flutter_tools/templates/create/lib/main.dart.tmpl index f441a1f25f..c996477e36 100644 --- a/packages/flutter_tools/templates/create/lib/main.dart.tmpl +++ b/packages/flutter_tools/templates/create/lib/main.dart.tmpl @@ -19,7 +19,7 @@ void main() { ); } -class FlutterDemo extends StatefulComponent { +class FlutterDemo extends StatefulWidget { _FlutterDemoState createState() => new _FlutterDemoState(); } diff --git a/packages/playfair/lib/src/base.dart b/packages/playfair/lib/src/base.dart index 0dcfb9b650..8c03408732 100644 --- a/packages/playfair/lib/src/base.dart +++ b/packages/playfair/lib/src/base.dart @@ -41,7 +41,7 @@ const double kIndicatorStrokeWidth = 2.0; const Color kIndicatorColor = const Color(0xFFFF4081); const double kIndicatorMargin = 2.0; -class Chart extends StatelessComponent { +class Chart extends StatelessWidget { Chart({ Key key, this.data }) : super(key: key); final ChartData data;