Commit 2b126bcd authored by Adam Barth's avatar Adam Barth Committed by GitHub

Add Alignment, which will replace FractionalOffset (#12342)

Unlike FractionalOffset, Alignment uses the center as the zero of the
coordinate system, which makes the RTL math work out much cleaner.

Also, make FractionalOffset into a subclass of Alignment so that clients
can continue to use FractionalOffset.
parent 89566fee
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
/// painting boxes. /// painting boxes.
library painting; library painting;
export 'src/painting/alignment.dart';
export 'src/painting/basic_types.dart'; export 'src/painting/basic_types.dart';
export 'src/painting/border_radius.dart'; export 'src/painting/border_radius.dart';
export 'src/painting/borders.dart'; export 'src/painting/borders.dart';
......
...@@ -416,7 +416,7 @@ class _CupertinoLargeTitleNavigationBarSliverDelegate extends SliverPersistentHe ...@@ -416,7 +416,7 @@ class _CupertinoLargeTitleNavigationBarSliverDelegate extends SliverPersistentHe
child: new OverflowBox( child: new OverflowBox(
minHeight: 0.0, minHeight: 0.0,
maxHeight: double.INFINITY, maxHeight: double.INFINITY,
alignment: FractionalOffsetDirectional.bottomStart, alignment: AlignmentDirectional.bottomStart,
child: new Padding( child: new Padding(
padding: const EdgeInsetsDirectional.only( padding: const EdgeInsetsDirectional.only(
start: _kNavBarEdgePadding, start: _kNavBarEdgePadding,
......
...@@ -11,21 +11,21 @@ const double _kBackGestureWidth = 20.0; ...@@ -11,21 +11,21 @@ const double _kBackGestureWidth = 20.0;
const double _kMinFlingVelocity = 1.0; // Screen widths per second. const double _kMinFlingVelocity = 1.0; // Screen widths per second.
// Fractional offset from offscreen to the right to fully on screen. // Fractional offset from offscreen to the right to fully on screen.
final FractionalOffsetTween _kRightMiddleTween = new FractionalOffsetTween( final AlignmentTween _kRightMiddleTween = new AlignmentTween(
begin: FractionalOffset.topRight, begin: Alignment.centerRight * 2.0,
end: FractionalOffset.topLeft, end: Alignment.center,
); );
// Fractional offset from fully on screen to 1/3 offscreen to the left. // Fractional offset from fully on screen to 1/3 offscreen to the left.
final FractionalOffsetTween _kMiddleLeftTween = new FractionalOffsetTween( final AlignmentTween _kMiddleLeftTween = new AlignmentTween(
begin: FractionalOffset.topLeft, begin: Alignment.center,
end: const FractionalOffset(-1.0/3.0, 0.0), end: const Alignment(-2.0/3.0, 0.0),
); );
// Fractional offset from offscreen below to fully on screen. // Fractional offset from offscreen below to fully on screen.
final FractionalOffsetTween _kBottomUpTween = new FractionalOffsetTween( final AlignmentTween _kBottomUpTween = new AlignmentTween(
begin: FractionalOffset.bottomLeft, begin: Alignment.bottomCenter * 2.0,
end: FractionalOffset.topLeft, end: Alignment.center,
); );
// Custom decoration from no shadow to page shadow mimicking iOS page // Custom decoration from no shadow to page shadow mimicking iOS page
...@@ -35,8 +35,8 @@ final DecorationTween _kGradientShadowTween = new DecorationTween( ...@@ -35,8 +35,8 @@ final DecorationTween _kGradientShadowTween = new DecorationTween(
end: const _CupertinoEdgeShadowDecoration( end: const _CupertinoEdgeShadowDecoration(
edgeGradient: const LinearGradient( edgeGradient: const LinearGradient(
// Spans 5% of the page. // Spans 5% of the page.
begin: const FractionalOffset(0.95, 0.0), begin: const Alignment(0.90, 0.0),
end: FractionalOffset.topRight, end: Alignment.centerRight,
// Eyeballed gradient used to mimic a drop shadow on the left side only. // Eyeballed gradient used to mimic a drop shadow on the left side only.
colors: const <Color>[ colors: const <Color>[
const Color(0x00000000), const Color(0x00000000),
...@@ -318,9 +318,9 @@ class CupertinoPageTransition extends StatelessWidget { ...@@ -318,9 +318,9 @@ class CupertinoPageTransition extends StatelessWidget {
super(key: key); super(key: key);
// When this page is coming in to cover another page. // When this page is coming in to cover another page.
final Animation<FractionalOffset> _primaryPositionAnimation; final Animation<Alignment> _primaryPositionAnimation;
// When this page is becoming covered by another page. // When this page is becoming covered by another page.
final Animation<FractionalOffset> _secondaryPositionAnimation; final Animation<Alignment> _secondaryPositionAnimation;
final Animation<Decoration> _primaryShadowAnimation; final Animation<Decoration> _primaryShadowAnimation;
/// The widget below this widget in the tree. /// The widget below this widget in the tree.
...@@ -361,7 +361,7 @@ class CupertinoFullscreenDialogTransition extends StatelessWidget { ...@@ -361,7 +361,7 @@ class CupertinoFullscreenDialogTransition extends StatelessWidget {
), ),
super(key: key); super(key: key);
final Animation<FractionalOffset> _positionAnimation; final Animation<Alignment> _positionAnimation;
/// The widget below this widget in the tree. /// The widget below this widget in the tree.
final Widget child; final Widget child;
...@@ -562,7 +562,7 @@ class _CupertinoEdgeShadowDecoration extends Decoration { ...@@ -562,7 +562,7 @@ class _CupertinoEdgeShadowDecoration extends Decoration {
const _CupertinoEdgeShadowDecoration(); const _CupertinoEdgeShadowDecoration();
/// A gradient to draw to the left of the box being decorated. /// A gradient to draw to the left of the box being decorated.
/// FractionalOffsets are relative to the original box translated one box /// Alignments are relative to the original box translated one box
/// width to the left. /// width to the left.
final LinearGradient edgeGradient; final LinearGradient edgeGradient;
......
...@@ -145,7 +145,7 @@ class _CupertinoTabScaffoldState extends State<CupertinoTabScaffold> { ...@@ -145,7 +145,7 @@ class _CupertinoTabScaffoldState extends State<CupertinoTabScaffold> {
if (widget.tabBar != null) { if (widget.tabBar != null) {
stacked.add(new Align( stacked.add(new Align(
alignment: FractionalOffset.bottomCenter, alignment: Alignment.bottomCenter,
// Override the tab bar's currentIndex to the current tab and hook in // Override the tab bar's currentIndex to the current tab and hook in
// our own listener to update the _currentPage on top of a possibly user // our own listener to update the _currentPage on top of a possibly user
// provided callback. // provided callback.
......
...@@ -448,7 +448,7 @@ class _AppBarState extends State<AppBar> { ...@@ -448,7 +448,7 @@ class _AppBarState extends State<AppBar> {
} }
appBar = new Align( appBar = new Align(
alignment: FractionalOffset.topCenter, alignment: Alignment.topCenter,
child: appBar, child: appBar,
); );
......
...@@ -215,14 +215,14 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr ...@@ -215,14 +215,14 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
return (leftWeights + _flex(_animations[index]) / 2.0) / allWeights; return (leftWeights + _flex(_animations[index]) / 2.0) / allWeights;
} }
FractionalOffset _circleOffset(int index) { Alignment _circleOffset(int index) {
final double iconSize = widget.iconSize; final double iconSize = widget.iconSize;
final Tween<double> yOffsetTween = new Tween<double>( final Tween<double> yOffsetTween = new Tween<double>(
begin: (18.0 + iconSize / 2.0) / kBottomNavigationBarHeight, // 18dp + icon center begin: (18.0 + iconSize / 2.0) / kBottomNavigationBarHeight, // 18dp + icon center
end: (6.0 + iconSize / 2.0) / kBottomNavigationBarHeight // 6dp + icon center end: (6.0 + iconSize / 2.0) / kBottomNavigationBarHeight // 6dp + icon center
); );
return new FractionalOffset( return new Alignment(
_xOffset(index), _xOffset(index),
yOffsetTween.evaluate(_animations[index]) yOffsetTween.evaluate(_animations[index])
); );
...@@ -283,10 +283,10 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr ...@@ -283,10 +283,10 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
widget.onTap(i); widget.onTap(i);
}, },
child: new Stack( child: new Stack(
alignment: FractionalOffset.center, alignment: Alignment.center,
children: <Widget>[ children: <Widget>[
new Align( new Align(
alignment: FractionalOffset.topCenter, alignment: Alignment.topCenter,
child: new Container( child: new Container(
margin: new EdgeInsets.only( margin: new EdgeInsets.only(
top: new Tween<double>( top: new Tween<double>(
...@@ -304,7 +304,7 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr ...@@ -304,7 +304,7 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
), ),
), ),
new Align( new Align(
alignment: FractionalOffset.bottomCenter, alignment: Alignment.bottomCenter,
child: new Container( child: new Container(
margin: const EdgeInsets.only(bottom: 10.0), margin: const EdgeInsets.only(bottom: 10.0),
child: DefaultTextStyle.merge( child: DefaultTextStyle.merge(
...@@ -319,7 +319,7 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr ...@@ -319,7 +319,7 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
end: 1.0, end: 1.0,
).evaluate(_animations[i]), ).evaluate(_animations[i]),
)), )),
alignment: FractionalOffset.bottomCenter, alignment: Alignment.bottomCenter,
child: widget.items[i].title, child: widget.items[i].title,
), ),
), ),
...@@ -352,10 +352,10 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr ...@@ -352,10 +352,10 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
widget.onTap(i); widget.onTap(i);
}, },
child: new Stack( child: new Stack(
alignment: FractionalOffset.center, alignment: Alignment.center,
children: <Widget>[ children: <Widget>[
new Align( new Align(
alignment: FractionalOffset.topCenter, alignment: Alignment.topCenter,
child: new Container( child: new Container(
margin: new EdgeInsets.only( margin: new EdgeInsets.only(
top: new Tween<double>( top: new Tween<double>(
...@@ -373,7 +373,7 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr ...@@ -373,7 +373,7 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
), ),
), ),
new Align( new Align(
alignment: FractionalOffset.bottomCenter, alignment: Alignment.bottomCenter,
child: new Container( child: new Container(
margin: const EdgeInsets.only(bottom: 10.0), margin: const EdgeInsets.only(bottom: 10.0),
child: new FadeTransition( child: new FadeTransition(
...@@ -465,7 +465,7 @@ class _Circle { ...@@ -465,7 +465,7 @@ class _Circle {
AnimationController controller; AnimationController controller;
CurvedAnimation animation; CurvedAnimation animation;
FractionalOffset get offset { Alignment get offset {
return state._circleOffset(index); return state._circleOffset(index);
} }
...@@ -487,11 +487,13 @@ class _RadialPainter extends CustomPainter { ...@@ -487,11 +487,13 @@ class _RadialPainter extends CustomPainter {
// bounding rectangle's corners touches the egde of the circle. Drawing a // bounding rectangle's corners touches the egde of the circle. Drawing a
// circle beyond this radius is futile since there is no perceivable // circle beyond this radius is futile since there is no perceivable
// difference within the cropped rectangle. // difference within the cropped rectangle.
double _maxRadius(FractionalOffset offset, Size size) { double _maxRadius(Alignment alignment, Size size) {
final double dx = offset.dx; final double dx = alignment.x;
final double dy = offset.dy; final double dy = alignment.y;
final double x = (dx > 0.5 ? dx : 1.0 - dx) * size.width; final double halfWidth = size.width / 2.0;
final double y = (dy > 0.5 ? dy : 1.0 - dy) * size.height; final double halfHeight = size.height / 2.0;
final double x = halfWidth + dx.abs() * halfWidth;
final double y = halfHeight + dy.abs() * halfHeight;
return math.sqrt(x * x + y * y); return math.sqrt(x * x + y * y);
} }
...@@ -517,20 +519,22 @@ class _RadialPainter extends CustomPainter { ...@@ -517,20 +519,22 @@ class _RadialPainter extends CustomPainter {
for (_Circle circle in circles) { for (_Circle circle in circles) {
final Tween<double> radiusTween = new Tween<double>( final Tween<double> radiusTween = new Tween<double>(
begin: 0.0, begin: 0.0,
end: _maxRadius(circle.offset, size) end: _maxRadius(circle.offset, size),
); );
final Paint paint = new Paint()..color = circle.color; final Paint paint = new Paint()..color = circle.color;
final Rect rect = new Rect.fromLTWH(0.0, 0.0, size.width, size.height); final Rect rect = new Rect.fromLTWH(0.0, 0.0, size.width, size.height);
canvas.clipRect(rect); canvas.clipRect(rect);
final double navWidth = math.min(bottomNavMaxWidth, size.width); final double navWidth = math.min(bottomNavMaxWidth, size.width);
final double halfNavWidth = navWidth / 2.0;
final double halfHeight = size.height / 2.0;
final Offset center = new Offset( final Offset center = new Offset(
(size.width - navWidth) / 2.0 + circle.offset.dx * navWidth, (size.width - navWidth) / 2.0 + halfNavWidth + circle.offset.x * halfNavWidth,
circle.offset.dy * size.height halfHeight + circle.offset.y * halfHeight,
); );
canvas.drawCircle( canvas.drawCircle(
center, center,
radiusTween.lerp(circle.animation.value), radiusTween.lerp(circle.animation.value),
paint paint,
); );
} }
} }
......
...@@ -408,7 +408,7 @@ class DataTable extends StatelessWidget { ...@@ -408,7 +408,7 @@ class DataTable extends StatelessWidget {
label = new Container( label = new Container(
padding: padding, padding: padding,
height: _kHeadingRowHeight, height: _kHeadingRowHeight,
alignment: numeric ? FractionalOffset.centerRight : FractionalOffsetDirectional.centerStart, alignment: numeric ? Alignment.centerRight : AlignmentDirectional.centerStart,
child: new AnimatedDefaultTextStyle( child: new AnimatedDefaultTextStyle(
style: new TextStyle( style: new TextStyle(
// TODO(ianh): font family should be Roboto; see https://github.com/flutter/flutter/issues/3116 // TODO(ianh): font family should be Roboto; see https://github.com/flutter/flutter/issues/3116
...@@ -460,7 +460,7 @@ class DataTable extends StatelessWidget { ...@@ -460,7 +460,7 @@ class DataTable extends StatelessWidget {
label = new Container( label = new Container(
padding: padding, padding: padding,
height: _kDataRowHeight, height: _kDataRowHeight,
alignment: numeric ? FractionalOffset.centerRight : FractionalOffsetDirectional.centerStart, alignment: numeric ? Alignment.centerRight : AlignmentDirectional.centerStart,
child: new DefaultTextStyle( child: new DefaultTextStyle(
style: new TextStyle( style: new TextStyle(
// TODO(ianh): font family should be Roboto; see https://github.com/flutter/flutter/issues/3116 // TODO(ianh): font family should be Roboto; see https://github.com/flutter/flutter/issues/3116
...@@ -774,7 +774,7 @@ class _SortArrowState extends State<_SortArrow> with TickerProviderStateMixin { ...@@ -774,7 +774,7 @@ class _SortArrowState extends State<_SortArrow> with TickerProviderStateMixin {
child: new Transform( child: new Transform(
transform: new Matrix4.rotationZ(_orientationOffset + _orientationAnimation.value) transform: new Matrix4.rotationZ(_orientationOffset + _orientationAnimation.value)
..setTranslationRaw(0.0, _kArrowIconBaselineOffset, 0.0), ..setTranslationRaw(0.0, _kArrowIconBaselineOffset, 0.0),
alignment: FractionalOffset.center, alignment: Alignment.center,
child: new Icon( child: new Icon(
Icons.arrow_downward, Icons.arrow_downward,
size: _kArrowIconSize, size: _kArrowIconSize,
......
...@@ -267,7 +267,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro ...@@ -267,7 +267,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
Widget _buildDrawer(BuildContext context) { Widget _buildDrawer(BuildContext context) {
if (_controller.status == AnimationStatus.dismissed) { if (_controller.status == AnimationStatus.dismissed) {
return new Align( return new Align(
alignment: FractionalOffsetDirectional.centerStart, alignment: AlignmentDirectional.centerStart,
child: new GestureDetector( child: new GestureDetector(
key: _gestureDetectorKey, key: _gestureDetectorKey,
onHorizontalDragUpdate: _move, onHorizontalDragUpdate: _move,
...@@ -299,9 +299,9 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro ...@@ -299,9 +299,9 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
), ),
), ),
new Align( new Align(
alignment: FractionalOffsetDirectional.centerStart, alignment: AlignmentDirectional.centerStart,
child: new Align( child: new Align(
alignment: FractionalOffsetDirectional.centerEnd, alignment: AlignmentDirectional.centerEnd,
widthFactor: _controller.value, widthFactor: _controller.value,
child: new RepaintBoundary( child: new RepaintBoundary(
child: new FocusScope( child: new FocusScope(
......
...@@ -361,7 +361,7 @@ class DropdownMenuItem<T> extends StatelessWidget { ...@@ -361,7 +361,7 @@ class DropdownMenuItem<T> extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Container( return new Container(
height: _kMenuItemHeight, height: _kMenuItemHeight,
alignment: FractionalOffset.centerLeft, alignment: Alignment.centerLeft,
child: child, child: child,
); );
} }
...@@ -589,7 +589,7 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> with WidgetsBindi ...@@ -589,7 +589,7 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> with WidgetsBindi
// the hint or nothing at all. // the hint or nothing at all.
new IndexedStack( new IndexedStack(
index: _selectedIndex ?? hintIndex, index: _selectedIndex ?? hintIndex,
alignment: FractionalOffset.centerLeft, alignment: Alignment.centerLeft,
children: items, children: items,
), ),
new Icon(Icons.arrow_drop_down, new Icon(Icons.arrow_drop_down,
......
...@@ -92,16 +92,16 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> { ...@@ -92,16 +92,16 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
return null; return null;
} }
FractionalOffset _getTitleAlignment(bool effectiveCenterTitle) { Alignment _getTitleAlignment(bool effectiveCenterTitle) {
if (effectiveCenterTitle) if (effectiveCenterTitle)
return FractionalOffset.bottomCenter; return Alignment.bottomCenter;
final TextDirection textDirection = Directionality.of(context); final TextDirection textDirection = Directionality.of(context);
assert(textDirection != null); assert(textDirection != null);
switch (textDirection) { switch (textDirection) {
case TextDirection.rtl: case TextDirection.rtl:
return FractionalOffset.bottomRight; return Alignment.bottomRight;
case TextDirection.ltr: case TextDirection.ltr:
return FractionalOffset.bottomLeft; return Alignment.bottomLeft;
} }
return null; return null;
} }
...@@ -152,7 +152,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> { ...@@ -152,7 +152,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
final double scaleValue = new Tween<double>(begin: 1.5, end: 1.0).lerp(t); final double scaleValue = new Tween<double>(begin: 1.5, end: 1.0).lerp(t);
final Matrix4 scaleTransform = new Matrix4.identity() final Matrix4 scaleTransform = new Matrix4.identity()
..scale(scaleValue, scaleValue, 1.0); ..scale(scaleValue, scaleValue, 1.0);
final FractionalOffset titleAlignment = _getTitleAlignment(effectiveCenterTitle); final Alignment titleAlignment = _getTitleAlignment(effectiveCenterTitle);
children.add(new Container( children.add(new Container(
padding: new EdgeInsetsDirectional.only( padding: new EdgeInsetsDirectional.only(
start: effectiveCenterTitle ? 0.0 : 72.0, start: effectiveCenterTitle ? 0.0 : 72.0,
......
...@@ -73,7 +73,7 @@ class IconButton extends StatelessWidget { ...@@ -73,7 +73,7 @@ class IconButton extends StatelessWidget {
Key key, Key key,
this.iconSize: 24.0, this.iconSize: 24.0,
this.padding: const EdgeInsets.all(8.0), this.padding: const EdgeInsets.all(8.0),
this.alignment: FractionalOffset.center, this.alignment: Alignment.center,
@required this.icon, @required this.icon,
this.color, this.color,
this.highlightColor, this.highlightColor,
...@@ -107,8 +107,8 @@ class IconButton extends StatelessWidget { ...@@ -107,8 +107,8 @@ class IconButton extends StatelessWidget {
/// Defines how the icon is positioned within the IconButton. /// Defines how the icon is positioned within the IconButton.
/// ///
/// This property must not be null. It defaults to [FractionalOffset.center]. /// This property must not be null. It defaults to [Alignment.center].
final FractionalOffsetGeometry alignment; final AlignmentGeometry alignment;
/// The icon to display inside the button. /// The icon to display inside the button.
/// ///
......
...@@ -397,7 +397,7 @@ class ListTile extends StatelessWidget { ...@@ -397,7 +397,7 @@ class ListTile extends StatelessWidget {
child: new Container( child: new Container(
margin: const EdgeInsetsDirectional.only(end: 16.0), margin: const EdgeInsetsDirectional.only(end: 16.0),
width: 40.0, width: 40.0,
alignment: FractionalOffsetDirectional.centerStart, alignment: AlignmentDirectional.centerStart,
child: leading, child: leading,
), ),
)); ));
...@@ -432,7 +432,7 @@ class ListTile extends StatelessWidget { ...@@ -432,7 +432,7 @@ class ListTile extends StatelessWidget {
data: iconThemeData, data: iconThemeData,
child: new Container( child: new Container(
margin: const EdgeInsetsDirectional.only(start: 16.0), margin: const EdgeInsetsDirectional.only(start: 16.0),
alignment: FractionalOffsetDirectional.centerEnd, alignment: AlignmentDirectional.centerEnd,
child: trailing, child: trailing,
), ),
)); ));
......
...@@ -9,9 +9,9 @@ import 'package:flutter/widgets.dart'; ...@@ -9,9 +9,9 @@ import 'package:flutter/widgets.dart';
import 'theme.dart'; import 'theme.dart';
// Fractional offset from 1/4 screen below the top to fully on screen. // Fractional offset from 1/4 screen below the top to fully on screen.
final FractionalOffsetTween _kBottomUpTween = new FractionalOffsetTween( final AlignmentTween _kBottomUpTween = new AlignmentTween(
begin: FractionalOffset.bottomLeft, begin: Alignment.bottomCenter * 0.5,
end: FractionalOffset.topLeft end: Alignment.center
); );
// Used for Android and Fuchsia. // Used for Android and Fuchsia.
...@@ -26,7 +26,7 @@ class _MountainViewPageTransition extends StatelessWidget { ...@@ -26,7 +26,7 @@ class _MountainViewPageTransition extends StatelessWidget {
)), )),
super(key: key); super(key: key);
final Animation<FractionalOffset> _positionAnimation; final Animation<Alignment> _positionAnimation;
final Widget child; final Widget child;
@override @override
......
...@@ -447,7 +447,7 @@ class _PopupMenu<T> extends StatelessWidget { ...@@ -447,7 +447,7 @@ class _PopupMenu<T> extends StatelessWidget {
type: MaterialType.card, type: MaterialType.card,
elevation: route.elevation, elevation: route.elevation,
child: new Align( child: new Align(
alignment: FractionalOffset.topRight, alignment: Alignment.topRight,
widthFactor: width.evaluate(route.animation), widthFactor: width.evaluate(route.animation),
heightFactor: height.evaluate(route.animation), heightFactor: height.evaluate(route.animation),
child: child, child: child,
......
...@@ -384,15 +384,15 @@ class RefreshIndicatorState extends State<RefreshIndicator> with TickerProviderS ...@@ -384,15 +384,15 @@ class RefreshIndicatorState extends State<RefreshIndicator> with TickerProviderS
left: 0.0, left: 0.0,
right: 0.0, right: 0.0,
child: new SizeTransition( child: new SizeTransition(
axisAlignment: _isIndicatorAtTop ? 1.0 : 0.0, axisAlignment: _isIndicatorAtTop ? 1.0 : -1.0,
sizeFactor: _positionFactor, // this is what brings it down sizeFactor: _positionFactor, // this is what brings it down
child: new Container( child: new Container(
padding: _isIndicatorAtTop padding: _isIndicatorAtTop
? new EdgeInsets.only(top: widget.displacement) ? new EdgeInsets.only(top: widget.displacement)
: new EdgeInsets.only(bottom: widget.displacement), : new EdgeInsets.only(bottom: widget.displacement),
alignment: _isIndicatorAtTop alignment: _isIndicatorAtTop
? FractionalOffset.topCenter ? Alignment.topCenter
: FractionalOffset.bottomCenter, : Alignment.bottomCenter,
child: new ScaleTransition( child: new ScaleTransition(
scale: _scaleFactor, scale: _scaleFactor,
child: new AnimatedBuilder( child: new AnimatedBuilder(
......
...@@ -898,7 +898,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin { ...@@ -898,7 +898,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
bottomSheets.add(_currentBottomSheet._widget); bottomSheets.add(_currentBottomSheet._widget);
final Widget stack = new Stack( final Widget stack = new Stack(
children: bottomSheets, children: bottomSheets,
alignment: FractionalOffset.bottomCenter, alignment: Alignment.bottomCenter,
); );
_addIfNonNull( _addIfNonNull(
children, children,
...@@ -1053,7 +1053,7 @@ class _PersistentBottomSheetState extends State<_PersistentBottomSheet> { ...@@ -1053,7 +1053,7 @@ class _PersistentBottomSheetState extends State<_PersistentBottomSheet> {
animation: widget.animationController, animation: widget.animationController,
builder: (BuildContext context, Widget child) { builder: (BuildContext context, Widget child) {
return new Align( return new Align(
alignment: FractionalOffsetDirectional.topStart, alignment: AlignmentDirectional.topStart,
heightFactor: widget.animationController.value, heightFactor: widget.animationController.value,
child: child child: child
); );
......
...@@ -82,7 +82,7 @@ class SnackBarAction extends StatefulWidget { ...@@ -82,7 +82,7 @@ class SnackBarAction extends StatefulWidget {
const SnackBarAction({ const SnackBarAction({
Key key, Key key,
@required this.label, @required this.label,
@required this.onPressed @required this.onPressed,
}) : assert(label != null), }) : assert(label != null),
assert(onPressed != null), assert(onPressed != null),
super(key: key); super(key: key);
...@@ -117,7 +117,7 @@ class _SnackBarActionState extends State<SnackBarAction> { ...@@ -117,7 +117,7 @@ class _SnackBarActionState extends State<SnackBarAction> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new FlatButton( return new FlatButton(
onPressed: _haveTriggeredAction ? null : _handlePressed, onPressed: _haveTriggeredAction ? null : _handlePressed,
child: new Text(widget.label) child: new Text(widget.label),
); );
} }
} }
...@@ -192,7 +192,7 @@ class SnackBar extends StatelessWidget { ...@@ -192,7 +192,7 @@ class SnackBar extends StatelessWidget {
final ThemeData darkTheme = new ThemeData( final ThemeData darkTheme = new ThemeData(
brightness: Brightness.dark, brightness: Brightness.dark,
accentColor: theme.accentColor, accentColor: theme.accentColor,
accentColorBrightness: theme.accentColorBrightness accentColorBrightness: theme.accentColorBrightness,
); );
final List<Widget> children = <Widget>[ final List<Widget> children = <Widget>[
const SizedBox(width: _kSnackBarPadding), const SizedBox(width: _kSnackBarPadding),
...@@ -202,15 +202,15 @@ class SnackBar extends StatelessWidget { ...@@ -202,15 +202,15 @@ class SnackBar extends StatelessWidget {
child: new DefaultTextStyle( child: new DefaultTextStyle(
style: darkTheme.textTheme.subhead, style: darkTheme.textTheme.subhead,
child: content, child: content,
) ),
) ),
) ),
]; ];
if (action != null) { if (action != null) {
children.add(new ButtonTheme.bar( children.add(new ButtonTheme.bar(
padding: const EdgeInsets.symmetric(horizontal: _kSnackBarPadding), padding: const EdgeInsets.symmetric(horizontal: _kSnackBarPadding),
textTheme: ButtonTextTheme.accent, textTheme: ButtonTextTheme.accent,
child: action child: action,
)); ));
} else { } else {
children.add(const SizedBox(width: _kSnackBarPadding)); children.add(const SizedBox(width: _kSnackBarPadding));
...@@ -222,9 +222,9 @@ class SnackBar extends StatelessWidget { ...@@ -222,9 +222,9 @@ class SnackBar extends StatelessWidget {
animation: heightAnimation, animation: heightAnimation,
builder: (BuildContext context, Widget child) { builder: (BuildContext context, Widget child) {
return new Align( return new Align(
alignment: FractionalOffsetDirectional.topStart, alignment: AlignmentDirectional.topStart,
heightFactor: heightAnimation.value, heightFactor: heightAnimation.value,
child: child child: child,
); );
}, },
child: new Semantics( child: new Semantics(
...@@ -245,14 +245,14 @@ class SnackBar extends StatelessWidget { ...@@ -245,14 +245,14 @@ class SnackBar extends StatelessWidget {
opacity: fadeAnimation, opacity: fadeAnimation,
child: new Row( child: new Row(
children: children, children: children,
crossAxisAlignment: CrossAxisAlignment.center crossAxisAlignment: CrossAxisAlignment.center,
) ),
) ),
) ),
) ),
) ),
) ),
) ),
); );
} }
...@@ -278,7 +278,7 @@ class SnackBar extends StatelessWidget { ...@@ -278,7 +278,7 @@ class SnackBar extends StatelessWidget {
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
action: action, action: action,
duration: duration, duration: duration,
animation: newAnimation animation: newAnimation,
); );
} }
} }
...@@ -297,7 +297,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin { ...@@ -297,7 +297,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
color: _isDark() ? _kErrorDark : _kErrorLight, color: _isDark() ? _kErrorDark : _kErrorLight,
), ),
child: new Align( child: new Align(
alignment: const FractionalOffset(0.5, 0.9), // 0.9 looks better than the geometrical 0.66. alignment: const Alignment(0.0, 0.8), // 0.8 looks better than the geometrical 0.33.
child: _buildCircleChild(index, oldState && widget.steps[index].state != StepState.error), child: _buildCircleChild(index, oldState && widget.steps[index].state != StepState.error),
), ),
), ),
......
...@@ -70,7 +70,7 @@ class _AccountDetails extends StatelessWidget { ...@@ -70,7 +70,7 @@ class _AccountDetails extends StatelessWidget {
Widget addDropdownIcon(Widget line) { Widget addDropdownIcon(Widget line) {
final Widget icon = new Expanded( final Widget icon = new Expanded(
child: new Align( child: new Align(
alignment: FractionalOffsetDirectional.centerEnd, alignment: AlignmentDirectional.centerEnd,
child: new Icon( child: new Icon(
isOpen ? Icons.arrow_drop_up : Icons.arrow_drop_down, isOpen ? Icons.arrow_drop_up : Icons.arrow_drop_down,
color: Colors.white color: Colors.white
......
This diff is collapsed.
...@@ -98,9 +98,9 @@ class FittedSizes { ...@@ -98,9 +98,9 @@ class FittedSizes {
/// This method does not express an opinion regarding the alignment of the /// This method does not express an opinion regarding the alignment of the
/// source and destination sizes within the input and output rectangles. /// source and destination sizes within the input and output rectangles.
/// Typically they are centered (this is what [BoxDecoration] does, for /// Typically they are centered (this is what [BoxDecoration] does, for
/// instance, and is how [BoxFit] is defined). The [FractionalOffset] class /// instance, and is how [BoxFit] is defined). The [Alignment] class provides a
/// provides a convenience function, [FractionalOffset.inscribe], for resolving /// convenience function, [Alignment.inscribe], for resolving the sizes to
/// the sizes to rects, as shown in the example below. /// rects, as shown in the example below.
/// ///
/// ## Sample code /// ## Sample code
/// ///
...@@ -112,8 +112,8 @@ class FittedSizes { ...@@ -112,8 +112,8 @@ class FittedSizes {
/// void paintImage(ui.Image image, Rect outputRect, Canvas canvas, Paint paint, BoxFit fit) { /// void paintImage(ui.Image image, Rect outputRect, Canvas canvas, Paint paint, BoxFit fit) {
/// final Size imageSize = new Size(image.width.toDouble(), image.height.toDouble()); /// final Size imageSize = new Size(image.width.toDouble(), image.height.toDouble());
/// final FittedSizes sizes = applyBoxFit(fit, imageSize, outputRect.size); /// final FittedSizes sizes = applyBoxFit(fit, imageSize, outputRect.size);
/// final Rect inputSubrect = FractionalOffset.center.inscribe(sizes.source, Offset.zero & imageSize); /// final Rect inputSubrect = Alignment.center.inscribe(sizes.source, Offset.zero & imageSize);
/// final Rect outputSubrect = FractionalOffset.center.inscribe(sizes.destination, outputRect); /// final Rect outputSubrect = Alignment.center.inscribe(sizes.destination, outputRect);
/// canvas.drawImageRect(image, inputSubrect, outputSubrect, paint); /// canvas.drawImageRect(image, inputSubrect, outputSubrect, paint);
/// } /// }
/// ``` /// ```
......
...@@ -9,11 +9,11 @@ import 'dart:ui' as ui show Gradient, TextBox, lerpDouble; ...@@ -9,11 +9,11 @@ import 'dart:ui' as ui show Gradient, TextBox, lerpDouble;
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'alignment.dart';
import 'basic_types.dart'; import 'basic_types.dart';
import 'box_fit.dart'; import 'box_fit.dart';
import 'decoration.dart'; import 'decoration.dart';
import 'edge_insets.dart'; import 'edge_insets.dart';
import 'fractional_offset.dart';
import 'text_painter.dart'; import 'text_painter.dart';
import 'text_span.dart'; import 'text_span.dart';
import 'text_style.dart'; import 'text_style.dart';
...@@ -397,7 +397,7 @@ class _FlutterLogoPainter extends BoxPainter { ...@@ -397,7 +397,7 @@ class _FlutterLogoPainter extends BoxPainter {
} }
final FittedSizes fittedSize = applyBoxFit(BoxFit.contain, logoSize, canvasSize); final FittedSizes fittedSize = applyBoxFit(BoxFit.contain, logoSize, canvasSize);
assert(fittedSize.source == logoSize); assert(fittedSize.source == logoSize);
final Rect rect = FractionalOffset.center.inscribe(fittedSize.destination, offset & canvasSize); final Rect rect = Alignment.center.inscribe(fittedSize.destination, offset & canvasSize);
final double centerSquareHeight = canvasSize.shortestSide; final double centerSquareHeight = canvasSize.shortestSide;
final Rect centerSquare = new Rect.fromLTWH( final Rect centerSquare = new Rect.fromLTWH(
offset.dx + (canvasSize.width - centerSquareHeight) / 2.0, offset.dx + (canvasSize.width - centerSquareHeight) / 2.0,
......
...@@ -6,8 +6,8 @@ import 'dart:ui' as ui show Gradient, lerpDouble; ...@@ -6,8 +6,8 @@ import 'dart:ui' as ui show Gradient, lerpDouble;
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'alignment.dart';
import 'basic_types.dart'; import 'basic_types.dart';
import 'fractional_offset.dart';
/// A 2D gradient. /// A 2D gradient.
/// ///
...@@ -27,7 +27,7 @@ abstract class Gradient { ...@@ -27,7 +27,7 @@ abstract class Gradient {
/// Creates a [Shader] for this gradient to fill the given rect. /// Creates a [Shader] for this gradient to fill the given rect.
/// ///
/// If the gradient's configuration is text-direction-dependent, for example /// If the gradient's configuration is text-direction-dependent, for example
/// it uses [FractionalOffsetDirectional] objects instead of [FractionalOffset] /// it uses [AlignmentDirectional] objects instead of [Alignment]
/// objects, then the `textDirection` argument must not be null. /// objects, then the `textDirection` argument must not be null.
Shader createShader(Rect rect, { TextDirection textDirection }); Shader createShader(Rect rect, { TextDirection textDirection });
} }
...@@ -64,8 +64,8 @@ abstract class Gradient { ...@@ -64,8 +64,8 @@ abstract class Gradient {
/// new Container( /// new Container(
/// decoration: new BoxDecoration( /// decoration: new BoxDecoration(
/// gradient: new LinearGradient( /// gradient: new LinearGradient(
/// begin: FractionalOffset.topLeft, /// begin: Alignment.topLeft,
/// end: new FractionalOffset(0.1, 0.0), // 10% of the width, so there are ten blinds. /// end: new Alignment(0.8, 0.0), // 10% of the width, so there are ten blinds.
/// colors: [const Color(0xFFFFFFEE), const Color(0xFF999999)], // whitish to gray /// colors: [const Color(0xFFFFFFEE), const Color(0xFF999999)], // whitish to gray
/// tileMode: TileMode.repeated, // repeats the gradient over the canvas /// tileMode: TileMode.repeated, // repeats the gradient over the canvas
/// ), /// ),
...@@ -85,8 +85,8 @@ class LinearGradient extends Gradient { ...@@ -85,8 +85,8 @@ class LinearGradient extends Gradient {
/// The [colors] argument must not be null. If [stops] is non-null, it must /// The [colors] argument must not be null. If [stops] is non-null, it must
/// have the same length as [colors]. /// have the same length as [colors].
const LinearGradient({ const LinearGradient({
this.begin: FractionalOffset.centerLeft, this.begin: Alignment.centerLeft,
this.end: FractionalOffset.centerRight, this.end: Alignment.centerRight,
@required this.colors, @required this.colors,
this.stops, this.stops,
this.tileMode: TileMode.clamp, this.tileMode: TileMode.clamp,
...@@ -97,35 +97,33 @@ class LinearGradient extends Gradient { ...@@ -97,35 +97,33 @@ class LinearGradient extends Gradient {
/// The offset at which stop 0.0 of the gradient is placed. /// The offset at which stop 0.0 of the gradient is placed.
/// ///
/// If this is a [FractionalOffset], then it is expressed as a vector from /// If this is a [Alignment], then it is expressed as a vector from
/// coordinate (0.0,0.0), in a coordinate space that maps the top left of the /// coordinate (0.0, 0.0), in a coordinate space that maps the center of the
/// paint box at (0.0,0.0) and the bottom right at (1.0,1.0). /// paint box at (0.0, 0.0) and the bottom right at (1.0, 1.0).
/// ///
/// For example, a begin offset of (0.0,0.5) is half way down the /// For example, a begin offset of (-1.0, 0.0) is half way down the
/// left side of the box. /// left side of the box.
/// ///
/// It can also be a [FractionalOffsetDirectional], in which case it is /// It can also be a [AlignmentDirectional], where the start is the
/// expressed as a vector from the top start corner, where the start is the
/// left in left-to-right contexts and the right in right-to-left contexts. If /// left in left-to-right contexts and the right in right-to-left contexts. If
/// a text-direction-dependent value is provided here, then the [createShader] /// a text-direction-dependent value is provided here, then the [createShader]
/// method will need to be given a [TextDirection]. /// method will need to be given a [TextDirection].
final FractionalOffsetGeometry begin; final AlignmentGeometry begin;
/// The offset at which stop 1.0 of the gradient is placed. /// The offset at which stop 1.0 of the gradient is placed.
/// ///
/// If this is a [FractionalOffset], then it is expressed as a vector from /// If this is a [Alignment], then it is expressed as a vector from
/// coordinate (0.0,0.0), in a coordinate space that maps the top left of the /// coordinate (0.0, 0.0), in a coordinate space that maps the center of the
/// paint box at (0.0,0.0) and the bottom right at (1.0,1.0). /// paint box at (0.0, 0.0) and the bottom right at (1.0, 1.0).
/// ///
/// For example, a begin offset of (1.0,0.5) is half way down the /// For example, a begin offset of (1.0, 0.0) is half way down the
/// right side of the box. /// right side of the box.
/// ///
/// It can also be a [FractionalOffsetDirectional], in which case it is /// It can also be a [AlignmentDirectional], where the start is the left in
/// expressed as a vector from the top start corner, where the start is the /// left-to-right contexts and the right in right-to-left contexts. If a
/// left in left-to-right contexts and the right in right-to-left contexts. If /// text-direction-dependent value is provided here, then the [createShader]
/// a text-direction-dependent value is provided here, then the [createShader]
/// method will need to be given a [TextDirection]. /// method will need to be given a [TextDirection].
final FractionalOffsetGeometry end; final AlignmentGeometry end;
/// The colors the gradient should obtain at each of the stops. /// The colors the gradient should obtain at each of the stops.
/// ///
...@@ -215,8 +213,8 @@ class LinearGradient extends Gradient { ...@@ -215,8 +213,8 @@ class LinearGradient extends Gradient {
interpolatedStops = a.stops ?? b.stops; interpolatedStops = a.stops ?? b.stops;
} }
return new LinearGradient( return new LinearGradient(
begin: FractionalOffsetGeometry.lerp(a.begin, b.begin, t), begin: AlignmentGeometry.lerp(a.begin, b.begin, t),
end: FractionalOffsetGeometry.lerp(a.end, b.end, t), end: AlignmentGeometry.lerp(a.end, b.end, t),
colors: interpolatedColors, colors: interpolatedColors,
stops: interpolatedStops, stops: interpolatedStops,
tileMode: t < 0.5 ? a.tileMode : b.tileMode, tileMode: t < 0.5 ? a.tileMode : b.tileMode,
...@@ -295,7 +293,7 @@ class LinearGradient extends Gradient { ...@@ -295,7 +293,7 @@ class LinearGradient extends Gradient {
/// ```dart /// ```dart
/// void paintSky(Canvas canvas, Rect rect) { /// void paintSky(Canvas canvas, Rect rect) {
/// var gradient = new RadialGradient( /// var gradient = new RadialGradient(
/// center: const FractionalOffset(0.7, 0.2), // near the top right /// center: const Alignment(0.7, -0.6), // near the top right
/// radius: 0.2, /// radius: 0.2,
/// colors: [ /// colors: [
/// const Color(0xFFFFFF00), // yellow sun /// const Color(0xFFFFFF00), // yellow sun
...@@ -324,7 +322,7 @@ class RadialGradient extends Gradient { ...@@ -324,7 +322,7 @@ class RadialGradient extends Gradient {
/// The [colors] argument must not be null. If [stops] is non-null, it must /// The [colors] argument must not be null. If [stops] is non-null, it must
/// have the same length as [colors]. /// have the same length as [colors].
const RadialGradient({ const RadialGradient({
this.center: FractionalOffset.center, this.center: Alignment.center,
this.radius: 0.5, this.radius: 0.5,
@required this.colors, @required this.colors,
this.stops, this.stops,
...@@ -334,22 +332,21 @@ class RadialGradient extends Gradient { ...@@ -334,22 +332,21 @@ class RadialGradient extends Gradient {
assert(colors != null), assert(colors != null),
assert(tileMode != null); assert(tileMode != null);
/// The center of the gradient, as an offset into the unit square /// The center of the gradient, as an offset into the (-1.0, -1.0) x (1.0, 1.0)
/// describing the gradient which will be mapped onto the paint box. /// square describing the gradient which will be mapped onto the paint box.
/// ///
/// For example, an offset of (0.5,0.5) will place the radial /// For example, an alignment of (0.0, 0.0) will place the radial
/// gradient in the center of the box. /// gradient in the center of the box.
/// ///
/// If this is a [FractionalOffset], then it is expressed as a vector from /// If this is a [Alignment], then it is expressed as a vector from
/// coordinate (0.0,0.0), in a coordinate space that maps the top left of the /// coordinate (0.0, 0.0), in a coordinate space that maps the center of the
/// paint box at (0.0,0.0) and the bottom right at (1.0,1.0). /// paint box at (0.0, 0.0) and the bottom right at (1.0, 1.0).
/// ///
/// It can also be a [FractionalOffsetDirectional], in which case it is /// It can also be a [AlignmentDirectional], where the start is the left in
/// expressed as a vector from the top start corner, where the start is the /// left-to-right contexts and the right in right-to-left contexts. If a
/// left in left-to-right contexts and the right in right-to-left contexts. If /// text-direction-dependent value is provided here, then the [createShader]
/// a text-direction-dependent value is provided here, then the [createShader]
/// method will need to be given a [TextDirection]. /// method will need to be given a [TextDirection].
final FractionalOffsetGeometry center; final AlignmentGeometry center;
/// The radius of the gradient, as a fraction of the shortest side /// The radius of the gradient, as a fraction of the shortest side
/// of the paint box. /// of the paint box.
......
...@@ -7,10 +7,10 @@ import 'dart:ui' as ui show Image; ...@@ -7,10 +7,10 @@ import 'dart:ui' as ui show Image;
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'alignment.dart';
import 'basic_types.dart'; import 'basic_types.dart';
import 'borders.dart'; import 'borders.dart';
import 'box_fit.dart'; import 'box_fit.dart';
import 'fractional_offset.dart';
/// How to paint any portions of a box not covered by an image. /// How to paint any portions of a box not covered by an image.
enum ImageRepeat { enum ImageRepeat {
...@@ -41,7 +41,7 @@ class DecorationImage { ...@@ -41,7 +41,7 @@ class DecorationImage {
@required this.image, @required this.image,
this.colorFilter, this.colorFilter,
this.fit, this.fit,
this.alignment: FractionalOffset.center, this.alignment: Alignment.center,
this.centerSlice, this.centerSlice,
this.repeat: ImageRepeat.noRepeat, this.repeat: ImageRepeat.noRepeat,
this.matchTextDirection: false, this.matchTextDirection: false,
...@@ -70,22 +70,22 @@ class DecorationImage { ...@@ -70,22 +70,22 @@ class DecorationImage {
/// How to align the image within its bounds. /// How to align the image within its bounds.
/// ///
/// The alignment aligns the given position in the image to the given position /// The alignment aligns the given position in the image to the given position
/// in the layout bounds. For example, a [FractionalOffset] alignment of (0.0, /// in the layout bounds. For example, a [Alignment] alignment of (-1.0,
/// 0.0) aligns the image to the top-left corner of its layout bounds, while a /// -1.0) aligns the image to the top-left corner of its layout bounds, while a
/// [FractionalOffset] alignment of (1.0, 1.0) aligns the bottom right of the /// [Alignment] alignment of (1.0, 1.0) aligns the bottom right of the
/// image with the bottom right corner of its layout bounds. Similarly, an /// image with the bottom right corner of its layout bounds. Similarly, an
/// alignment of (0.5, 1.0) aligns the bottom middle of the image with the /// alignment of (0.0, 1.0) aligns the bottom middle of the image with the
/// middle of the bottom edge of its layout bounds. /// middle of the bottom edge of its layout bounds.
/// ///
/// To display a subpart of an image, consider using a [CustomPainter] and /// To display a subpart of an image, consider using a [CustomPainter] and
/// [Canvas.drawImageRect]. /// [Canvas.drawImageRect].
/// ///
/// If the [alignment] is [TextDirection]-dependent (i.e. if it is a /// If the [alignment] is [TextDirection]-dependent (i.e. if it is a
/// [FractionalOffsetDirectional]), then a [TextDirection] must be available /// [AlignmentDirectional]), then a [TextDirection] must be available
/// when the image is painted. /// when the image is painted.
/// ///
/// Defaults to [FractionalOffset.center]. /// Defaults to [Alignment.center].
final FractionalOffsetGeometry alignment; final AlignmentGeometry alignment;
/// The center slice for a nine-patch image. /// The center slice for a nine-patch image.
/// ///
...@@ -180,9 +180,9 @@ class DecorationImage { ...@@ -180,9 +180,9 @@ class DecorationImage {
/// ///
/// * `alignment`: How the destination rectangle defined by applying `fit` is /// * `alignment`: How the destination rectangle defined by applying `fit` is
/// aligned within `rect`. For example, if `fit` is [BoxFit.contain] and /// aligned within `rect`. For example, if `fit` is [BoxFit.contain] and
/// `alignment` is [FractionalOffset.bottomRight], the image will be as large /// `alignment` is [Alignment.bottomRight], the image will be as large
/// as possible within `rect` and placed with its bottom right corner at the /// as possible within `rect` and placed with its bottom right corner at the
/// bottom right corner of `rect`. Defaults to [FractionalOffset.center]. /// bottom right corner of `rect`. Defaults to [Alignment.center].
/// ///
/// * `centerSlice`: The image is drawn in nine portions described by splitting /// * `centerSlice`: The image is drawn in nine portions described by splitting
/// the image by drawing two horizontal lines and two vertical lines, where /// the image by drawing two horizontal lines and two vertical lines, where
...@@ -219,7 +219,7 @@ void paintImage({ ...@@ -219,7 +219,7 @@ void paintImage({
@required ui.Image image, @required ui.Image image,
ColorFilter colorFilter, ColorFilter colorFilter,
BoxFit fit, BoxFit fit,
FractionalOffset alignment: FractionalOffset.center, Alignment alignment: Alignment.center,
Rect centerSlice, Rect centerSlice,
ImageRepeat repeat: ImageRepeat.noRepeat, ImageRepeat repeat: ImageRepeat.noRepeat,
bool flipHorizontally: false, bool flipHorizontally: false,
...@@ -268,8 +268,10 @@ void paintImage({ ...@@ -268,8 +268,10 @@ void paintImage({
// to nearest-neighbor. // to nearest-neighbor.
paint.filterQuality = FilterQuality.low; paint.filterQuality = FilterQuality.low;
} }
final double dx = (outputSize.width - destinationSize.width) * (flipHorizontally ? 1.0 - alignment.dx : alignment.dx); final double halfWidthDelta = (outputSize.width - destinationSize.width) / 2.0;
final double dy = (outputSize.height - destinationSize.height) * alignment.dy; final double halfHeightDelta = (outputSize.height - destinationSize.height) / 2.0;
final double dx = halfWidthDelta + (flipHorizontally ? -alignment.x : alignment.x) * halfWidthDelta;
final double dy = halfHeightDelta + alignment.y * halfHeightDelta;
final Offset destinationPosition = rect.topLeft.translate(dx, dy); final Offset destinationPosition = rect.topLeft.translate(dx, dy);
final Rect destinationRect = destinationPosition & destinationSize; final Rect destinationRect = destinationPosition & destinationSize;
final bool needSave = repeat != ImageRepeat.noRepeat || flipHorizontally; final bool needSave = repeat != ImageRepeat.noRepeat || flipHorizontally;
......
...@@ -72,7 +72,7 @@ class RenderAnimatedSize extends RenderAligningShiftedBox { ...@@ -72,7 +72,7 @@ class RenderAnimatedSize extends RenderAligningShiftedBox {
@required TickerProvider vsync, @required TickerProvider vsync,
@required Duration duration, @required Duration duration,
Curve curve: Curves.linear, Curve curve: Curves.linear,
FractionalOffsetGeometry alignment: FractionalOffset.center, AlignmentGeometry alignment: Alignment.center,
TextDirection textDirection, TextDirection textDirection,
RenderBox child, RenderBox child,
}) : assert(vsync != null), }) : assert(vsync != null),
......
...@@ -32,7 +32,7 @@ class RenderImage extends RenderBox { ...@@ -32,7 +32,7 @@ class RenderImage extends RenderBox {
Color color, Color color,
BlendMode colorBlendMode, BlendMode colorBlendMode,
BoxFit fit, BoxFit fit,
FractionalOffsetGeometry alignment: FractionalOffset.center, AlignmentGeometry alignment: Alignment.center,
ImageRepeat repeat: ImageRepeat.noRepeat, ImageRepeat repeat: ImageRepeat.noRepeat,
Rect centerSlice, Rect centerSlice,
bool matchTextDirection: false, bool matchTextDirection: false,
...@@ -56,7 +56,7 @@ class RenderImage extends RenderBox { ...@@ -56,7 +56,7 @@ class RenderImage extends RenderBox {
_updateColorFilter(); _updateColorFilter();
} }
FractionalOffset _resolvedAlignment; Alignment _resolvedAlignment;
bool _flipHorizontally; bool _flipHorizontally;
void _resolve() { void _resolve() {
...@@ -178,9 +178,9 @@ class RenderImage extends RenderBox { ...@@ -178,9 +178,9 @@ class RenderImage extends RenderBox {
/// ///
/// If this is set to a text-direction-dependent value, [textDirection] must /// If this is set to a text-direction-dependent value, [textDirection] must
/// not be null. /// not be null.
FractionalOffsetGeometry get alignment => _alignment; AlignmentGeometry get alignment => _alignment;
FractionalOffsetGeometry _alignment; AlignmentGeometry _alignment;
set alignment(FractionalOffsetGeometry value) { set alignment(AlignmentGeometry value) {
assert(value != null); assert(value != null);
if (value == _alignment) if (value == _alignment)
return; return;
...@@ -343,7 +343,7 @@ class RenderImage extends RenderBox { ...@@ -343,7 +343,7 @@ class RenderImage extends RenderBox {
description.add(new DiagnosticsProperty<Color>('color', color, defaultValue: null)); description.add(new DiagnosticsProperty<Color>('color', color, defaultValue: null));
description.add(new EnumProperty<BlendMode>('colorBlendMode', colorBlendMode, defaultValue: null)); description.add(new EnumProperty<BlendMode>('colorBlendMode', colorBlendMode, defaultValue: null));
description.add(new EnumProperty<BoxFit>('fit', fit, defaultValue: null)); description.add(new EnumProperty<BoxFit>('fit', fit, defaultValue: null));
description.add(new DiagnosticsProperty<FractionalOffset>('alignment', alignment, defaultValue: null)); description.add(new DiagnosticsProperty<AlignmentGeometry>('alignment', alignment, defaultValue: null));
description.add(new EnumProperty<ImageRepeat>('repeat', repeat, defaultValue: ImageRepeat.noRepeat)); description.add(new EnumProperty<ImageRepeat>('repeat', repeat, defaultValue: ImageRepeat.noRepeat));
description.add(new DiagnosticsProperty<Rect>('centerSlice', centerSlice, defaultValue: null)); description.add(new DiagnosticsProperty<Rect>('centerSlice', centerSlice, defaultValue: null));
description.add(new FlagProperty('matchTextDirection', value: matchTextDirection, ifTrue: 'match text direction')); description.add(new FlagProperty('matchTextDirection', value: matchTextDirection, ifTrue: 'match text direction'));
......
...@@ -1599,11 +1599,10 @@ class RenderTransform extends RenderProxyBox { ...@@ -1599,11 +1599,10 @@ class RenderTransform extends RenderProxyBox {
RenderTransform({ RenderTransform({
@required Matrix4 transform, @required Matrix4 transform,
Offset origin, Offset origin,
FractionalOffset alignment, Alignment alignment,
this.transformHitTests: true, this.transformHitTests: true,
RenderBox child RenderBox child
}) : assert(transform != null), }) : assert(transform != null),
assert(alignment == null || (alignment.dx != null && alignment.dy != null)),
super(child) { super(child) {
this.transform = transform; this.transform = transform;
this.alignment = alignment; this.alignment = alignment;
...@@ -1628,10 +1627,10 @@ class RenderTransform extends RenderProxyBox { ...@@ -1628,10 +1627,10 @@ class RenderTransform extends RenderProxyBox {
/// ///
/// This is equivalent to setting an origin based on the size of the box. /// This is equivalent to setting an origin based on the size of the box.
/// If it is specified at the same time as an offset, both are applied. /// If it is specified at the same time as an offset, both are applied.
FractionalOffset get alignment => _alignment; Alignment get alignment => _alignment;
FractionalOffset _alignment; Alignment _alignment;
set alignment(FractionalOffset value) { set alignment(Alignment value) {
assert(value == null || (value.dx != null && value.dy != null)); assert(value == null || (value.x != null && value.y != null));
if (_alignment == value) if (_alignment == value)
return; return;
_alignment = value; _alignment = value;
...@@ -1751,7 +1750,7 @@ class RenderTransform extends RenderProxyBox { ...@@ -1751,7 +1750,7 @@ class RenderTransform extends RenderProxyBox {
super.debugFillProperties(description); super.debugFillProperties(description);
description.add(new TransformProperty('transform matrix', _transform)); description.add(new TransformProperty('transform matrix', _transform));
description.add(new DiagnosticsProperty<Offset>('origin', origin)); description.add(new DiagnosticsProperty<Offset>('origin', origin));
description.add(new DiagnosticsProperty<FractionalOffset>('alignment', alignment)); description.add(new DiagnosticsProperty<Alignment>('alignment', alignment));
description.add(new DiagnosticsProperty<bool>('transformHitTests', transformHitTests)); description.add(new DiagnosticsProperty<bool>('transformHitTests', transformHitTests));
} }
} }
...@@ -1764,9 +1763,9 @@ class RenderFittedBox extends RenderProxyBox { ...@@ -1764,9 +1763,9 @@ class RenderFittedBox extends RenderProxyBox {
RenderFittedBox({ RenderFittedBox({
RenderBox child, RenderBox child,
BoxFit fit: BoxFit.contain, BoxFit fit: BoxFit.contain,
FractionalOffset alignment: FractionalOffset.center Alignment alignment: Alignment.center
}) : assert(fit != null), }) : assert(fit != null),
assert(alignment != null && alignment.dx != null && alignment.dy != null), assert(alignment != null),
_fit = fit, _fit = fit,
_alignment = alignment, _alignment = alignment,
super(child); super(child);
...@@ -1788,10 +1787,10 @@ class RenderFittedBox extends RenderProxyBox { ...@@ -1788,10 +1787,10 @@ class RenderFittedBox extends RenderProxyBox {
/// An alignment of (0.0, 0.0) aligns the child to the top-left corner of its /// An alignment of (0.0, 0.0) aligns the child to the top-left corner of its
/// parent's bounds. An alignment of (1.0, 0.5) aligns the child to the middle /// parent's bounds. An alignment of (1.0, 0.5) aligns the child to the middle
/// of the right edge of its parent's bounds. /// of the right edge of its parent's bounds.
FractionalOffset get alignment => _alignment; Alignment get alignment => _alignment;
FractionalOffset _alignment; Alignment _alignment;
set alignment(FractionalOffset value) { set alignment(Alignment value) {
assert(value != null && value.dx != null && value.dy != null); assert(value != null && value.x != null && value.y != null);
if (_alignment == value) if (_alignment == value)
return; return;
_alignment = value; _alignment = value;
...@@ -1891,13 +1890,13 @@ class RenderFittedBox extends RenderProxyBox { ...@@ -1891,13 +1890,13 @@ class RenderFittedBox extends RenderProxyBox {
void debugFillProperties(DiagnosticPropertiesBuilder description) { void debugFillProperties(DiagnosticPropertiesBuilder description) {
super.debugFillProperties(description); super.debugFillProperties(description);
description.add(new EnumProperty<BoxFit>('fit', fit)); description.add(new EnumProperty<BoxFit>('fit', fit));
description.add(new DiagnosticsProperty<FractionalOffset>('alignment', alignment)); description.add(new DiagnosticsProperty<Alignment>('alignment', alignment));
} }
} }
/// Applies a translation transformation before painting its child. /// Applies a translation transformation before painting its child.
/// ///
/// The translation is expressed as a [FractionalOffset] relative to the /// The translation is expressed as a [Alignment] relative to the
/// RenderFractionalTranslation box's size. Hit tests will only be detected /// RenderFractionalTranslation box's size. Hit tests will only be detected
/// inside the bounds of the RenderFractionalTranslation, even if the contents /// inside the bounds of the RenderFractionalTranslation, even if the contents
/// are offset such that they overflow. /// are offset such that they overflow.
...@@ -1906,18 +1905,18 @@ class RenderFractionalTranslation extends RenderProxyBox { ...@@ -1906,18 +1905,18 @@ class RenderFractionalTranslation extends RenderProxyBox {
/// ///
/// The [translation] argument must not be null. /// The [translation] argument must not be null.
RenderFractionalTranslation({ RenderFractionalTranslation({
FractionalOffset translation, Alignment translation,
this.transformHitTests: true, this.transformHitTests: true,
RenderBox child RenderBox child
}) : assert(translation == null || (translation.dx != null && translation.dy != null)), }) : assert(translation == null || (translation.x != null && translation.y != null)),
_translation = translation, _translation = translation,
super(child); super(child);
/// The translation to apply to the child, as a multiple of the size. /// The translation to apply to the child, relative to the child's center.
FractionalOffset get translation => _translation; Alignment get translation => _translation;
FractionalOffset _translation; Alignment _translation;
set translation(FractionalOffset value) { set translation(Alignment value) {
assert(value == null || (value.dx != null && value.dy != null)); assert(value == null || (value.x != null && value.y != null));
if (_translation == value) if (_translation == value)
return; return;
_translation = value; _translation = value;
...@@ -1935,27 +1934,41 @@ class RenderFractionalTranslation extends RenderProxyBox { ...@@ -1935,27 +1934,41 @@ class RenderFractionalTranslation extends RenderProxyBox {
@override @override
bool hitTest(HitTestResult result, { Offset position }) { bool hitTest(HitTestResult result, { Offset position }) {
assert(!debugNeedsLayout); assert(!debugNeedsLayout);
if (transformHitTests) if (transformHitTests) {
position = new Offset(position.dx - translation.dx * size.width, position.dy - translation.dy * size.height); final double halfWidth = size.width / 2.0;
final double halfHeight = size.height / 2.0;
position = new Offset(
position.dx - translation.x * halfWidth,
position.dy - translation.y * halfHeight,
);
}
return super.hitTest(result, position: position); return super.hitTest(result, position: position);
} }
@override @override
void paint(PaintingContext context, Offset offset) { void paint(PaintingContext context, Offset offset) {
assert(!debugNeedsLayout); assert(!debugNeedsLayout);
if (child != null) if (child != null) {
super.paint(context, offset + translation.alongSize(size)); final double halfWidth = size.width / 2.0;
final double halfHeight = size.height / 2.0;
super.paint(context, new Offset(
offset.dx + translation.x * halfWidth,
offset.dy + translation.y * halfHeight,
));
}
} }
@override @override
void applyPaintTransform(RenderBox child, Matrix4 transform) { void applyPaintTransform(RenderBox child, Matrix4 transform) {
transform.translate(translation.dx * size.width, translation.dy * size.height); final double halfWidth = size.width / 2.0;
final double halfHeight = size.height / 2.0;
transform.translate(translation.x * halfWidth, translation.y * halfHeight);
} }
@override @override
void debugFillProperties(DiagnosticPropertiesBuilder description) { void debugFillProperties(DiagnosticPropertiesBuilder description) {
super.debugFillProperties(description); super.debugFillProperties(description);
description.add(new DiagnosticsProperty<FractionalOffset>('translation', translation)); description.add(new DiagnosticsProperty<Alignment>('translation', translation));
description.add(new DiagnosticsProperty<bool>('transformHitTests', transformHitTests)); description.add(new DiagnosticsProperty<bool>('transformHitTests', transformHitTests));
} }
} }
...@@ -1997,7 +2010,7 @@ class RenderFractionalTranslation extends RenderProxyBox { ...@@ -1997,7 +2010,7 @@ class RenderFractionalTranslation extends RenderProxyBox {
/// void paint(Canvas canvas, Size size) { /// void paint(Canvas canvas, Size size) {
/// var rect = Offset.zero & size; /// var rect = Offset.zero & size;
/// var gradient = new RadialGradient( /// var gradient = new RadialGradient(
/// center: const FractionalOffset(0.7, 0.2), /// center: const Alignment(0.7, -0.6),
/// radius: 0.2, /// radius: 0.2,
/// colors: [const Color(0xFFFFFF00), const Color(0xFF0099FF)], /// colors: [const Color(0xFFFFFF00), const Color(0xFF0099FF)],
/// stops: [0.4, 1.0], /// stops: [0.4, 1.0],
......
...@@ -222,13 +222,13 @@ class RenderPadding extends RenderShiftedBox { ...@@ -222,13 +222,13 @@ class RenderPadding extends RenderShiftedBox {
} }
/// Abstract class for one-child-layout render boxes that use a /// Abstract class for one-child-layout render boxes that use a
/// [FractionalOffsetGeometry] to align their children. /// [AlignmentGeometry] to align their children.
abstract class RenderAligningShiftedBox extends RenderShiftedBox { abstract class RenderAligningShiftedBox extends RenderShiftedBox {
/// Initializes member variables for subclasses. /// Initializes member variables for subclasses.
/// ///
/// The [alignment] argument must not be null. /// The [alignment] argument must not be null.
RenderAligningShiftedBox({ RenderAligningShiftedBox({
FractionalOffsetGeometry alignment: FractionalOffset.center, AlignmentGeometry alignment: Alignment.center,
TextDirection textDirection, TextDirection textDirection,
RenderBox child, RenderBox child,
}) : assert(alignment != null), }) : assert(alignment != null),
...@@ -236,7 +236,7 @@ abstract class RenderAligningShiftedBox extends RenderShiftedBox { ...@@ -236,7 +236,7 @@ abstract class RenderAligningShiftedBox extends RenderShiftedBox {
_textDirection = textDirection, _textDirection = textDirection,
super(child); super(child);
FractionalOffset _resolvedAlignment; Alignment _resolvedAlignment;
void _resolve() { void _resolve() {
if (_resolvedAlignment != null) if (_resolvedAlignment != null)
...@@ -252,21 +252,21 @@ abstract class RenderAligningShiftedBox extends RenderShiftedBox { ...@@ -252,21 +252,21 @@ abstract class RenderAligningShiftedBox extends RenderShiftedBox {
/// How to align the child. /// How to align the child.
/// ///
/// The x and y values of the alignment control the horizontal and vertical /// The x and y values of the alignment control the horizontal and vertical
/// alignment, respectively. An x value of 0.0 means that the left edge of /// alignment, respectively. An x value of -1.0 means that the left edge of
/// the child is aligned with the left edge of the parent whereas an x value /// the child is aligned with the left edge of the parent whereas an x value
/// of 1.0 means that the right edge of the child is aligned with the right /// of 1.0 means that the right edge of the child is aligned with the right
/// edge of the parent. Other values interpolate (and extrapolate) linearly. /// edge of the parent. Other values interpolate (and extrapolate) linearly.
/// For example, a value of 0.5 means that the center of the child is aligned /// For example, a value of 0.0 means that the center of the child is aligned
/// with the center of the parent. /// with the center of the parent.
/// ///
/// If this is set to a [FractionalOffsetDirectional] object, then /// If this is set to a [AlignmentDirectional] object, then
/// [textDirection] must not be null. /// [textDirection] must not be null.
FractionalOffsetGeometry get alignment => _alignment; AlignmentGeometry get alignment => _alignment;
FractionalOffsetGeometry _alignment; AlignmentGeometry _alignment;
/// Sets the alignment to a new value, and triggers a layout update. /// Sets the alignment to a new value, and triggers a layout update.
/// ///
/// The new alignment must not be null or have any null properties. /// The new alignment must not be null or have any null properties.
set alignment(FractionalOffsetGeometry value) { set alignment(AlignmentGeometry value) {
assert(value != null); assert(value != null);
if (_alignment == value) if (_alignment == value)
return; return;
...@@ -309,16 +309,16 @@ abstract class RenderAligningShiftedBox extends RenderShiftedBox { ...@@ -309,16 +309,16 @@ abstract class RenderAligningShiftedBox extends RenderShiftedBox {
@override @override
void debugFillProperties(DiagnosticPropertiesBuilder description) { void debugFillProperties(DiagnosticPropertiesBuilder description) {
super.debugFillProperties(description); super.debugFillProperties(description);
description.add(new DiagnosticsProperty<FractionalOffsetGeometry>('alignment', alignment)); description.add(new DiagnosticsProperty<AlignmentGeometry>('alignment', alignment));
description.add(new EnumProperty<TextDirection>('textDirection', textDirection, defaultValue: null)); description.add(new EnumProperty<TextDirection>('textDirection', textDirection, defaultValue: null));
} }
} }
/// Positions its child using a [FractionalOffset]. /// Positions its child using a [AlignmentGeometry].
/// ///
/// For example, to align a box at the bottom right, you would pass this box a /// For example, to align a box at the bottom right, you would pass this box a
/// tight constraint that is bigger than the child's natural size, /// tight constraint that is bigger than the child's natural size,
/// with an alignment of [FractionalOffset.bottomRight]. /// with an alignment of [Alignment.bottomRight].
/// ///
/// By default, sizes to be as big as possible in both axes. If either axis is /// By default, sizes to be as big as possible in both axes. If either axis is
/// unconstrained, then in that direction it will be sized to fit the child's /// unconstrained, then in that direction it will be sized to fit the child's
...@@ -330,7 +330,7 @@ class RenderPositionedBox extends RenderAligningShiftedBox { ...@@ -330,7 +330,7 @@ class RenderPositionedBox extends RenderAligningShiftedBox {
RenderBox child, RenderBox child,
double widthFactor, double widthFactor,
double heightFactor, double heightFactor,
FractionalOffsetGeometry alignment: FractionalOffset.center, AlignmentGeometry alignment: Alignment.center,
TextDirection textDirection, TextDirection textDirection,
}) : assert(widthFactor == null || widthFactor >= 0.0), }) : assert(widthFactor == null || widthFactor >= 0.0),
assert(heightFactor == null || heightFactor >= 0.0), assert(heightFactor == null || heightFactor >= 0.0),
...@@ -475,7 +475,7 @@ class RenderConstrainedOverflowBox extends RenderAligningShiftedBox { ...@@ -475,7 +475,7 @@ class RenderConstrainedOverflowBox extends RenderAligningShiftedBox {
double maxWidth, double maxWidth,
double minHeight, double minHeight,
double maxHeight, double maxHeight,
FractionalOffsetGeometry alignment: FractionalOffset.center, AlignmentGeometry alignment: Alignment.center,
TextDirection textDirection, TextDirection textDirection,
}) : _minWidth = minWidth, }) : _minWidth = minWidth,
_maxWidth = maxWidth, _maxWidth = maxWidth,
...@@ -571,7 +571,7 @@ class RenderSizedOverflowBox extends RenderAligningShiftedBox { ...@@ -571,7 +571,7 @@ class RenderSizedOverflowBox extends RenderAligningShiftedBox {
RenderSizedOverflowBox({ RenderSizedOverflowBox({
RenderBox child, RenderBox child,
@required Size requestedSize, @required Size requestedSize,
FractionalOffset alignment: FractionalOffset.center, Alignment alignment: Alignment.center,
TextDirection textDirection, TextDirection textDirection,
}) : assert(requestedSize != null), }) : assert(requestedSize != null),
_requestedSize = requestedSize, _requestedSize = requestedSize,
...@@ -643,7 +643,7 @@ class RenderFractionallySizedOverflowBox extends RenderAligningShiftedBox { ...@@ -643,7 +643,7 @@ class RenderFractionallySizedOverflowBox extends RenderAligningShiftedBox {
RenderBox child, RenderBox child,
double widthFactor, double widthFactor,
double heightFactor, double heightFactor,
FractionalOffset alignment: FractionalOffset.center, Alignment alignment: Alignment.center,
TextDirection textDirection, TextDirection textDirection,
}) : _widthFactor = widthFactor, }) : _widthFactor = widthFactor,
_heightFactor = heightFactor, _heightFactor = heightFactor,
......
...@@ -297,7 +297,7 @@ class RenderStack extends RenderBox ...@@ -297,7 +297,7 @@ class RenderStack extends RenderBox
/// top left corners. /// top left corners.
RenderStack({ RenderStack({
List<RenderBox> children, List<RenderBox> children,
FractionalOffsetGeometry alignment: FractionalOffsetDirectional.topStart, AlignmentGeometry alignment: AlignmentDirectional.topStart,
TextDirection textDirection, TextDirection textDirection,
StackFit fit: StackFit.loose, StackFit fit: StackFit.loose,
Overflow overflow: Overflow.clip, Overflow overflow: Overflow.clip,
...@@ -319,7 +319,7 @@ class RenderStack extends RenderBox ...@@ -319,7 +319,7 @@ class RenderStack extends RenderBox
child.parentData = new StackParentData(); child.parentData = new StackParentData();
} }
FractionalOffset _resolvedAlignment; Alignment _resolvedAlignment;
void _resolve() { void _resolve() {
if (_resolvedAlignment != null) if (_resolvedAlignment != null)
...@@ -336,14 +336,14 @@ class RenderStack extends RenderBox ...@@ -336,14 +336,14 @@ class RenderStack extends RenderBox
/// ///
/// The non-positioned children are placed relative to each other such that /// The non-positioned children are placed relative to each other such that
/// the points determined by [alignment] are co-located. For example, if the /// the points determined by [alignment] are co-located. For example, if the
/// [alignment] is [FractionalOffset.topLeft], then the top left corner of /// [alignment] is [Alignment.topLeft], then the top left corner of
/// each non-positioned child will be located at the same global coordinate. /// each non-positioned child will be located at the same global coordinate.
/// ///
/// If this is set to a [FractionalOffsetDirectional] object, then /// If this is set to a [AlignmentDirectional] object, then [textDirection]
/// [textDirection] must not be null. /// must not be null.
FractionalOffsetGeometry get alignment => _alignment; AlignmentGeometry get alignment => _alignment;
FractionalOffsetGeometry _alignment; AlignmentGeometry _alignment;
set alignment(FractionalOffsetGeometry value) { set alignment(AlignmentGeometry value) {
assert(value != null); assert(value != null);
if (_alignment == value) if (_alignment == value)
return; return;
...@@ -559,7 +559,7 @@ class RenderStack extends RenderBox ...@@ -559,7 +559,7 @@ class RenderStack extends RenderBox
@override @override
void debugFillProperties(DiagnosticPropertiesBuilder description) { void debugFillProperties(DiagnosticPropertiesBuilder description) {
super.debugFillProperties(description); super.debugFillProperties(description);
description.add(new DiagnosticsProperty<FractionalOffsetGeometry>('alignment', alignment)); description.add(new DiagnosticsProperty<AlignmentGeometry>('alignment', alignment));
description.add(new EnumProperty<TextDirection>('textDirection', textDirection)); description.add(new EnumProperty<TextDirection>('textDirection', textDirection));
description.add(new EnumProperty<StackFit>('fit', fit)); description.add(new EnumProperty<StackFit>('fit', fit));
description.add(new EnumProperty<Overflow>('overflow', overflow)); description.add(new EnumProperty<Overflow>('overflow', overflow));
...@@ -577,7 +577,7 @@ class RenderIndexedStack extends RenderStack { ...@@ -577,7 +577,7 @@ class RenderIndexedStack extends RenderStack {
/// If the [index] parameter is null, nothing is displayed. /// If the [index] parameter is null, nothing is displayed.
RenderIndexedStack({ RenderIndexedStack({
List<RenderBox> children, List<RenderBox> children,
FractionalOffsetGeometry alignment: FractionalOffsetDirectional.topStart, AlignmentGeometry alignment: AlignmentDirectional.topStart,
TextDirection textDirection, TextDirection textDirection,
int index: 0, int index: 0,
}) : _index = index, super( }) : _index = index, super(
......
...@@ -7,15 +7,14 @@ import 'package:flutter/painting.dart'; ...@@ -7,15 +7,14 @@ import 'package:flutter/painting.dart';
/// An interpolation between two fractional offsets. /// An interpolation between two fractional offsets.
/// ///
/// This class specializes the interpolation of Tween<FractionalOffset> to be /// This class specializes the interpolation of [Tween<FractionalOffset>] to be
/// appropriate for rectangles. /// appropriate for fractional offsets.
/// ///
/// See [Tween] for a discussion on how to use interpolation objects. /// See [Tween] for a discussion on how to use interpolation objects.
/// ///
/// See also: /// See also:
/// ///
/// * [FractionalOffsetGeometryTween], which interpolates between two /// * [AlignmentTween], which interpolates between to [Alignment] objects.
/// [FractionalOffsetGeometry] objects.
class FractionalOffsetTween extends Tween<FractionalOffset> { class FractionalOffsetTween extends Tween<FractionalOffset> {
/// Creates a fractional offset tween. /// Creates a fractional offset tween.
/// ///
...@@ -29,28 +28,51 @@ class FractionalOffsetTween extends Tween<FractionalOffset> { ...@@ -29,28 +28,51 @@ class FractionalOffsetTween extends Tween<FractionalOffset> {
FractionalOffset lerp(double t) => FractionalOffset.lerp(begin, end, t); FractionalOffset lerp(double t) => FractionalOffset.lerp(begin, end, t);
} }
/// An interpolation between two [FractionalOffsetGeometry]. /// An interpolation between two alignments.
/// ///
/// This class specializes the interpolation of [Tween<FractionalOffsetGeometry>] /// This class specializes the interpolation of [Tween<Alignment>] to be
/// to be appropriate for rectangles. /// appropriate for alignments.
/// ///
/// See [Tween] for a discussion on how to use interpolation objects. /// See [Tween] for a discussion on how to use interpolation objects.
/// ///
/// See also: /// See also:
/// ///
/// * [FractionalOffsetTween], which interpolates between two /// * [AlignmentGeometryTween], which interpolates between two
/// [FractionalOffset] objects. /// [AlignmentGeometry] objects.
class FractionalOffsetGeometryTween extends Tween<FractionalOffsetGeometry> { class AlignmentTween extends Tween<Alignment> {
/// Creates a fractional offset tween.
///
/// The [begin] and [end] properties may be null; the null value
/// is treated as meaning the center.
AlignmentTween({ Alignment begin, Alignment end })
: super(begin: begin, end: end);
/// Returns the value this variable has at the given animation clock value.
@override
Alignment lerp(double t) => Alignment.lerp(begin, end, t);
}
/// An interpolation between two [AlignmentGeometry].
///
/// This class specializes the interpolation of [Tween<AlignmentGeometry>]
/// to be appropriate for alignments.
///
/// See [Tween] for a discussion on how to use interpolation objects.
///
/// See also:
///
/// * [AlignmentTween], which interpolates between two [Alignment] objects.
class AlignmentGeometryTween extends Tween<AlignmentGeometry> {
/// Creates a fractional offset geometry tween. /// Creates a fractional offset geometry tween.
/// ///
/// The [begin] and [end] properties may be null; the null value /// The [begin] and [end] properties may be null; the null value
/// is treated as meaning the center. /// is treated as meaning the center.
FractionalOffsetGeometryTween({ AlignmentGeometryTween({
FractionalOffsetGeometry begin, AlignmentGeometry begin,
FractionalOffsetGeometry end, AlignmentGeometry end,
}) : super(begin: begin, end: end); }) : super(begin: begin, end: end);
/// Returns the value this variable has at the given animation clock value. /// Returns the value this variable has at the given animation clock value.
@override @override
FractionalOffsetGeometry lerp(double t) => FractionalOffsetGeometry.lerp(begin, end, t); AlignmentGeometry lerp(double t) => AlignmentGeometry.lerp(begin, end, t);
} }
...@@ -115,7 +115,7 @@ class AnimatedCrossFade extends StatefulWidget { ...@@ -115,7 +115,7 @@ class AnimatedCrossFade extends StatefulWidget {
this.firstCurve: Curves.linear, this.firstCurve: Curves.linear,
this.secondCurve: Curves.linear, this.secondCurve: Curves.linear,
this.sizeCurve: Curves.linear, this.sizeCurve: Curves.linear,
this.alignment: FractionalOffset.topCenter, this.alignment: Alignment.topCenter,
@required this.crossFadeState, @required this.crossFadeState,
@required this.duration, @required this.duration,
this.layoutBuilder: defaultLayoutBuilder, this.layoutBuilder: defaultLayoutBuilder,
...@@ -165,8 +165,8 @@ class AnimatedCrossFade extends StatefulWidget { ...@@ -165,8 +165,8 @@ class AnimatedCrossFade extends StatefulWidget {
/// How the children should be aligned while the size is animating. /// How the children should be aligned while the size is animating.
/// ///
/// Defaults to [FractionalOffset.topCenter]. /// Defaults to [Alignment.topCenter].
final FractionalOffsetGeometry alignment; final AlignmentGeometry alignment;
/// A builder that positions the [firstChild] and [secondChild] widgets. /// A builder that positions the [firstChild] and [secondChild] widgets.
/// ///
...@@ -218,7 +218,7 @@ class AnimatedCrossFade extends StatefulWidget { ...@@ -218,7 +218,7 @@ class AnimatedCrossFade extends StatefulWidget {
void debugFillProperties(DiagnosticPropertiesBuilder description) { void debugFillProperties(DiagnosticPropertiesBuilder description) {
super.debugFillProperties(description); super.debugFillProperties(description);
description.add(new EnumProperty<CrossFadeState>('crossFadeState', crossFadeState)); description.add(new EnumProperty<CrossFadeState>('crossFadeState', crossFadeState));
description.add(new DiagnosticsProperty<FractionalOffsetGeometry>('alignment', alignment, defaultValue: FractionalOffset.topCenter)); description.add(new DiagnosticsProperty<AlignmentGeometry>('alignment', alignment, defaultValue: Alignment.topCenter));
} }
} }
...@@ -356,6 +356,6 @@ class _AnimatedCrossFadeState extends State<AnimatedCrossFade> with TickerProvid ...@@ -356,6 +356,6 @@ class _AnimatedCrossFadeState extends State<AnimatedCrossFade> with TickerProvid
super.debugFillProperties(description); super.debugFillProperties(description);
description.add(new EnumProperty<CrossFadeState>('crossFadeState', widget.crossFadeState)); description.add(new EnumProperty<CrossFadeState>('crossFadeState', widget.crossFadeState));
description.add(new DiagnosticsProperty<AnimationController>('controller', _controller, showName: false)); description.add(new DiagnosticsProperty<AnimationController>('controller', _controller, showName: false));
description.add(new DiagnosticsProperty<FractionalOffsetGeometry>('alignment', widget.alignment, defaultValue: FractionalOffset.topCenter)); description.add(new DiagnosticsProperty<AlignmentGeometry>('alignment', widget.alignment, defaultValue: Alignment.topCenter));
} }
} }
...@@ -18,7 +18,7 @@ class AnimatedSize extends SingleChildRenderObjectWidget { ...@@ -18,7 +18,7 @@ class AnimatedSize extends SingleChildRenderObjectWidget {
const AnimatedSize({ const AnimatedSize({
Key key, Key key,
Widget child, Widget child,
this.alignment: FractionalOffset.center, this.alignment: Alignment.center,
this.curve: Curves.linear, this.curve: Curves.linear,
@required this.duration, @required this.duration,
@required this.vsync, @required this.vsync,
...@@ -28,13 +28,13 @@ class AnimatedSize extends SingleChildRenderObjectWidget { ...@@ -28,13 +28,13 @@ class AnimatedSize extends SingleChildRenderObjectWidget {
/// the same size as the child. /// the same size as the child.
/// ///
/// The x and y values of the alignment control the horizontal and vertical /// The x and y values of the alignment control the horizontal and vertical
/// alignment, respectively. An x value of 0.0 means that the left edge of /// alignment, respectively. An x value of -1.0 means that the left edge of
/// the child is aligned with the left edge of the parent whereas an x value /// the child is aligned with the left edge of the parent whereas an x value
/// of 1.0 means that the right edge of the child is aligned with the right /// of 1.0 means that the right edge of the child is aligned with the right
/// edge of the parent. Other values interpolate (and extrapolate) linearly. /// edge of the parent. Other values interpolate (and extrapolate) linearly.
/// For example, a value of 0.5 means that the center of the child is aligned /// For example, a value of 0.0 means that the center of the child is aligned
/// with the center of the parent. /// with the center of the parent.
final FractionalOffsetGeometry alignment; final AlignmentGeometry alignment;
/// The animation curve when transitioning this widget's size to match the /// The animation curve when transitioning this widget's size to match the
/// child's size. /// child's size.
......
This diff is collapsed.
...@@ -25,7 +25,7 @@ import 'image.dart'; ...@@ -25,7 +25,7 @@ import 'image.dart';
/// new DecoratedBox( /// new DecoratedBox(
/// decoration: new BoxDecoration( /// decoration: new BoxDecoration(
/// gradient: new RadialGradient( /// gradient: new RadialGradient(
/// center: const FractionalOffset(0.25, 0.3), /// center: const Alignment(-0.5, -0.6),
/// radius: 0.15, /// radius: 0.15,
/// colors: <Color>[ /// colors: <Color>[
/// const Color(0xFFEEEEEE), /// const Color(0xFFEEEEEE),
...@@ -207,7 +207,7 @@ class DecoratedBox extends SingleChildRenderObjectWidget { ...@@ -207,7 +207,7 @@ class DecoratedBox extends SingleChildRenderObjectWidget {
/// ), /// ),
/// padding: const EdgeInsets.all(8.0), /// padding: const EdgeInsets.all(8.0),
/// color: Colors.teal.shade700, /// color: Colors.teal.shade700,
/// alignment: FractionalOffset.center, /// alignment: Alignment.center,
/// child: new Text('Hello World', style: Theme.of(context).textTheme.display1.copyWith(color: Colors.white)), /// child: new Text('Hello World', style: Theme.of(context).textTheme.display1.copyWith(color: Colors.white)),
/// foregroundDecoration: new BoxDecoration( /// foregroundDecoration: new BoxDecoration(
/// image: new DecorationImage( /// image: new DecorationImage(
...@@ -278,7 +278,7 @@ class Container extends StatelessWidget { ...@@ -278,7 +278,7 @@ class Container extends StatelessWidget {
/// constraints are unbounded, then the child will be shrink-wrapped instead. /// constraints are unbounded, then the child will be shrink-wrapped instead.
/// ///
/// Ignored if [child] is null. /// Ignored if [child] is null.
final FractionalOffsetGeometry alignment; final AlignmentGeometry alignment;
/// Empty space to inscribe inside the [decoration]. The [child], if any, is /// Empty space to inscribe inside the [decoration]. The [child], if any, is
/// placed inside this padding. /// placed inside this padding.
...@@ -362,7 +362,7 @@ class Container extends StatelessWidget { ...@@ -362,7 +362,7 @@ class Container extends StatelessWidget {
@override @override
void debugFillProperties(DiagnosticPropertiesBuilder description) { void debugFillProperties(DiagnosticPropertiesBuilder description) {
super.debugFillProperties(description); super.debugFillProperties(description);
description.add(new DiagnosticsProperty<FractionalOffsetGeometry>('alignment', alignment, showName: false, defaultValue: null)); description.add(new DiagnosticsProperty<AlignmentGeometry>('alignment', alignment, showName: false, defaultValue: null));
description.add(new DiagnosticsProperty<EdgeInsetsGeometry>('padding', padding, defaultValue: null)); description.add(new DiagnosticsProperty<EdgeInsetsGeometry>('padding', padding, defaultValue: null));
description.add(new DiagnosticsProperty<Decoration>('bg', decoration, defaultValue: null)); description.add(new DiagnosticsProperty<Decoration>('bg', decoration, defaultValue: null));
description.add(new DiagnosticsProperty<Decoration>('fg', foregroundDecoration, defaultValue: null)); description.add(new DiagnosticsProperty<Decoration>('fg', foregroundDecoration, defaultValue: null));
......
...@@ -232,7 +232,7 @@ bool debugCheckHasDirectionality(BuildContext context) { ...@@ -232,7 +232,7 @@ bool debugCheckHasDirectionality(BuildContext context) {
'determines the ambient reading direction and is used, for example, to ' 'determines the ambient reading direction and is used, for example, to '
'determine how to lay out text, how to interpret "start" and "end" ' 'determine how to lay out text, how to interpret "start" and "end" '
'values, and to resolve EdgeInsetsDirectional, ' 'values, and to resolve EdgeInsetsDirectional, '
'FractionalOffsetDirectional, and other *Directional objects.' 'AlignmentDirectional, and other *Directional objects.'
); );
} }
return true; return true;
......
...@@ -135,19 +135,21 @@ class _DismissibleClipper extends CustomClipper<Rect> { ...@@ -135,19 +135,21 @@ class _DismissibleClipper extends CustomClipper<Rect> {
super(reclip: moveAnimation); super(reclip: moveAnimation);
final Axis axis; final Axis axis;
final Animation<FractionalOffset> moveAnimation; final Animation<Alignment> moveAnimation;
@override @override
Rect getClip(Size size) { Rect getClip(Size size) {
assert(axis != null); assert(axis != null);
switch (axis) { switch (axis) {
case Axis.horizontal: case Axis.horizontal:
final double offset = moveAnimation.value.dx * size.width; final double halfWidth = size.width / 2.0;
final double offset = halfWidth + moveAnimation.value.x * halfWidth;
if (offset < 0) if (offset < 0)
return new Rect.fromLTRB(size.width + offset, 0.0, size.width, size.height); return new Rect.fromLTRB(size.width + offset, 0.0, size.width, size.height);
return new Rect.fromLTRB(0.0, 0.0, offset, size.height); return new Rect.fromLTRB(0.0, 0.0, offset, size.height);
case Axis.vertical: case Axis.vertical:
final double offset = moveAnimation.value.dy * size.height; final double halfHeight = size.height / 2.0;
final double offset = halfHeight + moveAnimation.value.y * halfHeight;
if (offset < 0) if (offset < 0)
return new Rect.fromLTRB(0.0, size.height + offset, size.width, size.height); return new Rect.fromLTRB(0.0, size.height + offset, size.width, size.height);
return new Rect.fromLTRB(0.0, 0.0, size.width, offset); return new Rect.fromLTRB(0.0, 0.0, size.width, offset);
...@@ -175,7 +177,7 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin ...@@ -175,7 +177,7 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin
} }
AnimationController _moveController; AnimationController _moveController;
Animation<FractionalOffset> _moveAnimation; Animation<Alignment> _moveAnimation;
AnimationController _resizeController; AnimationController _resizeController;
Animation<double> _resizeAnimation; Animation<double> _resizeAnimation;
...@@ -268,11 +270,10 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin ...@@ -268,11 +270,10 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin
} }
void _updateMoveAnimation() { void _updateMoveAnimation() {
_moveAnimation = new FractionalOffsetTween( final double end = _dragExtent.sign * 2.0;
begin: FractionalOffset.topLeft, _moveAnimation = new AlignmentTween(
end: _directionIsXAxis ? begin: Alignment.center,
new FractionalOffset(_dragExtent.sign, 0.0) : end: _directionIsXAxis ? new Alignment(end, 0.0) : new Alignment(0.0, end),
new FractionalOffset(0.0, _dragExtent.sign)
).animate(_moveController); ).animate(_moveController);
} }
......
...@@ -73,7 +73,7 @@ class FadeInImage extends StatefulWidget { ...@@ -73,7 +73,7 @@ class FadeInImage extends StatefulWidget {
this.width, this.width,
this.height, this.height,
this.fit, this.fit,
this.alignment: FractionalOffset.center, this.alignment: Alignment.center,
this.repeat: ImageRepeat.noRepeat, this.repeat: ImageRepeat.noRepeat,
this.matchTextDirection: false, this.matchTextDirection: false,
}) : assert(placeholder != null), }) : assert(placeholder != null),
...@@ -121,7 +121,7 @@ class FadeInImage extends StatefulWidget { ...@@ -121,7 +121,7 @@ class FadeInImage extends StatefulWidget {
this.width, this.width,
this.height, this.height,
this.fit, this.fit,
this.alignment: FractionalOffset.center, this.alignment: Alignment.center,
this.repeat: ImageRepeat.noRepeat, this.repeat: ImageRepeat.noRepeat,
this.matchTextDirection: false, this.matchTextDirection: false,
}) : assert(placeholder != null), }) : assert(placeholder != null),
...@@ -177,7 +177,7 @@ class FadeInImage extends StatefulWidget { ...@@ -177,7 +177,7 @@ class FadeInImage extends StatefulWidget {
this.width, this.width,
this.height, this.height,
this.fit, this.fit,
this.alignment: FractionalOffset.center, this.alignment: Alignment.center,
this.repeat: ImageRepeat.noRepeat, this.repeat: ImageRepeat.noRepeat,
this.matchTextDirection: false, this.matchTextDirection: false,
}) : assert(placeholder != null), }) : assert(placeholder != null),
...@@ -239,19 +239,19 @@ class FadeInImage extends StatefulWidget { ...@@ -239,19 +239,19 @@ class FadeInImage extends StatefulWidget {
/// How to align the image within its bounds. /// How to align the image within its bounds.
/// ///
/// The alignment aligns the given position in the image to the given position /// The alignment aligns the given position in the image to the given position
/// in the layout bounds. For example, a [FractionalOffset] alignment of (0.0, /// in the layout bounds. For example, a [Alignment] alignment of (-1.0,
/// 0.0) aligns the image to the top-left corner of its layout bounds, while a /// -1.0) aligns the image to the top-left corner of its layout bounds, while a
/// [FractionalOffset] alignment of (1.0, 1.0) aligns the bottom right of the /// [Alignment] alignment of (1.0, 1.0) aligns the bottom right of the
/// image with the bottom right corner of its layout bounds. Similarly, an /// image with the bottom right corner of its layout bounds. Similarly, an
/// alignment of (0.5, 1.0) aligns the bottom middle of the image with the /// alignment of (0.0, 1.0) aligns the bottom middle of the image with the
/// middle of the bottom edge of its layout bounds. /// middle of the bottom edge of its layout bounds.
/// ///
/// If the [alignment] is [TextDirection]-dependent (i.e. if it is a /// If the [alignment] is [TextDirection]-dependent (i.e. if it is a
/// [FractionalOffsetDirectional]), then an ambient [Directionality] widget /// [AlignmentDirectional]), then an ambient [Directionality] widget
/// must be in scope. /// must be in scope.
/// ///
/// Defaults to [FractionalOffset.center]. /// Defaults to [Alignment.center].
final FractionalOffsetGeometry alignment; final AlignmentGeometry alignment;
/// How to paint any portions of the layout bounds not covered by the image. /// How to paint any portions of the layout bounds not covered by the image.
final ImageRepeat repeat; final ImageRepeat repeat;
......
...@@ -113,7 +113,7 @@ class Image extends StatefulWidget { ...@@ -113,7 +113,7 @@ class Image extends StatefulWidget {
this.color, this.color,
this.colorBlendMode, this.colorBlendMode,
this.fit, this.fit,
this.alignment: FractionalOffset.center, this.alignment: Alignment.center,
this.repeat: ImageRepeat.noRepeat, this.repeat: ImageRepeat.noRepeat,
this.centerSlice, this.centerSlice,
this.matchTextDirection: false, this.matchTextDirection: false,
...@@ -136,7 +136,7 @@ class Image extends StatefulWidget { ...@@ -136,7 +136,7 @@ class Image extends StatefulWidget {
this.color, this.color,
this.colorBlendMode, this.colorBlendMode,
this.fit, this.fit,
this.alignment: FractionalOffset.center, this.alignment: Alignment.center,
this.repeat: ImageRepeat.noRepeat, this.repeat: ImageRepeat.noRepeat,
this.centerSlice, this.centerSlice,
this.matchTextDirection: false, this.matchTextDirection: false,
...@@ -162,7 +162,7 @@ class Image extends StatefulWidget { ...@@ -162,7 +162,7 @@ class Image extends StatefulWidget {
this.color, this.color,
this.colorBlendMode, this.colorBlendMode,
this.fit, this.fit,
this.alignment: FractionalOffset.center, this.alignment: Alignment.center,
this.repeat: ImageRepeat.noRepeat, this.repeat: ImageRepeat.noRepeat,
this.centerSlice, this.centerSlice,
this.matchTextDirection: false, this.matchTextDirection: false,
...@@ -293,7 +293,7 @@ class Image extends StatefulWidget { ...@@ -293,7 +293,7 @@ class Image extends StatefulWidget {
this.color, this.color,
this.colorBlendMode, this.colorBlendMode,
this.fit, this.fit,
this.alignment: FractionalOffset.center, this.alignment: Alignment.center,
this.repeat: ImageRepeat.noRepeat, this.repeat: ImageRepeat.noRepeat,
this.centerSlice, this.centerSlice,
this.matchTextDirection: false, this.matchTextDirection: false,
...@@ -318,7 +318,7 @@ class Image extends StatefulWidget { ...@@ -318,7 +318,7 @@ class Image extends StatefulWidget {
this.color, this.color,
this.colorBlendMode, this.colorBlendMode,
this.fit, this.fit,
this.alignment: FractionalOffset.center, this.alignment: Alignment.center,
this.repeat: ImageRepeat.noRepeat, this.repeat: ImageRepeat.noRepeat,
this.centerSlice, this.centerSlice,
this.matchTextDirection: false, this.matchTextDirection: false,
...@@ -367,22 +367,22 @@ class Image extends StatefulWidget { ...@@ -367,22 +367,22 @@ class Image extends StatefulWidget {
/// How to align the image within its bounds. /// How to align the image within its bounds.
/// ///
/// The alignment aligns the given position in the image to the given position /// The alignment aligns the given position in the image to the given position
/// in the layout bounds. For example, a [FractionalOffset] alignment of (0.0, /// in the layout bounds. For example, a [Alignment] alignment of (-1.0,
/// 0.0) aligns the image to the top-left corner of its layout bounds, while a /// -1.0) aligns the image to the top-left corner of its layout bounds, while a
/// [FractionalOffset] alignment of (1.0, 1.0) aligns the bottom right of the /// [Alignment] alignment of (1.0, 1.0) aligns the bottom right of the
/// image with the bottom right corner of its layout bounds. Similarly, an /// image with the bottom right corner of its layout bounds. Similarly, an
/// alignment of (0.5, 1.0) aligns the bottom middle of the image with the /// alignment of (0.0, 1.0) aligns the bottom middle of the image with the
/// middle of the bottom edge of its layout bounds. /// middle of the bottom edge of its layout bounds.
/// ///
/// To display a subpart of an image, consider using a [CustomPainter] and /// To display a subpart of an image, consider using a [CustomPainter] and
/// [Canvas.drawImageRect]. /// [Canvas.drawImageRect].
/// ///
/// If the [alignment] is [TextDirection]-dependent (i.e. if it is a /// If the [alignment] is [TextDirection]-dependent (i.e. if it is a
/// [FractionalOffsetDirectional]), then an ambient [Directionality] widget /// [AlignmentDirectional]), then an ambient [Directionality] widget
/// must be in scope. /// must be in scope.
/// ///
/// Defaults to [FractionalOffset.center]. /// Defaults to [Alignment.center].
final FractionalOffsetGeometry alignment; final AlignmentGeometry alignment;
/// How to paint any portions of the layout bounds not covered by the image. /// How to paint any portions of the layout bounds not covered by the image.
final ImageRepeat repeat; final ImageRepeat repeat;
...@@ -433,7 +433,7 @@ class Image extends StatefulWidget { ...@@ -433,7 +433,7 @@ class Image extends StatefulWidget {
description.add(new DiagnosticsProperty<Color>('color', color, defaultValue: null)); description.add(new DiagnosticsProperty<Color>('color', color, defaultValue: null));
description.add(new EnumProperty<BlendMode>('colorBlendMode', colorBlendMode, defaultValue: null)); description.add(new EnumProperty<BlendMode>('colorBlendMode', colorBlendMode, defaultValue: null));
description.add(new EnumProperty<BoxFit>('fit', fit, defaultValue: null)); description.add(new EnumProperty<BoxFit>('fit', fit, defaultValue: null));
description.add(new DiagnosticsProperty<FractionalOffsetGeometry>('alignment', alignment, defaultValue: null)); description.add(new DiagnosticsProperty<AlignmentGeometry>('alignment', alignment, defaultValue: null));
description.add(new EnumProperty<ImageRepeat>('repeat', repeat, defaultValue: ImageRepeat.noRepeat)); description.add(new EnumProperty<ImageRepeat>('repeat', repeat, defaultValue: ImageRepeat.noRepeat));
description.add(new DiagnosticsProperty<Rect>('centerSlice', centerSlice, defaultValue: null)); description.add(new DiagnosticsProperty<Rect>('centerSlice', centerSlice, defaultValue: null));
description.add(new FlagProperty('matchTextDirection', value: matchTextDirection, ifTrue: 'match text direction')); description.add(new FlagProperty('matchTextDirection', value: matchTextDirection, ifTrue: 'match text direction'));
......
...@@ -75,7 +75,7 @@ class ImageIcon extends StatelessWidget { ...@@ -75,7 +75,7 @@ class ImageIcon extends StatelessWidget {
height: iconSize, height: iconSize,
color: iconColor, color: iconColor,
fit: BoxFit.scaleDown, fit: BoxFit.scaleDown,
alignment: FractionalOffset.center alignment: Alignment.center,
); );
} }
......
...@@ -391,7 +391,7 @@ class AnimatedContainer extends ImplicitlyAnimatedWidget { ...@@ -391,7 +391,7 @@ class AnimatedContainer extends ImplicitlyAnimatedWidget {
/// constraints are unbounded, then the child will be shrink-wrapped instead. /// constraints are unbounded, then the child will be shrink-wrapped instead.
/// ///
/// Ignored if [child] is null. /// Ignored if [child] is null.
final FractionalOffsetGeometry alignment; final AlignmentGeometry alignment;
/// Empty space to inscribe inside the [decoration]. The [child], if any, is /// Empty space to inscribe inside the [decoration]. The [child], if any, is
/// placed inside this padding. /// placed inside this padding.
...@@ -427,7 +427,7 @@ class AnimatedContainer extends ImplicitlyAnimatedWidget { ...@@ -427,7 +427,7 @@ class AnimatedContainer extends ImplicitlyAnimatedWidget {
@override @override
void debugFillProperties(DiagnosticPropertiesBuilder description) { void debugFillProperties(DiagnosticPropertiesBuilder description) {
super.debugFillProperties(description); super.debugFillProperties(description);
description.add(new DiagnosticsProperty<FractionalOffsetGeometry>('alignment', alignment, showName: false, defaultValue: null)); description.add(new DiagnosticsProperty<AlignmentGeometry>('alignment', alignment, showName: false, defaultValue: null));
description.add(new DiagnosticsProperty<EdgeInsetsGeometry>('padding', padding, defaultValue: null)); description.add(new DiagnosticsProperty<EdgeInsetsGeometry>('padding', padding, defaultValue: null));
description.add(new DiagnosticsProperty<Decoration>('bg', decoration, defaultValue: null)); description.add(new DiagnosticsProperty<Decoration>('bg', decoration, defaultValue: null));
description.add(new DiagnosticsProperty<Decoration>('fg', foregroundDecoration, defaultValue: null)); description.add(new DiagnosticsProperty<Decoration>('fg', foregroundDecoration, defaultValue: null));
...@@ -438,7 +438,7 @@ class AnimatedContainer extends ImplicitlyAnimatedWidget { ...@@ -438,7 +438,7 @@ class AnimatedContainer extends ImplicitlyAnimatedWidget {
} }
class _AnimatedContainerState extends AnimatedWidgetBaseState<AnimatedContainer> { class _AnimatedContainerState extends AnimatedWidgetBaseState<AnimatedContainer> {
FractionalOffsetGeometryTween _alignment; AlignmentGeometryTween _alignment;
EdgeInsetsGeometryTween _padding; EdgeInsetsGeometryTween _padding;
DecorationTween _decoration; DecorationTween _decoration;
DecorationTween _foregroundDecoration; DecorationTween _foregroundDecoration;
...@@ -448,7 +448,7 @@ class _AnimatedContainerState extends AnimatedWidgetBaseState<AnimatedContainer> ...@@ -448,7 +448,7 @@ class _AnimatedContainerState extends AnimatedWidgetBaseState<AnimatedContainer>
@override @override
void forEachTween(TweenVisitor<dynamic> visitor) { void forEachTween(TweenVisitor<dynamic> visitor) {
_alignment = visitor(_alignment, widget.alignment, (dynamic value) => new FractionalOffsetGeometryTween(begin: value)); _alignment = visitor(_alignment, widget.alignment, (dynamic value) => new AlignmentGeometryTween(begin: value));
_padding = visitor(_padding, widget.padding, (dynamic value) => new EdgeInsetsGeometryTween(begin: value)); _padding = visitor(_padding, widget.padding, (dynamic value) => new EdgeInsetsGeometryTween(begin: value));
_decoration = visitor(_decoration, widget.decoration, (dynamic value) => new DecorationTween(begin: value)); _decoration = visitor(_decoration, widget.decoration, (dynamic value) => new DecorationTween(begin: value));
_foregroundDecoration = visitor(_foregroundDecoration, widget.foregroundDecoration, (dynamic value) => new DecorationTween(begin: value)); _foregroundDecoration = visitor(_foregroundDecoration, widget.foregroundDecoration, (dynamic value) => new DecorationTween(begin: value));
...@@ -474,7 +474,7 @@ class _AnimatedContainerState extends AnimatedWidgetBaseState<AnimatedContainer> ...@@ -474,7 +474,7 @@ class _AnimatedContainerState extends AnimatedWidgetBaseState<AnimatedContainer>
@override @override
void debugFillProperties(DiagnosticPropertiesBuilder description) { void debugFillProperties(DiagnosticPropertiesBuilder description) {
super.debugFillProperties(description); super.debugFillProperties(description);
description.add(new DiagnosticsProperty<FractionalOffsetGeometryTween>('alignment', _alignment, showName: false, defaultValue: null)); description.add(new DiagnosticsProperty<AlignmentGeometryTween>('alignment', _alignment, showName: false, defaultValue: null));
description.add(new DiagnosticsProperty<EdgeInsetsGeometryTween>('padding', _padding, defaultValue: null)); description.add(new DiagnosticsProperty<EdgeInsetsGeometryTween>('padding', _padding, defaultValue: null));
description.add(new DiagnosticsProperty<DecorationTween>('bg', _decoration, defaultValue: null)); description.add(new DiagnosticsProperty<DecorationTween>('bg', _decoration, defaultValue: null));
description.add(new DiagnosticsProperty<DecorationTween>('fg', _foregroundDecoration, defaultValue: null)); description.add(new DiagnosticsProperty<DecorationTween>('fg', _foregroundDecoration, defaultValue: null));
......
...@@ -632,9 +632,9 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T ...@@ -632,9 +632,9 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T
/// Widget child, /// Widget child,
/// ) { /// ) {
/// return new SlideTransition( /// return new SlideTransition(
/// position: new FractionalOffsetTween( /// position: new AlignmentTween(
/// begin: FractionalOffset.bottomLeft, /// begin: Alignment.bottomCenter,
/// end: FractionalOffset.topLeft /// end: Alignment.topCenter,
/// ).animate(animation), /// ).animate(animation),
/// child: child, // child is the value returned by pageBuilder /// child: child, // child is the value returned by pageBuilder
/// ); /// );
...@@ -669,14 +669,14 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T ...@@ -669,14 +669,14 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T
/// Widget child, /// Widget child,
/// ) { /// ) {
/// return new SlideTransition( /// return new SlideTransition(
/// position: new FractionalOffsetTween( /// position: new AlignmentTween(
/// begin: FractionalOffset.bottomLeft, /// begin: Alignment.bottomCenter,
/// end: FractionalOffset.topLeft, /// end: Alignment.topCenter,
/// ).animate(animation), /// ).animate(animation),
/// child: new SlideTransition( /// child: new SlideTransition(
/// position: new FractionalOffsetTween( /// position: new AlignmentTween(
/// begin: FractionalOffset.topLeft, /// begin: Alignment.topCenter,
/// end: FractionalOffset.bottomLeft, /// end: Alignment.bottomCenter,
/// ).animate(secondaryAnimation), /// ).animate(secondaryAnimation),
/// child: child, /// child: child,
/// ), /// ),
......
...@@ -279,7 +279,7 @@ abstract class ScrollView extends StatelessWidget { ...@@ -279,7 +279,7 @@ abstract class ScrollView extends StatelessWidget {
/// delegate: new SliverChildBuilderDelegate( /// delegate: new SliverChildBuilderDelegate(
/// (BuildContext context, int index) { /// (BuildContext context, int index) {
/// return new Container( /// return new Container(
/// alignment: FractionalOffset.center, /// alignment: Alignment.center,
/// color: Colors.teal[100 * (index % 9)], /// color: Colors.teal[100 * (index % 9)],
/// child: new Text('grid item $index'), /// child: new Text('grid item $index'),
/// ); /// );
...@@ -292,7 +292,7 @@ abstract class ScrollView extends StatelessWidget { ...@@ -292,7 +292,7 @@ abstract class ScrollView extends StatelessWidget {
/// delegate: new SliverChildBuilderDelegate( /// delegate: new SliverChildBuilderDelegate(
/// (BuildContext context, int index) { /// (BuildContext context, int index) {
/// return new Container( /// return new Container(
/// alignment: FractionalOffset.center, /// alignment: Alignment.center,
/// color: Colors.lightBlue[100 * (index % 9)], /// color: Colors.lightBlue[100 * (index % 9)],
/// child: new Text('list item $index'), /// child: new Text('list item $index'),
/// ); /// );
......
...@@ -279,7 +279,7 @@ void _paintMessage(Canvas canvas, SemanticsNode node) { ...@@ -279,7 +279,7 @@ void _paintMessage(Canvas canvas, SemanticsNode node) {
..textAlign = TextAlign.center ..textAlign = TextAlign.center
..layout(maxWidth: rect.width); ..layout(maxWidth: rect.width);
textPainter.paint(canvas, FractionalOffset.center.inscribe(textPainter.size, rect).topLeft); textPainter.paint(canvas, Alignment.center.inscribe(textPainter.size, rect).topLeft);
canvas.restore(); canvas.restore();
} }
......
...@@ -422,7 +422,7 @@ class SliverList extends SliverMultiBoxAdaptorWidget { ...@@ -422,7 +422,7 @@ class SliverList extends SliverMultiBoxAdaptorWidget {
/// delegate: new SliverChildBuilderDelegate( /// delegate: new SliverChildBuilderDelegate(
/// (BuildContext context, int index) { /// (BuildContext context, int index) {
/// return new Container( /// return new Container(
/// alignment: FractionalOffset.center, /// alignment: Alignment.center,
/// color: Colors.lightBlue[100 * (index % 9)], /// color: Colors.lightBlue[100 * (index % 9)],
/// child: new Text('list item $index'), /// child: new Text('list item $index'),
/// ); /// );
...@@ -489,7 +489,7 @@ class SliverFixedExtentList extends SliverMultiBoxAdaptorWidget { ...@@ -489,7 +489,7 @@ class SliverFixedExtentList extends SliverMultiBoxAdaptorWidget {
/// delegate: new SliverChildBuilderDelegate( /// delegate: new SliverChildBuilderDelegate(
/// (BuildContext context, int index) { /// (BuildContext context, int index) {
/// return new Container( /// return new Container(
/// alignment: FractionalOffset.center, /// alignment: Alignment.center,
/// color: Colors.teal[100 * (index % 9)], /// color: Colors.teal[100 * (index % 9)],
/// child: new Text('grid item $index'), /// child: new Text('grid item $index'),
/// ); /// );
......
...@@ -103,7 +103,7 @@ class SlideTransition extends AnimatedWidget { ...@@ -103,7 +103,7 @@ class SlideTransition extends AnimatedWidget {
/// The [position] argument must not be null. /// The [position] argument must not be null.
const SlideTransition({ const SlideTransition({
Key key, Key key,
@required Animation<FractionalOffsetGeometry> position, @required Animation<Alignment> position,
this.transformHitTests: true, this.transformHitTests: true,
this.child, this.child,
}) : super(key: key, listenable: position); }) : super(key: key, listenable: position);
...@@ -112,7 +112,7 @@ class SlideTransition extends AnimatedWidget { ...@@ -112,7 +112,7 @@ class SlideTransition extends AnimatedWidget {
/// ///
/// If the current value of the position animation is (dx, dy), the child will /// If the current value of the position animation is (dx, dy), the child will
/// be translated horizontally by width * dx and vertically by height * dy. /// be translated horizontally by width * dx and vertically by height * dy.
Animation<FractionalOffsetGeometry> get position => listenable; Animation<Alignment> get position => listenable;
/// Whether hit testing should be affected by the slide animation. /// Whether hit testing should be affected by the slide animation.
/// ///
...@@ -140,11 +140,11 @@ class ScaleTransition extends AnimatedWidget { ...@@ -140,11 +140,11 @@ class ScaleTransition extends AnimatedWidget {
/// Creates a scale transition. /// Creates a scale transition.
/// ///
/// The [scale] argument must not be null. The [alignment] argument defaults /// The [scale] argument must not be null. The [alignment] argument defaults
/// to [FractionalOffset.center]. /// to [Alignment.center].
const ScaleTransition({ const ScaleTransition({
Key key, Key key,
@required Animation<double> scale, @required Animation<double> scale,
this.alignment: FractionalOffset.center, this.alignment: Alignment.center,
this.child, this.child,
}) : super(key: key, listenable: scale); }) : super(key: key, listenable: scale);
...@@ -158,8 +158,8 @@ class ScaleTransition extends AnimatedWidget { ...@@ -158,8 +158,8 @@ class ScaleTransition extends AnimatedWidget {
/// takes place, relative to the size of the box. /// takes place, relative to the size of the box.
/// ///
/// For example, to set the origin of the scale to bottom middle, you can use /// For example, to set the origin of the scale to bottom middle, you can use
/// an alignment of (0.5, 1.0). /// an alignment of (0.0, 1.0).
final FractionalOffset alignment; final Alignment alignment;
/// The widget below this widget in the tree. /// The widget below this widget in the tree.
final Widget child; final Widget child;
...@@ -203,7 +203,7 @@ class RotationTransition extends AnimatedWidget { ...@@ -203,7 +203,7 @@ class RotationTransition extends AnimatedWidget {
final Matrix4 transform = new Matrix4.rotationZ(turnsValue * math.PI * 2.0); final Matrix4 transform = new Matrix4.rotationZ(turnsValue * math.PI * 2.0);
return new Transform( return new Transform(
transform: transform, transform: transform,
alignment: FractionalOffset.center, alignment: Alignment.center,
child: child, child: child,
); );
} }
...@@ -217,13 +217,13 @@ class SizeTransition extends AnimatedWidget { ...@@ -217,13 +217,13 @@ class SizeTransition extends AnimatedWidget {
/// Creates a size transition. /// Creates a size transition.
/// ///
/// The [sizeFactor] argument must not be null. The [axis] argument defaults /// The [sizeFactor] argument must not be null. The [axis] argument defaults
/// to [Axis.vertical]. The [axisAlignment] defaults to 0.5, which centers the /// to [Axis.vertical]. The [axisAlignment] defaults to 0.0, which centers the
/// child along the main axis during the transition. /// child along the main axis during the transition.
const SizeTransition({ const SizeTransition({
Key key, Key key,
this.axis: Axis.vertical, this.axis: Axis.vertical,
@required Animation<double> sizeFactor, @required Animation<double> sizeFactor,
this.axisAlignment: 0.5, this.axisAlignment: 0.0,
this.child, this.child,
}) : assert(axis != null), }) : assert(axis != null),
super(key: key, listenable: sizeFactor); super(key: key, listenable: sizeFactor);
...@@ -244,11 +244,11 @@ class SizeTransition extends AnimatedWidget { ...@@ -244,11 +244,11 @@ class SizeTransition extends AnimatedWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
FractionalOffsetDirectional alignment; AlignmentDirectional alignment;
if (axis == Axis.vertical) if (axis == Axis.vertical)
alignment = new FractionalOffsetDirectional(0.0, axisAlignment); alignment = new AlignmentDirectional(-1.0, axisAlignment);
else else
alignment = new FractionalOffsetDirectional(axisAlignment, 0.0); alignment = new AlignmentDirectional(axisAlignment, -1.0);
return new ClipRect( return new ClipRect(
child: new Align( child: new Align(
alignment: alignment, alignment: alignment,
......
...@@ -33,13 +33,13 @@ void main() { ...@@ -33,13 +33,13 @@ void main() {
Offset widget2TopLeft = tester.getTopLeft(find.text('Page 2')); Offset widget2TopLeft = tester.getTopLeft(find.text('Page 2'));
// Page 1 is moving to the left. // Page 1 is moving to the left.
expect(widget1TransientTopLeft.dx < widget1InitialTopLeft.dx, true); expect(widget1TransientTopLeft.dx, lessThan(widget1InitialTopLeft.dx));
// Page 1 isn't moving vertically. // Page 1 isn't moving vertically.
expect(widget1TransientTopLeft.dy == widget1InitialTopLeft.dy, true); expect(widget1TransientTopLeft.dy, equals(widget1InitialTopLeft.dy));
// iOS transition is horizontal only. // iOS transition is horizontal only.
expect(widget1InitialTopLeft.dy == widget2TopLeft.dy, true); expect(widget1InitialTopLeft.dy, equals(widget2TopLeft.dy));
// Page 2 is coming in from the right. // Page 2 is coming in from the right.
expect(widget2TopLeft.dx > widget1InitialTopLeft.dx, true); expect(widget2TopLeft.dx, greaterThan(widget1InitialTopLeft.dx));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
...@@ -55,13 +55,13 @@ void main() { ...@@ -55,13 +55,13 @@ void main() {
widget2TopLeft = tester.getTopLeft(find.text('Page 2')); widget2TopLeft = tester.getTopLeft(find.text('Page 2'));
// Page 1 is coming back from the left. // Page 1 is coming back from the left.
expect(widget1TransientTopLeft.dx < widget1InitialTopLeft.dx, true); expect(widget1TransientTopLeft.dx, lessThan(widget1InitialTopLeft.dx));
// Page 1 isn't moving vertically. // Page 1 isn't moving vertically.
expect(widget1TransientTopLeft.dy == widget1InitialTopLeft.dy, true); expect(widget1TransientTopLeft.dy, equals(widget1InitialTopLeft.dy));
// iOS transition is horizontal only. // iOS transition is horizontal only.
expect(widget1InitialTopLeft.dy == widget2TopLeft.dy, true); expect(widget1InitialTopLeft.dy, equals(widget2TopLeft.dy));
// Page 2 is leaving towards the right. // Page 2 is leaving towards the right.
expect(widget2TopLeft.dx > widget1InitialTopLeft.dx, true); expect(widget2TopLeft.dx, greaterThan(widget1InitialTopLeft.dx));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
...@@ -71,7 +71,7 @@ void main() { ...@@ -71,7 +71,7 @@ void main() {
widget1TransientTopLeft = tester.getTopLeft(find.text('Page 1')); widget1TransientTopLeft = tester.getTopLeft(find.text('Page 1'));
// Page 1 is back where it started. // Page 1 is back where it started.
expect(widget1InitialTopLeft == widget1TransientTopLeft, true); expect(widget1InitialTopLeft, equals(widget1TransientTopLeft));
}); });
testWidgets('test iOS fullscreen dialog transition', (WidgetTester tester) async { testWidgets('test iOS fullscreen dialog transition', (WidgetTester tester) async {
...@@ -105,11 +105,11 @@ void main() { ...@@ -105,11 +105,11 @@ void main() {
Offset widget2TopLeft = tester.getTopLeft(find.text('Page 2')); Offset widget2TopLeft = tester.getTopLeft(find.text('Page 2'));
// Page 1 doesn't move. // Page 1 doesn't move.
expect(widget1TransientTopLeft == widget1InitialTopLeft, true); expect(widget1TransientTopLeft, equals(widget1InitialTopLeft));
// Fullscreen dialogs transitions vertically only. // Fullscreen dialogs transitions vertically only.
expect(widget1InitialTopLeft.dx == widget2TopLeft.dx, true); expect(widget1InitialTopLeft.dx, equals(widget2TopLeft.dx));
// Page 2 is coming in from the bottom. // Page 2 is coming in from the bottom.
expect(widget2TopLeft.dy > widget1InitialTopLeft.dy, true); expect(widget2TopLeft.dy, greaterThan(widget1InitialTopLeft.dy));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
...@@ -125,11 +125,11 @@ void main() { ...@@ -125,11 +125,11 @@ void main() {
widget2TopLeft = tester.getTopLeft(find.text('Page 2')); widget2TopLeft = tester.getTopLeft(find.text('Page 2'));
// Page 1 doesn't move. // Page 1 doesn't move.
expect(widget1TransientTopLeft == widget1InitialTopLeft, true); expect(widget1TransientTopLeft, equals(widget1InitialTopLeft));
// Fullscreen dialogs transitions vertically only. // Fullscreen dialogs transitions vertically only.
expect(widget1InitialTopLeft.dx == widget2TopLeft.dx, true); expect(widget1InitialTopLeft.dx, equals(widget2TopLeft.dx));
// Page 2 is leaving towards the bottom. // Page 2 is leaving towards the bottom.
expect(widget2TopLeft.dy > widget1InitialTopLeft.dy, true); expect(widget2TopLeft.dy, greaterThan(widget1InitialTopLeft.dy));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
...@@ -139,7 +139,7 @@ void main() { ...@@ -139,7 +139,7 @@ void main() {
widget1TransientTopLeft = tester.getTopLeft(find.text('Page 1')); widget1TransientTopLeft = tester.getTopLeft(find.text('Page 1'));
// Page 1 is back where it started. // Page 1 is back where it started.
expect(widget1InitialTopLeft == widget1TransientTopLeft, true); expect(widget1InitialTopLeft, equals(widget1TransientTopLeft));
}); });
testWidgets('test only edge swipes work', (WidgetTester tester) async { testWidgets('test only edge swipes work', (WidgetTester tester) async {
......
...@@ -999,8 +999,8 @@ void main() { ...@@ -999,8 +999,8 @@ void main() {
flexibleSpace: new DecoratedBox( flexibleSpace: new DecoratedBox(
decoration: new BoxDecoration( decoration: new BoxDecoration(
gradient: new LinearGradient( gradient: new LinearGradient(
begin: const FractionalOffset(0.50, 0.0), begin: const Alignment(0.0, -1.0),
end: const FractionalOffset(0.48, 1.0), end: const Alignment(-0.04, 1.0),
colors: <Color>[Colors.blue.shade500, Colors.blue.shade800], colors: <Color>[Colors.blue.shade500, Colors.blue.shade800],
), ),
), ),
...@@ -1029,8 +1029,8 @@ void main() { ...@@ -1029,8 +1029,8 @@ void main() {
flexibleSpace: new DecoratedBox( flexibleSpace: new DecoratedBox(
decoration: new BoxDecoration( decoration: new BoxDecoration(
gradient: new LinearGradient( gradient: new LinearGradient(
begin: const FractionalOffset(0.50, 0.0), begin: const Alignment(0.0, -1.0),
end: const FractionalOffset(0.48, 1.0), end: const Alignment(-0.04, 1.0),
colors: <Color>[Colors.blue.shade500, Colors.blue.shade800], colors: <Color>[Colors.blue.shade500, Colors.blue.shade800],
), ),
), ),
......
...@@ -160,7 +160,7 @@ void main() { ...@@ -160,7 +160,7 @@ void main() {
child: new Container( child: new Container(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
alignment: FractionalOffset.center, alignment: Alignment.center,
child: const Text('Dialog1'), child: const Text('Dialog1'),
), ),
); );
...@@ -180,7 +180,7 @@ void main() { ...@@ -180,7 +180,7 @@ void main() {
child: new Container( child: new Container(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
alignment: FractionalOffset.center, alignment: Alignment.center,
child: const Text('Dialog2'), child: const Text('Dialog2'),
), ),
); );
......
...@@ -24,7 +24,7 @@ Widget buildFrame({ ...@@ -24,7 +24,7 @@ Widget buildFrame({
bool isDense: false, bool isDense: false,
Widget hint, Widget hint,
List<String> items: menuItems, List<String> items: menuItems,
FractionalOffset alignment: FractionalOffset.center, Alignment alignment: Alignment.center,
}) { }) {
return new MaterialApp( return new MaterialApp(
home: new Material( home: new Material(
...@@ -219,7 +219,7 @@ void main() { ...@@ -219,7 +219,7 @@ void main() {
new MaterialApp( new MaterialApp(
home: new Material( home: new Material(
child: new Align( child: new Align(
alignment: FractionalOffset.topCenter, alignment: Alignment.topCenter,
child: button, child: button,
), ),
), ),
...@@ -443,19 +443,19 @@ void main() { ...@@ -443,19 +443,19 @@ void main() {
// so that it fits within the frame. // so that it fits within the frame.
await popUpAndDown( await popUpAndDown(
buildFrame(alignment: FractionalOffset.topLeft, value: menuItems.last) buildFrame(alignment: Alignment.topLeft, value: menuItems.last)
); );
expect(menuRect.topLeft, Offset.zero); expect(menuRect.topLeft, Offset.zero);
expect(menuRect.topRight, new Offset(menuRect.width, 0.0)); expect(menuRect.topRight, new Offset(menuRect.width, 0.0));
await popUpAndDown( await popUpAndDown(
buildFrame(alignment: FractionalOffset.topCenter, value: menuItems.last) buildFrame(alignment: Alignment.topCenter, value: menuItems.last)
); );
expect(menuRect.topLeft, new Offset(buttonRect.left, 0.0)); expect(menuRect.topLeft, new Offset(buttonRect.left, 0.0));
expect(menuRect.topRight, new Offset(buttonRect.right, 0.0)); expect(menuRect.topRight, new Offset(buttonRect.right, 0.0));
await popUpAndDown( await popUpAndDown(
buildFrame(alignment: FractionalOffset.topRight, value: menuItems.last) buildFrame(alignment: Alignment.topRight, value: menuItems.last)
); );
expect(menuRect.topLeft, new Offset(800.0 - menuRect.width, 0.0)); expect(menuRect.topLeft, new Offset(800.0 - menuRect.width, 0.0));
expect(menuRect.topRight, const Offset(800.0, 0.0)); expect(menuRect.topRight, const Offset(800.0, 0.0));
...@@ -465,19 +465,19 @@ void main() { ...@@ -465,19 +465,19 @@ void main() {
// is selected) and shifted horizontally so that it fits within the frame. // is selected) and shifted horizontally so that it fits within the frame.
await popUpAndDown( await popUpAndDown(
buildFrame(alignment: FractionalOffset.centerLeft, value: menuItems.first) buildFrame(alignment: Alignment.centerLeft, value: menuItems.first)
); );
expect(menuRect.topLeft, new Offset(0.0, buttonRect.top)); expect(menuRect.topLeft, new Offset(0.0, buttonRect.top));
expect(menuRect.topRight, new Offset(menuRect.width, buttonRect.top)); expect(menuRect.topRight, new Offset(menuRect.width, buttonRect.top));
await popUpAndDown( await popUpAndDown(
buildFrame(alignment: FractionalOffset.center, value: menuItems.first) buildFrame(alignment: Alignment.center, value: menuItems.first)
); );
expect(menuRect.topLeft, buttonRect.topLeft); expect(menuRect.topLeft, buttonRect.topLeft);
expect(menuRect.topRight, buttonRect.topRight); expect(menuRect.topRight, buttonRect.topRight);
await popUpAndDown( await popUpAndDown(
buildFrame(alignment: FractionalOffset.centerRight, value: menuItems.first) buildFrame(alignment: Alignment.centerRight, value: menuItems.first)
); );
expect(menuRect.topLeft, new Offset(800.0 - menuRect.width, buttonRect.top)); expect(menuRect.topLeft, new Offset(800.0 - menuRect.width, buttonRect.top));
expect(menuRect.topRight, new Offset(800.0, buttonRect.top)); expect(menuRect.topRight, new Offset(800.0, buttonRect.top));
...@@ -487,19 +487,19 @@ void main() { ...@@ -487,19 +487,19 @@ void main() {
// so that it fits within the frame. // so that it fits within the frame.
await popUpAndDown( await popUpAndDown(
buildFrame(alignment: FractionalOffset.bottomLeft, value: menuItems.first) buildFrame(alignment: Alignment.bottomLeft, value: menuItems.first)
); );
expect(menuRect.bottomLeft, const Offset(0.0, 600.0)); expect(menuRect.bottomLeft, const Offset(0.0, 600.0));
expect(menuRect.bottomRight, new Offset(menuRect.width, 600.0)); expect(menuRect.bottomRight, new Offset(menuRect.width, 600.0));
await popUpAndDown( await popUpAndDown(
buildFrame(alignment: FractionalOffset.bottomCenter, value: menuItems.first) buildFrame(alignment: Alignment.bottomCenter, value: menuItems.first)
); );
expect(menuRect.bottomLeft, new Offset(buttonRect.left, 600.0)); expect(menuRect.bottomLeft, new Offset(buttonRect.left, 600.0));
expect(menuRect.bottomRight, new Offset(buttonRect.right, 600.0)); expect(menuRect.bottomRight, new Offset(buttonRect.right, 600.0));
await popUpAndDown( await popUpAndDown(
buildFrame(alignment: FractionalOffset.bottomRight, value: menuItems.first) buildFrame(alignment: Alignment.bottomRight, value: menuItems.first)
); );
expect(menuRect.bottomLeft, new Offset(800.0 - menuRect.width, 600.0)); expect(menuRect.bottomLeft, new Offset(800.0 - menuRect.width, 600.0));
expect(menuRect.bottomRight, const Offset(800.0, 600.0)); expect(menuRect.bottomRight, const Offset(800.0, 600.0));
......
...@@ -444,7 +444,7 @@ void main() { ...@@ -444,7 +444,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new MaterialApp( new MaterialApp(
home: new Align( home: new Align(
alignment: FractionalOffset.topLeft, alignment: Alignment.topLeft,
child: new SizedBox( child: new SizedBox(
width: 300.0, width: 300.0,
height: 200.0, height: 200.0,
......
This diff is collapsed.
...@@ -205,7 +205,7 @@ void main() { ...@@ -205,7 +205,7 @@ void main() {
image: new SynchronousTestImageProvider(), image: new SynchronousTestImageProvider(),
colorFilter: colorFilter, colorFilter: colorFilter,
fit: BoxFit.contain, fit: BoxFit.contain,
alignment: FractionalOffset.bottomLeft, alignment: Alignment.bottomLeft,
centerSlice: new Rect.fromLTWH(10.0, 20.0, 30.0, 40.0), centerSlice: new Rect.fromLTWH(10.0, 20.0, 30.0, 40.0),
repeat: ImageRepeat.repeatY, repeat: ImageRepeat.repeatY,
); );
......
...@@ -8,8 +8,8 @@ import 'package:flutter/painting.dart'; ...@@ -8,8 +8,8 @@ import 'package:flutter/painting.dart';
void main() { void main() {
test('LinearGradient scale test', () { test('LinearGradient scale test', () {
final LinearGradient testGradient = const LinearGradient( final LinearGradient testGradient = const LinearGradient(
begin: FractionalOffset.bottomRight, begin: Alignment.bottomRight,
end: const FractionalOffset(0.7, 1.0), end: const Alignment(0.7, 1.0),
colors: const <Color>[ colors: const <Color>[
const Color(0x00FFFFFF), const Color(0x00FFFFFF),
const Color(0x11777777), const Color(0x11777777),
...@@ -19,8 +19,8 @@ void main() { ...@@ -19,8 +19,8 @@ void main() {
final LinearGradient actual = LinearGradient.lerp(null, testGradient, 0.25); final LinearGradient actual = LinearGradient.lerp(null, testGradient, 0.25);
expect(actual, const LinearGradient( expect(actual, const LinearGradient(
begin: FractionalOffset.bottomRight, begin: Alignment.bottomRight,
end: const FractionalOffset(0.7, 1.0), end: const Alignment(0.7, 1.0),
colors: const <Color>[ colors: const <Color>[
const Color(0x00FFFFFF), const Color(0x00FFFFFF),
const Color(0x04777777), const Color(0x04777777),
...@@ -31,8 +31,8 @@ void main() { ...@@ -31,8 +31,8 @@ void main() {
test('LinearGradient lerp test', () { test('LinearGradient lerp test', () {
final LinearGradient testGradient1 = const LinearGradient( final LinearGradient testGradient1 = const LinearGradient(
begin: FractionalOffset.topLeft, begin: Alignment.topLeft,
end: FractionalOffset.bottomLeft, end: Alignment.bottomLeft,
colors: const <Color>[ colors: const <Color>[
const Color(0x33333333), const Color(0x33333333),
const Color(0x66666666), const Color(0x66666666),
...@@ -40,8 +40,8 @@ void main() { ...@@ -40,8 +40,8 @@ void main() {
); );
final LinearGradient testGradient2 = const LinearGradient( final LinearGradient testGradient2 = const LinearGradient(
begin: FractionalOffset.topRight, begin: Alignment.topRight,
end: FractionalOffset.topLeft, end: Alignment.topLeft,
colors: const <Color>[ colors: const <Color>[
const Color(0x44444444), const Color(0x44444444),
const Color(0x88888888), const Color(0x88888888),
...@@ -50,8 +50,8 @@ void main() { ...@@ -50,8 +50,8 @@ void main() {
final LinearGradient actual = LinearGradient.lerp(testGradient1, testGradient2, 0.5); final LinearGradient actual = LinearGradient.lerp(testGradient1, testGradient2, 0.5);
expect(actual, const LinearGradient( expect(actual, const LinearGradient(
begin: const FractionalOffset(0.5, 0.0), begin: const Alignment(0.0, -1.0),
end: const FractionalOffset(0.0, 0.5), end: const Alignment(-1.0, 0.0),
colors: const <Color>[ colors: const <Color>[
const Color(0x3B3B3B3B), const Color(0x3B3B3B3B),
const Color(0x77777777), const Color(0x77777777),
...@@ -62,24 +62,24 @@ void main() { ...@@ -62,24 +62,24 @@ void main() {
test('LinearGradient toString', () { test('LinearGradient toString', () {
expect( expect(
const LinearGradient( const LinearGradient(
begin: FractionalOffset.topLeft, begin: Alignment.topLeft,
end: FractionalOffset.bottomLeft, end: Alignment.bottomLeft,
colors: const <Color>[ colors: const <Color>[
const Color(0x33333333), const Color(0x33333333),
const Color(0x66666666), const Color(0x66666666),
], ],
).toString(), ).toString(),
equals( equals(
'LinearGradient(FractionalOffset.topLeft, FractionalOffset.bottomLeft, [Color(0x33333333), Color(0x66666666)], null, TileMode.clamp)', 'LinearGradient(Alignment.topLeft, Alignment.bottomLeft, [Color(0x33333333), Color(0x66666666)], null, TileMode.clamp)',
), ),
); );
}); });
test('LinearGradient with FractionalOffsetDirectional', () { test('LinearGradient with AlignmentDirectional', () {
expect( expect(
() { () {
return const LinearGradient( return const LinearGradient(
begin: FractionalOffsetDirectional.topStart, begin: AlignmentDirectional.topStart,
colors: const <Color>[ const Color(0xFFFFFFFF), const Color(0xFFFFFFFF) ] colors: const <Color>[ const Color(0xFFFFFFFF), const Color(0xFFFFFFFF) ]
).createShader(new Rect.fromLTWH(0.0, 0.0, 100.0, 100.0)); ).createShader(new Rect.fromLTWH(0.0, 0.0, 100.0, 100.0));
}, },
...@@ -88,7 +88,7 @@ void main() { ...@@ -88,7 +88,7 @@ void main() {
expect( expect(
() { () {
return const LinearGradient( return const LinearGradient(
begin: FractionalOffsetDirectional.topStart, begin: AlignmentDirectional.topStart,
colors: const <Color>[ const Color(0xFFFFFFFF), const Color(0xFFFFFFFF) ] colors: const <Color>[ const Color(0xFFFFFFFF), const Color(0xFFFFFFFF) ]
).createShader(new Rect.fromLTWH(0.0, 0.0, 100.0, 100.0), textDirection: TextDirection.rtl); ).createShader(new Rect.fromLTWH(0.0, 0.0, 100.0, 100.0), textDirection: TextDirection.rtl);
}, },
...@@ -97,7 +97,7 @@ void main() { ...@@ -97,7 +97,7 @@ void main() {
expect( expect(
() { () {
return const LinearGradient( return const LinearGradient(
begin: FractionalOffsetDirectional.topStart, begin: AlignmentDirectional.topStart,
colors: const <Color>[ const Color(0xFFFFFFFF), const Color(0xFFFFFFFF) ] colors: const <Color>[ const Color(0xFFFFFFFF), const Color(0xFFFFFFFF) ]
).createShader(new Rect.fromLTWH(0.0, 0.0, 100.0, 100.0), textDirection: TextDirection.ltr); ).createShader(new Rect.fromLTWH(0.0, 0.0, 100.0, 100.0), textDirection: TextDirection.ltr);
}, },
...@@ -106,7 +106,7 @@ void main() { ...@@ -106,7 +106,7 @@ void main() {
expect( expect(
() { () {
return const LinearGradient( return const LinearGradient(
begin: FractionalOffset.topLeft, begin: Alignment.topLeft,
colors: const <Color>[ const Color(0xFFFFFFFF), const Color(0xFFFFFFFF) ] colors: const <Color>[ const Color(0xFFFFFFFF), const Color(0xFFFFFFFF) ]
).createShader(new Rect.fromLTWH(0.0, 0.0, 100.0, 100.0)); ).createShader(new Rect.fromLTWH(0.0, 0.0, 100.0, 100.0));
}, },
...@@ -114,11 +114,11 @@ void main() { ...@@ -114,11 +114,11 @@ void main() {
); );
}); });
test('RadialGradient with FractionalOffsetDirectional', () { test('RadialGradient with AlignmentDirectional', () {
expect( expect(
() { () {
return const RadialGradient( return const RadialGradient(
center: FractionalOffsetDirectional.topStart, center: AlignmentDirectional.topStart,
colors: const <Color>[ const Color(0xFFFFFFFF), const Color(0xFFFFFFFF) ] colors: const <Color>[ const Color(0xFFFFFFFF), const Color(0xFFFFFFFF) ]
).createShader(new Rect.fromLTWH(0.0, 0.0, 100.0, 100.0)); ).createShader(new Rect.fromLTWH(0.0, 0.0, 100.0, 100.0));
}, },
...@@ -127,7 +127,7 @@ void main() { ...@@ -127,7 +127,7 @@ void main() {
expect( expect(
() { () {
return const RadialGradient( return const RadialGradient(
center: FractionalOffsetDirectional.topStart, center: AlignmentDirectional.topStart,
colors: const <Color>[ const Color(0xFFFFFFFF), const Color(0xFFFFFFFF) ] colors: const <Color>[ const Color(0xFFFFFFFF), const Color(0xFFFFFFFF) ]
).createShader(new Rect.fromLTWH(0.0, 0.0, 100.0, 100.0), textDirection: TextDirection.rtl); ).createShader(new Rect.fromLTWH(0.0, 0.0, 100.0, 100.0), textDirection: TextDirection.rtl);
}, },
...@@ -136,7 +136,7 @@ void main() { ...@@ -136,7 +136,7 @@ void main() {
expect( expect(
() { () {
return const RadialGradient( return const RadialGradient(
center: FractionalOffsetDirectional.topStart, center: AlignmentDirectional.topStart,
colors: const <Color>[ const Color(0xFFFFFFFF), const Color(0xFFFFFFFF) ] colors: const <Color>[ const Color(0xFFFFFFFF), const Color(0xFFFFFFFF) ]
).createShader(new Rect.fromLTWH(0.0, 0.0, 100.0, 100.0), textDirection: TextDirection.ltr); ).createShader(new Rect.fromLTWH(0.0, 0.0, 100.0, 100.0), textDirection: TextDirection.ltr);
}, },
...@@ -145,7 +145,7 @@ void main() { ...@@ -145,7 +145,7 @@ void main() {
expect( expect(
() { () {
return const RadialGradient( return const RadialGradient(
center: FractionalOffset.topLeft, center: Alignment.topLeft,
colors: const <Color>[ const Color(0xFFFFFFFF), const Color(0xFFFFFFFF) ] colors: const <Color>[ const Color(0xFFFFFFFF), const Color(0xFFFFFFFF) ]
).createShader(new Rect.fromLTWH(0.0, 0.0, 100.0, 100.0)); ).createShader(new Rect.fromLTWH(0.0, 0.0, 100.0, 100.0));
}, },
......
...@@ -39,7 +39,7 @@ void main() { ...@@ -39,7 +39,7 @@ void main() {
rect: new Rect.fromLTWH(50.0, 75.0, 200.0, 100.0), rect: new Rect.fromLTWH(50.0, 75.0, 200.0, 100.0),
image: image, image: image,
fit: BoxFit.cover, fit: BoxFit.cover,
alignment: const FractionalOffset(0.0, 0.5) alignment: const Alignment(-1.0, 0.0),
); );
final Invocation command = canvas.invocations.firstWhere((Invocation invocation) { final Invocation command = canvas.invocations.firstWhere((Invocation invocation) {
......
...@@ -13,7 +13,7 @@ void main() { ...@@ -13,7 +13,7 @@ void main() {
RenderBaseline parent; RenderBaseline parent;
RenderSizedBox child; RenderSizedBox child;
final RenderBox root = new RenderPositionedBox( final RenderBox root = new RenderPositionedBox(
alignment: FractionalOffset.topLeft, alignment: Alignment.topLeft,
child: parent = new RenderBaseline( child: parent = new RenderBaseline(
baseline: 0.0, baseline: 0.0,
baselineType: TextBaseline.alphabetic, baselineType: TextBaseline.alphabetic,
......
...@@ -14,7 +14,7 @@ void main() { ...@@ -14,7 +14,7 @@ void main() {
decoration: new BoxDecoration( decoration: new BoxDecoration(
color: const Color(0xFF00FF00), color: const Color(0xFF00FF00),
gradient: new RadialGradient( gradient: new RadialGradient(
center: FractionalOffset.topLeft, radius: 1.8, center: Alignment.topLeft, radius: 1.8,
colors: <Color>[Colors.yellow[500], Colors.blue[500]], colors: <Color>[Colors.yellow[500], Colors.blue[500]],
), ),
boxShadow: kElevationToShadow[3], boxShadow: kElevationToShadow[3],
......
...@@ -74,7 +74,7 @@ void main() { ...@@ -74,7 +74,7 @@ void main() {
' constraints: BoxConstraints(25.0<=w<=100.0, 25.0<=h<=100.0)\n' ' constraints: BoxConstraints(25.0<=w<=100.0, 25.0<=h<=100.0)\n'
' size: Size(25.0, 25.0)\n' ' size: Size(25.0, 25.0)\n'
' image: [10×10]\n' ' image: [10×10]\n'
' alignment: FractionalOffset.center\n' ' alignment: Alignment.center\n'
), ),
); );
......
...@@ -36,7 +36,7 @@ void main() { ...@@ -36,7 +36,7 @@ void main() {
' │ parentData: <none>\n' ' │ parentData: <none>\n'
' │ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' │ constraints: BoxConstraints(w=800.0, h=600.0)\n'
' │ size: Size(800.0, 600.0)\n' ' │ size: Size(800.0, 600.0)\n'
' │ alignment: FractionalOffset.center\n' ' │ alignment: Alignment.center\n'
' │ minWidth: 0.0\n' ' │ minWidth: 0.0\n'
' │ maxWidth: Infinity\n' ' │ maxWidth: Infinity\n'
' │ minHeight: 0.0\n' ' │ minHeight: 0.0\n'
...@@ -122,7 +122,7 @@ void main() { ...@@ -122,7 +122,7 @@ void main() {
' │ parentData: <none>\n' ' │ parentData: <none>\n'
' │ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' │ constraints: BoxConstraints(w=800.0, h=600.0)\n'
' │ size: Size(800.0, 600.0)\n' ' │ size: Size(800.0, 600.0)\n'
' │ alignment: FractionalOffset.center\n' ' │ alignment: Alignment.center\n'
' │ minWidth: 10.0\n' ' │ minWidth: 10.0\n'
' │ maxWidth: 500.0\n' ' │ maxWidth: 500.0\n'
' │ minHeight: 0.0\n' ' │ minHeight: 0.0\n'
...@@ -158,7 +158,7 @@ void main() { ...@@ -158,7 +158,7 @@ void main() {
' │ parentData: <none>\n' ' │ parentData: <none>\n'
' │ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' │ constraints: BoxConstraints(w=800.0, h=600.0)\n'
' │ size: Size(800.0, 600.0)\n' ' │ size: Size(800.0, 600.0)\n'
' │ alignment: FractionalOffset.center\n' ' │ alignment: Alignment.center\n'
' │ minWidth: 10.0\n' ' │ minWidth: 10.0\n'
' │ maxWidth: use parent maxWidth constraint\n' ' │ maxWidth: use parent maxWidth constraint\n'
' │ minHeight: use parent minHeight constraint\n' ' │ minHeight: use parent minHeight constraint\n'
......
...@@ -47,7 +47,7 @@ void main() { ...@@ -47,7 +47,7 @@ void main() {
RenderPositionedBox child; RenderPositionedBox child;
final RealRoot root = new RealRoot( final RealRoot root = new RealRoot(
child = new RenderPositionedBox( child = new RenderPositionedBox(
alignment: FractionalOffset.center, alignment: Alignment.center,
child: new RenderSizedBox(const Size(100.0, 100.0)) child: new RenderSizedBox(const Size(100.0, 100.0))
) )
); );
......
...@@ -23,9 +23,9 @@ void main() { ...@@ -23,9 +23,9 @@ void main() {
onPaint: () { onPaint: () {
baseline1 = child.getDistanceToBaseline(TextBaseline.alphabetic); baseline1 = child.getDistanceToBaseline(TextBaseline.alphabetic);
height1 = text.size.height; height1 = text.size.height;
} },
) ),
) ),
); );
layout(root, phase: EnginePhase.paint); layout(root, phase: EnginePhase.paint);
...@@ -37,15 +37,15 @@ void main() { ...@@ -37,15 +37,15 @@ void main() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
), ),
maxHeight: height1 / 2.0, maxHeight: height1 / 2.0,
alignment: const FractionalOffset(0.0, 0.0) alignment: Alignment.topLeft,
), ),
painter: new TestCallbackPainter( painter: new TestCallbackPainter(
onPaint: () { onPaint: () {
baseline2 = child.getDistanceToBaseline(TextBaseline.alphabetic); baseline2 = child.getDistanceToBaseline(TextBaseline.alphabetic);
height2 = text.size.height; height2 = text.size.height;
} },
) ),
) ),
); );
layout(root, phase: EnginePhase.paint); layout(root, phase: EnginePhase.paint);
......
...@@ -57,7 +57,7 @@ TestRenderingFlutterBinding get renderer { ...@@ -57,7 +57,7 @@ TestRenderingFlutterBinding get renderer {
/// has no build phase. /// has no build phase.
void layout(RenderBox box, { void layout(RenderBox box, {
BoxConstraints constraints, BoxConstraints constraints,
FractionalOffset alignment: FractionalOffset.center, Alignment alignment: Alignment.center,
EnginePhase phase: EnginePhase.layout, EnginePhase phase: EnginePhase.layout,
}) { }) {
assert(box != null); // If you want to just repump the last box, call pumpFrame(). assert(box != null); // If you want to just repump the last box, call pumpFrame().
......
...@@ -18,10 +18,10 @@ void main() { ...@@ -18,10 +18,10 @@ void main() {
RenderBox inner; RenderBox inner;
final RenderBox sizer = new RenderTransform( final RenderBox sizer = new RenderTransform(
transform: new Matrix4.identity(), transform: new Matrix4.identity(),
alignment: FractionalOffset.center, alignment: Alignment.center,
child: inner = new RenderSizedBox(const Size(100.0, 100.0)), child: inner = new RenderSizedBox(const Size(100.0, 100.0)),
); );
layout(sizer, constraints: new BoxConstraints.tight(const Size(100.0, 100.0)), alignment: FractionalOffset.topLeft); layout(sizer, constraints: new BoxConstraints.tight(const Size(100.0, 100.0)), alignment: Alignment.topLeft);
expect(inner.globalToLocal(const Offset(0.0, 0.0)), equals(const Offset(0.0, 0.0))); expect(inner.globalToLocal(const Offset(0.0, 0.0)), equals(const Offset(0.0, 0.0)));
expect(inner.globalToLocal(const Offset(100.0, 100.0)), equals(const Offset(100.0, 100.0))); expect(inner.globalToLocal(const Offset(100.0, 100.0)), equals(const Offset(100.0, 100.0)));
expect(inner.globalToLocal(const Offset(25.0, 75.0)), equals(const Offset(25.0, 75.0))); expect(inner.globalToLocal(const Offset(25.0, 75.0)), equals(const Offset(25.0, 75.0)));
...@@ -36,13 +36,13 @@ void main() { ...@@ -36,13 +36,13 @@ void main() {
RenderBox inner; RenderBox inner;
final RenderBox sizer = new RenderTransform( final RenderBox sizer = new RenderTransform(
transform: new Matrix4.identity(), transform: new Matrix4.identity(),
alignment: FractionalOffset.center, alignment: Alignment.center,
child: new RenderPadding( child: new RenderPadding(
padding: const EdgeInsets.only(left: 20.0), padding: const EdgeInsets.only(left: 20.0),
child: inner = new RenderSizedBox(const Size(80.0, 100.0)), child: inner = new RenderSizedBox(const Size(80.0, 100.0)),
), ),
); );
layout(sizer, constraints: new BoxConstraints.tight(const Size(100.0, 100.0)), alignment: FractionalOffset.topLeft); layout(sizer, constraints: new BoxConstraints.tight(const Size(100.0, 100.0)), alignment: Alignment.topLeft);
expect(inner.globalToLocal(const Offset(0.0, 0.0)), equals(const Offset(-20.0, 0.0))); expect(inner.globalToLocal(const Offset(0.0, 0.0)), equals(const Offset(-20.0, 0.0)));
expect(inner.globalToLocal(const Offset(100.0, 100.0)), equals(const Offset(80.0, 100.0))); expect(inner.globalToLocal(const Offset(100.0, 100.0)), equals(const Offset(80.0, 100.0)));
expect(inner.globalToLocal(const Offset(25.0, 75.0)), equals(const Offset(5.0, 75.0))); expect(inner.globalToLocal(const Offset(25.0, 75.0)), equals(const Offset(5.0, 75.0)));
...@@ -57,10 +57,10 @@ void main() { ...@@ -57,10 +57,10 @@ void main() {
RenderBox inner; RenderBox inner;
final RenderBox sizer = new RenderTransform( final RenderBox sizer = new RenderTransform(
transform: new Matrix4.translationValues(50.0, 200.0, 0.0), transform: new Matrix4.translationValues(50.0, 200.0, 0.0),
alignment: FractionalOffset.center, alignment: Alignment.center,
child: inner = new RenderSizedBox(const Size(100.0, 100.0)), child: inner = new RenderSizedBox(const Size(100.0, 100.0)),
); );
layout(sizer, constraints: new BoxConstraints.tight(const Size(100.0, 100.0)), alignment: FractionalOffset.topLeft); layout(sizer, constraints: new BoxConstraints.tight(const Size(100.0, 100.0)), alignment: Alignment.topLeft);
expect(inner.globalToLocal(const Offset(0.0, 0.0)), equals(const Offset(-50.0, -200.0))); expect(inner.globalToLocal(const Offset(0.0, 0.0)), equals(const Offset(-50.0, -200.0)));
expect(inner.globalToLocal(const Offset(100.0, 100.0)), equals(const Offset(50.0, -100.0))); expect(inner.globalToLocal(const Offset(100.0, 100.0)), equals(const Offset(50.0, -100.0)));
expect(inner.globalToLocal(const Offset(25.0, 75.0)), equals(const Offset(-25.0, -125.0))); expect(inner.globalToLocal(const Offset(25.0, 75.0)), equals(const Offset(-25.0, -125.0)));
...@@ -75,13 +75,13 @@ void main() { ...@@ -75,13 +75,13 @@ void main() {
RenderBox inner; RenderBox inner;
final RenderBox sizer = new RenderTransform( final RenderBox sizer = new RenderTransform(
transform: new Matrix4.translationValues(50.0, 200.0, 0.0), transform: new Matrix4.translationValues(50.0, 200.0, 0.0),
alignment: FractionalOffset.center, alignment: Alignment.center,
child: new RenderPadding( child: new RenderPadding(
padding: const EdgeInsets.only(left: 20.0), padding: const EdgeInsets.only(left: 20.0),
child: inner = new RenderSizedBox(const Size(80.0, 100.0)), child: inner = new RenderSizedBox(const Size(80.0, 100.0)),
), ),
); );
layout(sizer, constraints: new BoxConstraints.tight(const Size(100.0, 100.0)), alignment: FractionalOffset.topLeft); layout(sizer, constraints: new BoxConstraints.tight(const Size(100.0, 100.0)), alignment: Alignment.topLeft);
expect(inner.globalToLocal(const Offset(0.0, 0.0)), equals(const Offset(-70.0, -200.0))); expect(inner.globalToLocal(const Offset(0.0, 0.0)), equals(const Offset(-70.0, -200.0)));
expect(inner.globalToLocal(const Offset(100.0, 100.0)), equals(const Offset(30.0, -100.0))); expect(inner.globalToLocal(const Offset(100.0, 100.0)), equals(const Offset(30.0, -100.0)));
expect(inner.globalToLocal(const Offset(25.0, 75.0)), equals(const Offset(-45.0, -125.0))); expect(inner.globalToLocal(const Offset(25.0, 75.0)), equals(const Offset(-45.0, -125.0)));
...@@ -96,10 +96,10 @@ void main() { ...@@ -96,10 +96,10 @@ void main() {
RenderBox inner; RenderBox inner;
final RenderBox sizer = new RenderTransform( final RenderBox sizer = new RenderTransform(
transform: new Matrix4.rotationZ(math.PI), transform: new Matrix4.rotationZ(math.PI),
alignment: FractionalOffset.center, alignment: Alignment.center,
child: inner = new RenderSizedBox(const Size(100.0, 100.0)), child: inner = new RenderSizedBox(const Size(100.0, 100.0)),
); );
layout(sizer, constraints: new BoxConstraints.tight(const Size(100.0, 100.0)), alignment: FractionalOffset.topLeft); layout(sizer, constraints: new BoxConstraints.tight(const Size(100.0, 100.0)), alignment: Alignment.topLeft);
expect(round(inner.globalToLocal(const Offset(0.0, 0.0))), equals(const Offset(100.0, 100.0))); expect(round(inner.globalToLocal(const Offset(0.0, 0.0))), equals(const Offset(100.0, 100.0)));
expect(round(inner.globalToLocal(const Offset(100.0, 100.0))), equals(const Offset(0.0, 0.0))); expect(round(inner.globalToLocal(const Offset(100.0, 100.0))), equals(const Offset(0.0, 0.0)));
expect(round(inner.globalToLocal(const Offset(25.0, 75.0))), equals(const Offset(75.0, 25.0))); expect(round(inner.globalToLocal(const Offset(25.0, 75.0))), equals(const Offset(75.0, 25.0)));
...@@ -114,13 +114,13 @@ void main() { ...@@ -114,13 +114,13 @@ void main() {
RenderBox inner; RenderBox inner;
final RenderBox sizer = new RenderTransform( final RenderBox sizer = new RenderTransform(
transform: new Matrix4.rotationZ(math.PI), transform: new Matrix4.rotationZ(math.PI),
alignment: FractionalOffset.center, alignment: Alignment.center,
child: new RenderPadding( child: new RenderPadding(
padding: const EdgeInsets.only(left: 20.0), padding: const EdgeInsets.only(left: 20.0),
child: inner = new RenderSizedBox(const Size(80.0, 100.0)), child: inner = new RenderSizedBox(const Size(80.0, 100.0)),
), ),
); );
layout(sizer, constraints: new BoxConstraints.tight(const Size(100.0, 100.0)), alignment: FractionalOffset.topLeft); layout(sizer, constraints: new BoxConstraints.tight(const Size(100.0, 100.0)), alignment: Alignment.topLeft);
expect(round(inner.globalToLocal(const Offset(0.0, 0.0))), equals(const Offset(80.0, 100.0))); expect(round(inner.globalToLocal(const Offset(0.0, 0.0))), equals(const Offset(80.0, 100.0)));
expect(round(inner.globalToLocal(const Offset(100.0, 100.0))), equals(const Offset(-20.0, 0.0))); expect(round(inner.globalToLocal(const Offset(100.0, 100.0))), equals(const Offset(-20.0, 0.0)));
expect(round(inner.globalToLocal(const Offset(25.0, 75.0))), equals(const Offset(55.0, 25.0))); expect(round(inner.globalToLocal(const Offset(25.0, 75.0))), equals(const Offset(55.0, 25.0)));
...@@ -135,10 +135,10 @@ void main() { ...@@ -135,10 +135,10 @@ void main() {
RenderBox inner; RenderBox inner;
final RenderBox sizer = new RenderTransform( final RenderBox sizer = new RenderTransform(
transform: rotateAroundXAxis(math.PI * 0.25), // at pi/4, we are about 70 pixels high transform: rotateAroundXAxis(math.PI * 0.25), // at pi/4, we are about 70 pixels high
alignment: FractionalOffset.center, alignment: Alignment.center,
child: inner = new RenderSizedBox(const Size(100.0, 100.0)), child: inner = new RenderSizedBox(const Size(100.0, 100.0)),
); );
layout(sizer, constraints: new BoxConstraints.tight(const Size(100.0, 100.0)), alignment: FractionalOffset.topLeft); layout(sizer, constraints: new BoxConstraints.tight(const Size(100.0, 100.0)), alignment: Alignment.topLeft);
expect(round(inner.globalToLocal(const Offset(25.0, 50.0))), equals(const Offset(25.0, 50.0))); expect(round(inner.globalToLocal(const Offset(25.0, 50.0))), equals(const Offset(25.0, 50.0)));
expect(inner.globalToLocal(const Offset(25.0, 17.0)).dy, greaterThan(0.0)); expect(inner.globalToLocal(const Offset(25.0, 17.0)).dy, greaterThan(0.0));
...@@ -152,10 +152,10 @@ void main() { ...@@ -152,10 +152,10 @@ void main() {
RenderBox inner; RenderBox inner;
final RenderBox sizer = new RenderTransform( final RenderBox sizer = new RenderTransform(
transform: rotateAroundXAxis(math.PI * 0.4999), // at pi/2, we're seeing the box on its edge, transform: rotateAroundXAxis(math.PI * 0.4999), // at pi/2, we're seeing the box on its edge,
alignment: FractionalOffset.center, alignment: Alignment.center,
child: inner = new RenderSizedBox(const Size(100.0, 100.0)), child: inner = new RenderSizedBox(const Size(100.0, 100.0)),
); );
layout(sizer, constraints: new BoxConstraints.tight(const Size(100.0, 100.0)), alignment: FractionalOffset.topLeft); layout(sizer, constraints: new BoxConstraints.tight(const Size(100.0, 100.0)), alignment: Alignment.topLeft);
// the inner widget has a height of about half a pixel at this rotation, so // the inner widget has a height of about half a pixel at this rotation, so
// everything should end up around the middle of the outer box. // everything should end up around the middle of the outer box.
......
...@@ -11,34 +11,34 @@ void main() { ...@@ -11,34 +11,34 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new Align( new Align(
child: new Container(), child: new Container(),
alignment: const FractionalOffset(0.75, 0.75), alignment: const Alignment(0.50, 0.50),
), ),
); );
await tester.pumpWidget( await tester.pumpWidget(
new Align( new Align(
child: new Container(), child: new Container(),
alignment: const FractionalOffset(0.5, 0.5), alignment: const Alignment(0.0, 0.0),
), ),
); );
await tester.pumpWidget( await tester.pumpWidget(
const Align( const Align(
key: const GlobalObjectKey<Null>(null), key: const GlobalObjectKey<Null>(null),
alignment: FractionalOffset.topLeft, alignment: Alignment.topLeft,
), ),
); );
await tester.pumpWidget(const Directionality( await tester.pumpWidget(const Directionality(
textDirection: TextDirection.rtl, textDirection: TextDirection.rtl,
child: const Align( child: const Align(
key: const GlobalObjectKey<Null>(null), key: const GlobalObjectKey<Null>(null),
alignment: FractionalOffsetDirectional.topStart, alignment: AlignmentDirectional.topStart,
), ),
)); ));
await tester.pumpWidget( await tester.pumpWidget(
const Align( const Align(
key: const GlobalObjectKey<Null>(null), key: const GlobalObjectKey<Null>(null),
alignment: FractionalOffset.topLeft, alignment: Alignment.topLeft,
), ),
); );
}); });
...@@ -48,7 +48,7 @@ void main() { ...@@ -48,7 +48,7 @@ void main() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: new Align( child: new Align(
child: new Container(width: 100.0, height: 80.0), child: new Container(width: 100.0, height: 80.0),
alignment: FractionalOffsetDirectional.topStart, alignment: AlignmentDirectional.topStart,
), ),
)); ));
...@@ -59,7 +59,7 @@ void main() { ...@@ -59,7 +59,7 @@ void main() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: new Align( child: new Align(
child: new Container(width: 100.0, height: 80.0), child: new Container(width: 100.0, height: 80.0),
alignment: FractionalOffset.topLeft, alignment: Alignment.topLeft,
), ),
)); ));
...@@ -72,7 +72,7 @@ void main() { ...@@ -72,7 +72,7 @@ void main() {
textDirection: TextDirection.rtl, textDirection: TextDirection.rtl,
child: new Align( child: new Align(
child: new Container(width: 100.0, height: 80.0), child: new Container(width: 100.0, height: 80.0),
alignment: FractionalOffsetDirectional.topStart, alignment: AlignmentDirectional.topStart,
), ),
)); ));
...@@ -83,7 +83,7 @@ void main() { ...@@ -83,7 +83,7 @@ void main() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: new Align( child: new Align(
child: new Container(width: 100.0, height: 80.0), child: new Container(width: 100.0, height: 80.0),
alignment: FractionalOffset.topLeft, alignment: Alignment.topLeft,
), ),
)); ));
...@@ -101,7 +101,7 @@ void main() { ...@@ -101,7 +101,7 @@ void main() {
width: 10.0, width: 10.0,
height: 10.0 height: 10.0
), ),
alignment: const FractionalOffset(0.50, 0.50), alignment: const Alignment(0.0, 0.0),
), ),
), ),
); );
......
...@@ -183,7 +183,7 @@ void main() { ...@@ -183,7 +183,7 @@ void main() {
textDirection: TextDirection.rtl, textDirection: TextDirection.rtl,
child: new AnimatedContainer( child: new AnimatedContainer(
duration: const Duration(milliseconds: 200), duration: const Duration(milliseconds: 200),
alignment: FractionalOffset.topRight, alignment: Alignment.topRight,
child: new SizedBox(key: target, width: 100.0, height: 200.0), child: new SizedBox(key: target, width: 100.0, height: 200.0),
), ),
), ),
...@@ -197,7 +197,7 @@ void main() { ...@@ -197,7 +197,7 @@ void main() {
textDirection: TextDirection.rtl, textDirection: TextDirection.rtl,
child: new AnimatedContainer( child: new AnimatedContainer(
duration: const Duration(milliseconds: 200), duration: const Duration(milliseconds: 200),
alignment: FractionalOffsetDirectional.bottomStart, alignment: AlignmentDirectional.bottomStart,
child: new SizedBox(key: target, width: 100.0, height: 200.0), child: new SizedBox(key: target, width: 100.0, height: 200.0),
), ),
), ),
......
...@@ -98,7 +98,7 @@ void main() { ...@@ -98,7 +98,7 @@ void main() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: new Center( child: new Center(
child: new AnimatedCrossFade( child: new AnimatedCrossFade(
alignment: FractionalOffset.bottomRight, alignment: Alignment.bottomRight,
firstChild: new SizedBox( firstChild: new SizedBox(
key: firstKey, key: firstKey,
width: 100.0, width: 100.0,
...@@ -121,7 +121,7 @@ void main() { ...@@ -121,7 +121,7 @@ void main() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: new Center( child: new Center(
child: new AnimatedCrossFade( child: new AnimatedCrossFade(
alignment: FractionalOffset.bottomRight, alignment: Alignment.bottomRight,
firstChild: new SizedBox( firstChild: new SizedBox(
key: firstKey, key: firstKey,
width: 100.0, width: 100.0,
...@@ -156,7 +156,7 @@ void main() { ...@@ -156,7 +156,7 @@ void main() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: new Center( child: new Center(
child: new AnimatedCrossFade( child: new AnimatedCrossFade(
alignment: FractionalOffsetDirectional.bottomEnd, alignment: AlignmentDirectional.bottomEnd,
firstChild: new SizedBox( firstChild: new SizedBox(
key: firstKey, key: firstKey,
width: 100.0, width: 100.0,
...@@ -179,7 +179,7 @@ void main() { ...@@ -179,7 +179,7 @@ void main() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: new Center( child: new Center(
child: new AnimatedCrossFade( child: new AnimatedCrossFade(
alignment: FractionalOffsetDirectional.bottomEnd, alignment: AlignmentDirectional.bottomEnd,
firstChild: new SizedBox( firstChild: new SizedBox(
key: firstKey, key: firstKey,
width: 100.0, width: 100.0,
...@@ -214,7 +214,7 @@ void main() { ...@@ -214,7 +214,7 @@ void main() {
textDirection: TextDirection.rtl, textDirection: TextDirection.rtl,
child: new Center( child: new Center(
child: new AnimatedCrossFade( child: new AnimatedCrossFade(
alignment: FractionalOffsetDirectional.bottomEnd, alignment: AlignmentDirectional.bottomEnd,
firstChild: new SizedBox( firstChild: new SizedBox(
key: firstKey, key: firstKey,
width: 100.0, width: 100.0,
...@@ -237,7 +237,7 @@ void main() { ...@@ -237,7 +237,7 @@ void main() {
textDirection: TextDirection.rtl, textDirection: TextDirection.rtl,
child: new Center( child: new Center(
child: new AnimatedCrossFade( child: new AnimatedCrossFade(
alignment: FractionalOffsetDirectional.bottomEnd, alignment: AlignmentDirectional.bottomEnd,
firstChild: new SizedBox( firstChild: new SizedBox(
key: firstKey, key: firstKey,
width: 100.0, width: 100.0,
......
...@@ -107,7 +107,7 @@ void main() { ...@@ -107,7 +107,7 @@ void main() {
testWidgets('ClipRect', (WidgetTester tester) async { testWidgets('ClipRect', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
new Align( new Align(
alignment: FractionalOffset.topLeft, alignment: Alignment.topLeft,
child: new SizedBox( child: new SizedBox(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
...@@ -131,7 +131,7 @@ void main() { ...@@ -131,7 +131,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new Align( new Align(
alignment: FractionalOffset.topLeft, alignment: Alignment.topLeft,
child: new SizedBox( child: new SizedBox(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
...@@ -149,7 +149,7 @@ void main() { ...@@ -149,7 +149,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new Align( new Align(
alignment: FractionalOffset.topLeft, alignment: Alignment.topLeft,
child: new SizedBox( child: new SizedBox(
width: 200.0, width: 200.0,
height: 200.0, height: 200.0,
...@@ -167,7 +167,7 @@ void main() { ...@@ -167,7 +167,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new Align( new Align(
alignment: FractionalOffset.topLeft, alignment: Alignment.topLeft,
child: new SizedBox( child: new SizedBox(
width: 200.0, width: 200.0,
height: 200.0, height: 200.0,
...@@ -185,7 +185,7 @@ void main() { ...@@ -185,7 +185,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new Align( new Align(
alignment: FractionalOffset.topLeft, alignment: Alignment.topLeft,
child: new SizedBox( child: new SizedBox(
width: 200.0, width: 200.0,
height: 200.0, height: 200.0,
...@@ -203,7 +203,7 @@ void main() { ...@@ -203,7 +203,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new Align( new Align(
alignment: FractionalOffset.topLeft, alignment: Alignment.topLeft,
child: new SizedBox( child: new SizedBox(
width: 200.0, width: 200.0,
height: 200.0, height: 200.0,
......
...@@ -10,7 +10,7 @@ import '../rendering/mock_canvas.dart'; ...@@ -10,7 +10,7 @@ import '../rendering/mock_canvas.dart';
void main() { void main() {
testWidgets('Container control test', (WidgetTester tester) async { testWidgets('Container control test', (WidgetTester tester) async {
final Container container = new Container( final Container container = new Container(
alignment: FractionalOffset.bottomRight, alignment: Alignment.bottomRight,
padding: const EdgeInsets.all(7.0), padding: const EdgeInsets.all(7.0),
// uses color, not decoration: // uses color, not decoration:
color: const Color(0xFF00FF00), color: const Color(0xFF00FF00),
...@@ -37,7 +37,7 @@ void main() { ...@@ -37,7 +37,7 @@ void main() {
expect(container, hasOneLineDescription); expect(container, hasOneLineDescription);
await tester.pumpWidget(new Align( await tester.pumpWidget(new Align(
alignment: FractionalOffset.topLeft, alignment: Alignment.topLeft,
child: container child: container
)); ));
...@@ -96,7 +96,7 @@ void main() { ...@@ -96,7 +96,7 @@ void main() {
' │ parentData: offset=Offset(7.0, 7.0) (can use size)\n' ' │ parentData: offset=Offset(7.0, 7.0) (can use size)\n'
' │ constraints: BoxConstraints(w=39.0, h=64.0)\n' ' │ constraints: BoxConstraints(w=39.0, h=64.0)\n'
' │ size: Size(39.0, 64.0)\n' ' │ size: Size(39.0, 64.0)\n'
' │ alignment: FractionalOffset.bottomRight\n' ' │ alignment: Alignment.bottomRight\n'
' │ widthFactor: expand\n' ' │ widthFactor: expand\n'
' │ heightFactor: expand\n' ' │ heightFactor: expand\n'
' │\n' ' │\n'
...@@ -173,7 +173,7 @@ void main() { ...@@ -173,7 +173,7 @@ void main() {
' │ parentData: offset=Offset(7.0, 7.0) (can use size)\n' ' │ parentData: offset=Offset(7.0, 7.0) (can use size)\n'
' │ constraints: BoxConstraints(w=39.0, h=64.0)\n' ' │ constraints: BoxConstraints(w=39.0, h=64.0)\n'
' │ size: Size(39.0, 64.0)\n' ' │ size: Size(39.0, 64.0)\n'
' │ alignment: FractionalOffset.bottomRight\n' ' │ alignment: Alignment.bottomRight\n'
' │ widthFactor: expand\n' ' │ widthFactor: expand\n'
' │ heightFactor: expand\n' ' │ heightFactor: expand\n'
' │\n' ' │\n'
...@@ -281,7 +281,7 @@ void main() { ...@@ -281,7 +281,7 @@ void main() {
' │ layer: null\n' ' │ layer: null\n'
' │ semantics node: null\n' ' │ semantics node: null\n'
' │ size: Size(39.0, 64.0)\n' ' │ size: Size(39.0, 64.0)\n'
' │ alignment: FractionalOffset.bottomRight\n' ' │ alignment: Alignment.bottomRight\n'
' │ textDirection: null\n' ' │ textDirection: null\n'
' │ widthFactor: expand\n' ' │ widthFactor: expand\n'
' │ heightFactor: expand\n' ' │ heightFactor: expand\n'
...@@ -412,7 +412,7 @@ void main() { ...@@ -412,7 +412,7 @@ void main() {
' │ isBlockingSemanticsOfPreviouslyPaintedNodes: false\n' ' │ isBlockingSemanticsOfPreviouslyPaintedNodes: false\n'
' │ isSemanticBoundary: false\n' ' │ isSemanticBoundary: false\n'
' │ size: Size(39.0, 64.0)\n' ' │ size: Size(39.0, 64.0)\n'
' │ alignment: FractionalOffset.bottomRight\n' ' │ alignment: Alignment.bottomRight\n'
' │ textDirection: null\n' ' │ textDirection: null\n'
' │ widthFactor: expand\n' ' │ widthFactor: expand\n'
' │ heightFactor: expand\n' ' │ heightFactor: expand\n'
......
...@@ -14,7 +14,7 @@ void main() { ...@@ -14,7 +14,7 @@ void main() {
maxWidth: 100.0, maxWidth: 100.0,
minHeight: 0.0, minHeight: 0.0,
maxHeight: 100.0, maxHeight: 100.0,
alignment: const FractionalOffset(0.0, 0.0), alignment: const Alignment(-1.0, -1.0),
child: new Center( child: new Center(
child: new FractionallySizedBox( child: new FractionallySizedBox(
widthFactor: 0.5, widthFactor: 0.5,
......
...@@ -312,7 +312,7 @@ void main() { ...@@ -312,7 +312,7 @@ void main() {
routes: <String, WidgetBuilder>{ routes: <String, WidgetBuilder>{
'/next': (BuildContext context) { '/next': (BuildContext context) {
return new Align( return new Align(
alignment: FractionalOffset.topLeft, alignment: Alignment.topLeft,
child: new Hero( child: new Hero(
tag: 'foo', tag: 'foo',
child: new GestureDetector( child: new GestureDetector(
......
...@@ -49,7 +49,7 @@ void main() { ...@@ -49,7 +49,7 @@ void main() {
decoration: new BoxDecoration( decoration: new BoxDecoration(
image: new DecorationImage( image: new DecorationImage(
image: new TestImageProvider(), image: new TestImageProvider(),
alignment: FractionalOffsetDirectional.topEnd, alignment: AlignmentDirectional.topEnd,
repeat: ImageRepeat.repeatX, repeat: ImageRepeat.repeatX,
matchTextDirection: true, matchTextDirection: true,
), ),
...@@ -88,7 +88,7 @@ void main() { ...@@ -88,7 +88,7 @@ void main() {
decoration: new BoxDecoration( decoration: new BoxDecoration(
image: new DecorationImage( image: new DecorationImage(
image: new TestImageProvider(), image: new TestImageProvider(),
alignment: FractionalOffsetDirectional.topEnd, alignment: AlignmentDirectional.topEnd,
repeat: ImageRepeat.repeatX, repeat: ImageRepeat.repeatX,
matchTextDirection: true, matchTextDirection: true,
), ),
...@@ -124,7 +124,7 @@ void main() { ...@@ -124,7 +124,7 @@ void main() {
decoration: new BoxDecoration( decoration: new BoxDecoration(
image: new DecorationImage( image: new DecorationImage(
image: new TestImageProvider(), image: new TestImageProvider(),
alignment: FractionalOffsetDirectional.topEnd, alignment: AlignmentDirectional.topEnd,
repeat: ImageRepeat.repeatX, repeat: ImageRepeat.repeatX,
), ),
), ),
...@@ -159,7 +159,7 @@ void main() { ...@@ -159,7 +159,7 @@ void main() {
decoration: new BoxDecoration( decoration: new BoxDecoration(
image: new DecorationImage( image: new DecorationImage(
image: new TestImageProvider(), image: new TestImageProvider(),
alignment: FractionalOffsetDirectional.topEnd, alignment: AlignmentDirectional.topEnd,
repeat: ImageRepeat.repeatX, repeat: ImageRepeat.repeatX,
), ),
), ),
...@@ -194,7 +194,7 @@ void main() { ...@@ -194,7 +194,7 @@ void main() {
decoration: new BoxDecoration( decoration: new BoxDecoration(
image: new DecorationImage( image: new DecorationImage(
image: new TestImageProvider(), image: new TestImageProvider(),
alignment: FractionalOffset.centerRight, alignment: Alignment.centerRight,
matchTextDirection: true, matchTextDirection: true,
), ),
), ),
...@@ -226,7 +226,7 @@ void main() { ...@@ -226,7 +226,7 @@ void main() {
decoration: new BoxDecoration( decoration: new BoxDecoration(
image: new DecorationImage( image: new DecorationImage(
image: new TestImageProvider(), image: new TestImageProvider(),
alignment: FractionalOffset.centerRight, alignment: Alignment.centerRight,
), ),
), ),
), ),
...@@ -253,7 +253,7 @@ void main() { ...@@ -253,7 +253,7 @@ void main() {
decoration: new BoxDecoration( decoration: new BoxDecoration(
image: new DecorationImage( image: new DecorationImage(
image: new TestImageProvider(), image: new TestImageProvider(),
alignment: FractionalOffset.centerRight, alignment: Alignment.centerRight,
matchTextDirection: true matchTextDirection: true
), ),
), ),
...@@ -281,7 +281,7 @@ void main() { ...@@ -281,7 +281,7 @@ void main() {
decoration: new BoxDecoration( decoration: new BoxDecoration(
image: new DecorationImage( image: new DecorationImage(
image: new TestImageProvider(), image: new TestImageProvider(),
alignment: FractionalOffset.centerRight, alignment: Alignment.centerRight,
matchTextDirection: true matchTextDirection: true
), ),
), ),
...@@ -308,7 +308,7 @@ void main() { ...@@ -308,7 +308,7 @@ void main() {
height: 50.0, height: 50.0,
child: new Image( child: new Image(
image: new TestImageProvider(), image: new TestImageProvider(),
alignment: FractionalOffsetDirectional.topEnd, alignment: AlignmentDirectional.topEnd,
repeat: ImageRepeat.repeatX, repeat: ImageRepeat.repeatX,
matchTextDirection: true, matchTextDirection: true,
), ),
...@@ -345,7 +345,7 @@ void main() { ...@@ -345,7 +345,7 @@ void main() {
height: 50.0, height: 50.0,
child: new Image( child: new Image(
image: new TestImageProvider(), image: new TestImageProvider(),
alignment: FractionalOffsetDirectional.topEnd, alignment: AlignmentDirectional.topEnd,
repeat: ImageRepeat.repeatX, repeat: ImageRepeat.repeatX,
matchTextDirection: true, matchTextDirection: true,
), ),
...@@ -379,7 +379,7 @@ void main() { ...@@ -379,7 +379,7 @@ void main() {
height: 50.0, height: 50.0,
child: new Image( child: new Image(
image: new TestImageProvider(), image: new TestImageProvider(),
alignment: FractionalOffsetDirectional.topEnd, alignment: AlignmentDirectional.topEnd,
repeat: ImageRepeat.repeatX, repeat: ImageRepeat.repeatX,
), ),
), ),
...@@ -412,7 +412,7 @@ void main() { ...@@ -412,7 +412,7 @@ void main() {
height: 50.0, height: 50.0,
child: new Image( child: new Image(
image: new TestImageProvider(), image: new TestImageProvider(),
alignment: FractionalOffsetDirectional.topEnd, alignment: AlignmentDirectional.topEnd,
repeat: ImageRepeat.repeatX, repeat: ImageRepeat.repeatX,
), ),
), ),
...@@ -445,7 +445,7 @@ void main() { ...@@ -445,7 +445,7 @@ void main() {
height: 50.0, height: 50.0,
child: new Image( child: new Image(
image: new TestImageProvider(), image: new TestImageProvider(),
alignment: FractionalOffset.centerRight, alignment: Alignment.centerRight,
matchTextDirection: true, matchTextDirection: true,
), ),
), ),
...@@ -475,7 +475,7 @@ void main() { ...@@ -475,7 +475,7 @@ void main() {
height: 50.0, height: 50.0,
child: new Image( child: new Image(
image: new TestImageProvider(), image: new TestImageProvider(),
alignment: FractionalOffset.centerRight, alignment: Alignment.centerRight,
), ),
), ),
), ),
...@@ -500,7 +500,7 @@ void main() { ...@@ -500,7 +500,7 @@ void main() {
height: 50.0, height: 50.0,
child: new Image( child: new Image(
image: new TestImageProvider(), image: new TestImageProvider(),
alignment: FractionalOffset.centerRight, alignment: Alignment.centerRight,
matchTextDirection: true matchTextDirection: true
), ),
), ),
...@@ -526,7 +526,7 @@ void main() { ...@@ -526,7 +526,7 @@ void main() {
height: 50.0, height: 50.0,
child: new Image( child: new Image(
image: new TestImageProvider(), image: new TestImageProvider(),
alignment: FractionalOffset.centerRight, alignment: Alignment.centerRight,
matchTextDirection: true matchTextDirection: true
), ),
), ),
...@@ -548,7 +548,7 @@ void main() { ...@@ -548,7 +548,7 @@ void main() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: new Image( child: new Image(
image: new TestImageProvider(), image: new TestImageProvider(),
alignment: FractionalOffset.centerRight, alignment: Alignment.centerRight,
matchTextDirection: false, matchTextDirection: false,
), ),
), ),
...@@ -560,7 +560,7 @@ void main() { ...@@ -560,7 +560,7 @@ void main() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: new Image( child: new Image(
image: new TestImageProvider(), image: new TestImageProvider(),
alignment: FractionalOffsetDirectional.centerEnd, alignment: AlignmentDirectional.centerEnd,
matchTextDirection: true, matchTextDirection: true,
), ),
), ),
...@@ -572,7 +572,7 @@ void main() { ...@@ -572,7 +572,7 @@ void main() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: new Image( child: new Image(
image: new TestImageProvider(), image: new TestImageProvider(),
alignment: FractionalOffset.centerRight, alignment: Alignment.centerRight,
matchTextDirection: false, matchTextDirection: false,
), ),
), ),
......
...@@ -10,7 +10,7 @@ void main() { ...@@ -10,7 +10,7 @@ void main() {
testWidgets('OverflowBox control test', (WidgetTester tester) async { testWidgets('OverflowBox control test', (WidgetTester tester) async {
final GlobalKey inner = new GlobalKey(); final GlobalKey inner = new GlobalKey();
await tester.pumpWidget(new Align( await tester.pumpWidget(new Align(
alignment: const FractionalOffset(1.0, 1.0), alignment: const Alignment(1.0, 1.0),
child: new SizedBox( child: new SizedBox(
width: 10.0, width: 10.0,
height: 20.0, height: 20.0,
...@@ -42,7 +42,7 @@ void main() { ...@@ -42,7 +42,7 @@ void main() {
.where((DiagnosticsNode n) => !n.isFiltered(DiagnosticLevel.info)) .where((DiagnosticsNode n) => !n.isFiltered(DiagnosticLevel.info))
.map((DiagnosticsNode n) => n.toString()).toList(); .map((DiagnosticsNode n) => n.toString()).toList();
expect(description, <String>[ expect(description, <String>[
'alignment: FractionalOffset.center', 'alignment: Alignment.center',
'minWidth: 1.0', 'minWidth: 1.0',
'maxWidth: 2.0', 'maxWidth: 2.0',
'minHeight: 3.0', 'minHeight: 3.0',
......
...@@ -46,7 +46,7 @@ void main() { ...@@ -46,7 +46,7 @@ void main() {
' ╎ │ size)\n' ' ╎ │ size)\n'
' ╎ │ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' ╎ │ constraints: BoxConstraints(w=800.0, h=600.0)\n'
' ╎ │ size: Size(800.0, 600.0)\n' ' ╎ │ size: Size(800.0, 600.0)\n'
' ╎ │ alignment: FractionalOffsetDirectional.topStart\n' ' ╎ │ alignment: AlignmentDirectional.topStart\n'
' ╎ │ textDirection: ltr\n' ' ╎ │ textDirection: ltr\n'
' ╎ │ fit: expand\n' ' ╎ │ fit: expand\n'
' ╎ │ overflow: clip\n' ' ╎ │ overflow: clip\n'
...@@ -113,7 +113,7 @@ void main() { ...@@ -113,7 +113,7 @@ void main() {
' ╎ │ size)\n' ' ╎ │ size)\n'
' ╎ │ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' ╎ │ constraints: BoxConstraints(w=800.0, h=600.0)\n'
' ╎ │ size: Size(800.0, 600.0)\n' ' ╎ │ size: Size(800.0, 600.0)\n'
' ╎ │ alignment: FractionalOffsetDirectional.topStart\n' ' ╎ │ alignment: AlignmentDirectional.topStart\n'
' ╎ │ textDirection: ltr\n' ' ╎ │ textDirection: ltr\n'
' ╎ │ fit: expand\n' ' ╎ │ fit: expand\n'
' ╎ │ overflow: clip\n' ' ╎ │ overflow: clip\n'
......
...@@ -9,8 +9,8 @@ import 'package:flutter/widgets.dart'; ...@@ -9,8 +9,8 @@ import 'package:flutter/widgets.dart';
Shader createShader(Rect bounds) { Shader createShader(Rect bounds) {
return new LinearGradient( return new LinearGradient(
begin: FractionalOffset.topLeft, begin: Alignment.topCenter,
end: FractionalOffset.bottomLeft, end: Alignment.bottomCenter,
colors: <Color>[const Color(0x00FFFFFF), const Color(0xFFFFFFFF)], colors: <Color>[const Color(0x00FFFFFF), const Color(0xFFFFFFFF)],
stops: <double>[0.1, 0.35] stops: <double>[0.1, 0.35]
).createShader(bounds); ).createShader(bounds);
...@@ -31,7 +31,7 @@ void main() { ...@@ -31,7 +31,7 @@ void main() {
} }
final Widget widget = new Align( final Widget widget = new Align(
alignment: FractionalOffset.center, alignment: Alignment.center,
child: new SizedBox( child: new SizedBox(
width: 400.0, width: 400.0,
height: 400.0, height: 400.0,
......
...@@ -15,7 +15,7 @@ class TestItem extends StatelessWidget { ...@@ -15,7 +15,7 @@ class TestItem extends StatelessWidget {
return new Container( return new Container(
width: width, width: width,
height: height, height: height,
alignment: FractionalOffset.center, alignment: Alignment.center,
child: new Text('Item $item', textDirection: TextDirection.ltr), child: new Text('Item $item', textDirection: TextDirection.ltr),
); );
} }
......
...@@ -41,7 +41,7 @@ void main() { ...@@ -41,7 +41,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new Stack( new Stack(
alignment: FractionalOffset.topLeft, alignment: Alignment.topLeft,
children: <Widget>[ children: <Widget>[
new Positioned( new Positioned(
left: 10.0, left: 10.0,
...@@ -69,7 +69,7 @@ void main() { ...@@ -69,7 +69,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new Stack( new Stack(
alignment: FractionalOffset.topLeft, alignment: Alignment.topLeft,
children: <Widget>[ children: <Widget>[
new Positioned( new Positioned(
right: 10.0, right: 10.0,
...@@ -140,7 +140,7 @@ void main() { ...@@ -140,7 +140,7 @@ void main() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: new Center( child: new Center(
child: new Stack( child: new Stack(
alignment: FractionalOffset.center, alignment: Alignment.center,
children: <Widget>[ children: <Widget>[
new Container(key: child0Key, width: 20.0, height: 20.0), new Container(key: child0Key, width: 20.0, height: 20.0),
new Container(key: child1Key, width: 10.0, height: 10.0), new Container(key: child1Key, width: 10.0, height: 10.0),
...@@ -163,7 +163,7 @@ void main() { ...@@ -163,7 +163,7 @@ void main() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: new Center( child: new Center(
child: new Stack( child: new Stack(
alignment: FractionalOffsetDirectional.bottomEnd, alignment: AlignmentDirectional.bottomEnd,
children: <Widget>[ children: <Widget>[
new Container(key: child0Key, width: 20.0, height: 20.0), new Container(key: child0Key, width: 20.0, height: 20.0),
new Container(key: child1Key, width: 10.0, height: 10.0), new Container(key: child1Key, width: 10.0, height: 10.0),
...@@ -186,7 +186,7 @@ void main() { ...@@ -186,7 +186,7 @@ void main() {
textDirection: TextDirection.rtl, textDirection: TextDirection.rtl,
child: new Center( child: new Center(
child: new Stack( child: new Stack(
alignment: FractionalOffset.center, alignment: Alignment.center,
children: <Widget>[ children: <Widget>[
new Container(key: child0Key, width: 20.0, height: 20.0), new Container(key: child0Key, width: 20.0, height: 20.0),
new Container(key: child1Key, width: 10.0, height: 10.0), new Container(key: child1Key, width: 10.0, height: 10.0),
...@@ -209,7 +209,7 @@ void main() { ...@@ -209,7 +209,7 @@ void main() {
textDirection: TextDirection.rtl, textDirection: TextDirection.rtl,
child: new Center( child: new Center(
child: new Stack( child: new Stack(
alignment: FractionalOffsetDirectional.bottomEnd, alignment: AlignmentDirectional.bottomEnd,
children: <Widget>[ children: <Widget>[
new Container(key: child0Key, width: 20.0, height: 20.0), new Container(key: child0Key, width: 20.0, height: 20.0),
new Container(key: child1Key, width: 10.0, height: 10.0), new Container(key: child1Key, width: 10.0, height: 10.0),
...@@ -257,7 +257,7 @@ void main() { ...@@ -257,7 +257,7 @@ void main() {
}); });
return new Center( return new Center(
child: new IndexedStack( child: new IndexedStack(
alignment: FractionalOffset.topLeft, alignment: Alignment.topLeft,
children: items, children: items,
index: index, index: index,
), ),
...@@ -289,7 +289,7 @@ void main() { ...@@ -289,7 +289,7 @@ void main() {
}); });
return new Center( return new Center(
child: new IndexedStack( child: new IndexedStack(
alignment: FractionalOffset.topLeft, alignment: Alignment.topLeft,
children: items, children: items,
key: key, key: key,
index: index, index: index,
...@@ -614,18 +614,18 @@ void main() { ...@@ -614,18 +614,18 @@ void main() {
testWidgets('Can change the text direction of a Stack', (WidgetTester tester) async { testWidgets('Can change the text direction of a Stack', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
new Stack( new Stack(
alignment: FractionalOffset.center, alignment: Alignment.center,
), ),
); );
await tester.pumpWidget( await tester.pumpWidget(
new Stack( new Stack(
alignment: FractionalOffsetDirectional.topStart, alignment: AlignmentDirectional.topStart,
textDirection: TextDirection.rtl, textDirection: TextDirection.rtl,
), ),
); );
await tester.pumpWidget( await tester.pumpWidget(
new Stack( new Stack(
alignment: FractionalOffset.center, alignment: Alignment.center,
), ),
); );
}); });
......
...@@ -82,7 +82,7 @@ void main() { ...@@ -82,7 +82,7 @@ void main() {
height: 100.0, height: 100.0,
child: new Transform( child: new Transform(
transform: new Matrix4.diagonal3Values(0.5, 0.5, 1.0), transform: new Matrix4.diagonal3Values(0.5, 0.5, 1.0),
alignment: const FractionalOffset(1.0, 0.5), alignment: const Alignment(1.0, 0.0),
child: new GestureDetector( child: new GestureDetector(
onTap: () { onTap: () {
didReceiveTap = true; didReceiveTap = true;
...@@ -131,7 +131,7 @@ void main() { ...@@ -131,7 +131,7 @@ void main() {
child: new Transform( child: new Transform(
transform: new Matrix4.diagonal3Values(0.5, 0.5, 1.0), transform: new Matrix4.diagonal3Values(0.5, 0.5, 1.0),
origin: const Offset(100.0, 0.0), origin: const Offset(100.0, 0.0),
alignment: const FractionalOffset(0.0, 0.5), alignment: const Alignment(-1.0, 0.0),
child: new GestureDetector( child: new GestureDetector(
onTap: () { onTap: () {
didReceiveTap = true; didReceiveTap = true;
......
...@@ -585,7 +585,7 @@ void main() { ...@@ -585,7 +585,7 @@ void main() {
testWidgets('Shrink-wrapping Wrap test', (WidgetTester tester) async { testWidgets('Shrink-wrapping Wrap test', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
new Align( new Align(
alignment: FractionalOffset.topLeft, alignment: Alignment.topLeft,
child: new Wrap( child: new Wrap(
alignment: WrapAlignment.end, alignment: WrapAlignment.end,
crossAxisAlignment: WrapCrossAlignment.end, crossAxisAlignment: WrapCrossAlignment.end,
...@@ -609,7 +609,7 @@ void main() { ...@@ -609,7 +609,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new Align( new Align(
alignment: FractionalOffset.topLeft, alignment: Alignment.topLeft,
child: new Wrap( child: new Wrap(
alignment: WrapAlignment.end, alignment: WrapAlignment.end,
crossAxisAlignment: WrapCrossAlignment.end, crossAxisAlignment: WrapCrossAlignment.end,
...@@ -635,7 +635,7 @@ void main() { ...@@ -635,7 +635,7 @@ void main() {
testWidgets('Wrap spacing test', (WidgetTester tester) async { testWidgets('Wrap spacing test', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
new Align( new Align(
alignment: FractionalOffset.topLeft, alignment: Alignment.topLeft,
child: new Wrap( child: new Wrap(
runSpacing: 10.0, runSpacing: 10.0,
alignment: WrapAlignment.start, alignment: WrapAlignment.start,
...@@ -662,7 +662,7 @@ void main() { ...@@ -662,7 +662,7 @@ void main() {
testWidgets('Vertical Wrap test with spacing', (WidgetTester tester) async { testWidgets('Vertical Wrap test with spacing', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
new Align( new Align(
alignment: FractionalOffset.topLeft, alignment: Alignment.topLeft,
child: new Wrap( child: new Wrap(
direction: Axis.vertical, direction: Axis.vertical,
spacing: 10.0, spacing: 10.0,
...@@ -693,7 +693,7 @@ void main() { ...@@ -693,7 +693,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new Align( new Align(
alignment: FractionalOffset.topLeft, alignment: Alignment.topLeft,
child: new Wrap( child: new Wrap(
direction: Axis.horizontal, direction: Axis.horizontal,
spacing: 12.0, spacing: 12.0,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment