Replace usage of FractionalOffset with Alignment (#12348)
Alignment will eventually replace FractionalOffset.
This commit is contained in:
@@ -55,7 +55,7 @@ class _AppBarBottomSampleState extends State<AppBarBottomSample> with SingleTick
|
||||
data: Theme.of(context).copyWith(accentColor: Colors.white),
|
||||
child: new Container(
|
||||
height: 48.0,
|
||||
alignment: FractionalOffset.center,
|
||||
alignment: Alignment.center,
|
||||
child: new TabPageSelector(controller: _tabController),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -169,7 +169,7 @@ class _AllSectionsLayout extends MultiChildLayoutDelegate {
|
||||
this.selectedIndex,
|
||||
});
|
||||
|
||||
final FractionalOffset translation;
|
||||
final Alignment translation;
|
||||
final double tColumnToRow;
|
||||
final double tCollapsed;
|
||||
final int cardCount;
|
||||
@@ -349,7 +349,7 @@ class _AllSectionsView extends AnimatedWidget {
|
||||
|
||||
return new CustomMultiChildLayout(
|
||||
delegate: new _AllSectionsLayout(
|
||||
translation: new FractionalOffset(selectedIndex.value - sectionIndex, 0.0),
|
||||
translation: new Alignment((selectedIndex.value - sectionIndex) * 2.0 - 1.0, -1.0),
|
||||
tColumnToRow: tColumnToRow,
|
||||
tCollapsed: tCollapsed,
|
||||
cardCount: sections.length,
|
||||
|
||||
@@ -25,8 +25,8 @@ class SectionCard extends StatelessWidget {
|
||||
decoration: new BoxDecoration(
|
||||
borderRadius: new BorderRadius.circular(4.0),
|
||||
gradient: new LinearGradient(
|
||||
begin: FractionalOffset.topLeft,
|
||||
end: FractionalOffset.topRight,
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
colors: <Color>[
|
||||
section.leftColor,
|
||||
section.rightColor,
|
||||
@@ -82,7 +82,7 @@ class SectionTitle extends StatelessWidget {
|
||||
opacity: opacity,
|
||||
child: new Transform(
|
||||
transform: new Matrix4.identity()..scale(scale),
|
||||
alignment: FractionalOffset.center,
|
||||
alignment: Alignment.center,
|
||||
child: new Stack(
|
||||
children: <Widget>[
|
||||
new Positioned(
|
||||
@@ -136,7 +136,7 @@ class SectionDetailView extends StatelessWidget {
|
||||
package: detail.imageAssetPackage,
|
||||
),
|
||||
fit: BoxFit.cover,
|
||||
alignment: FractionalOffset.center,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -166,8 +166,8 @@ class ContactsDemoState extends State<ContactsDemo> {
|
||||
const DecoratedBox(
|
||||
decoration: const BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
begin: const FractionalOffset(0.5, 0.0),
|
||||
end: const FractionalOffset(0.5, 0.30),
|
||||
begin: const Alignment(0.0, -1.0),
|
||||
end: const Alignment(0.0, -0.4),
|
||||
colors: const <Color>[const Color(0x60000000), const Color(0x00000000)],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -39,7 +39,7 @@ class _CupertinoButtonDemoState extends State<CupertinoButtonsDemo> {
|
||||
: ' '),
|
||||
const Padding(padding: const EdgeInsets.all(12.0)),
|
||||
new Align(
|
||||
alignment: const FractionalOffset(0.5, 0.4),
|
||||
alignment: const Alignment(0.0, -0.2),
|
||||
child: new Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
|
||||
@@ -47,9 +47,9 @@ class NavigationIconView {
|
||||
return new FadeTransition(
|
||||
opacity: _animation,
|
||||
child: new SlideTransition(
|
||||
position: new FractionalOffsetTween(
|
||||
begin: const FractionalOffset(0.0, 0.02), // Small offset from the top.
|
||||
end: FractionalOffset.topLeft,
|
||||
position: new AlignmentTween(
|
||||
begin: const Alignment(0.0, 0.4), // Slightly down.
|
||||
end: Alignment.center,
|
||||
).animate(_animation),
|
||||
child: new IconTheme(
|
||||
data: new IconThemeData(
|
||||
|
||||
@@ -90,7 +90,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
|
||||
|
||||
Widget buildRaisedButton() {
|
||||
return new Align(
|
||||
alignment: const FractionalOffset(0.5, 0.4),
|
||||
alignment: const Alignment(0.0, -0.2),
|
||||
child: new ButtonBar(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
@@ -111,7 +111,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
|
||||
|
||||
Widget buildFlatButton() {
|
||||
return new Align(
|
||||
alignment: const FractionalOffset(0.5, 0.4),
|
||||
alignment: const Alignment(0.0, -0.2),
|
||||
child: new ButtonBar(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
@@ -213,7 +213,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
|
||||
|
||||
Widget buildIconButton() {
|
||||
return new Align(
|
||||
alignment: const FractionalOffset(0.5, 0.4),
|
||||
alignment: const Alignment(0.0, -0.2),
|
||||
child: new Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
@@ -237,7 +237,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
|
||||
|
||||
Widget buildActionButton() {
|
||||
return new Align(
|
||||
alignment: const FractionalOffset(0.5, 0.4),
|
||||
alignment: const Alignment(0.0, -0.2),
|
||||
child: new FloatingActionButton(
|
||||
child: const Icon(Icons.add),
|
||||
onPressed: () {
|
||||
|
||||
@@ -85,7 +85,7 @@ class TravelDestinationItem extends StatelessWidget {
|
||||
right: 16.0,
|
||||
child: new FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
alignment: Alignment.centerLeft,
|
||||
child: new Text(destination.title,
|
||||
style: titleStyle,
|
||||
),
|
||||
|
||||
@@ -25,7 +25,7 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin {
|
||||
|
||||
AnimationController _controller;
|
||||
Animation<double> _drawerContentsOpacity;
|
||||
Animation<FractionalOffset> _drawerDetailsPosition;
|
||||
Animation<Alignment> _drawerDetailsPosition;
|
||||
bool _showDrawerContents = true;
|
||||
|
||||
@override
|
||||
@@ -39,9 +39,9 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin {
|
||||
parent: new ReverseAnimation(_controller),
|
||||
curve: Curves.fastOutSlowIn,
|
||||
);
|
||||
_drawerDetailsPosition = new FractionalOffsetTween(
|
||||
begin: const FractionalOffset(0.0, -1.0),
|
||||
end: const FractionalOffset(0.0, 0.0),
|
||||
_drawerDetailsPosition = new AlignmentTween(
|
||||
begin: const Alignment(0.0, -2.0),
|
||||
end: Alignment.center,
|
||||
).animate(new CurvedAnimation(
|
||||
parent: _controller,
|
||||
curve: Curves.fastOutSlowIn,
|
||||
@@ -80,7 +80,7 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin {
|
||||
appBar: new AppBar(
|
||||
leading: new IconButton(
|
||||
icon: new Icon(_backIcon()),
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
alignment: Alignment.centerLeft,
|
||||
tooltip: 'Back',
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
|
||||
@@ -51,7 +51,7 @@ class DualHeaderWithHint extends StatelessWidget {
|
||||
margin: const EdgeInsets.only(left: 24.0),
|
||||
child: new FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
alignment: Alignment.centerLeft,
|
||||
child: new Text(
|
||||
name,
|
||||
style: textTheme.body1.copyWith(fontSize: 15.0),
|
||||
|
||||
@@ -165,7 +165,7 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
|
||||
decoration: new BoxDecoration(
|
||||
border: new Border(bottom: new BorderSide(color: theme.dividerColor))
|
||||
),
|
||||
alignment: FractionalOffset.bottomLeft,
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: new Text('Event name', style: theme.textTheme.display2)
|
||||
),
|
||||
new Container(
|
||||
@@ -173,7 +173,7 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
|
||||
decoration: new BoxDecoration(
|
||||
border: new Border(bottom: new BorderSide(color: theme.dividerColor))
|
||||
),
|
||||
alignment: FractionalOffset.bottomLeft,
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: new Text('Location', style: theme.textTheme.title.copyWith(color: Colors.black54))
|
||||
),
|
||||
new Column(
|
||||
|
||||
@@ -54,7 +54,7 @@ class _GridTitleText extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return new FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
alignment: Alignment.centerLeft,
|
||||
child: new Text(text),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> {
|
||||
|
||||
Widget buildCheckbox() {
|
||||
return new Align(
|
||||
alignment: const FractionalOffset(0.5, 0.4),
|
||||
alignment: const Alignment(0.0, -0.2),
|
||||
child: new Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
@@ -109,7 +109,7 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> {
|
||||
|
||||
Widget buildRadio() {
|
||||
return new Align(
|
||||
alignment: const FractionalOffset(0.5, 0.4),
|
||||
alignment: const Alignment(0.0, -0.2),
|
||||
child: new Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
@@ -161,7 +161,7 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> {
|
||||
|
||||
Widget buildSwitch() {
|
||||
return new Align(
|
||||
alignment: const FractionalOffset(0.5, 0.4),
|
||||
alignment: const Alignment(0.0, -0.2),
|
||||
child: new Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
|
||||
@@ -107,8 +107,8 @@ class _CardDataItem extends StatelessWidget {
|
||||
children: <Widget>[
|
||||
new Align(
|
||||
alignment: page.id == 'L'
|
||||
? FractionalOffset.centerLeft
|
||||
: FractionalOffset.centerRight,
|
||||
? Alignment.centerLeft
|
||||
: Alignment.centerRight,
|
||||
child: new CircleAvatar(child: new Text('${page.id}')),
|
||||
),
|
||||
new SizedBox(
|
||||
|
||||
@@ -188,7 +188,7 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
|
||||
),
|
||||
new Container(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
alignment: const FractionalOffset(0.5, 0.5),
|
||||
alignment: Alignment.center,
|
||||
child: new RaisedButton(
|
||||
child: const Text('SUBMIT'),
|
||||
onPressed: _handleSubmitted,
|
||||
|
||||
@@ -211,7 +211,7 @@ class _PestoLogoState extends State<PestoLogo> {
|
||||
Widget build(BuildContext context) {
|
||||
return new Transform(
|
||||
transform: new Matrix4.identity()..scale(widget.height / kLogoHeight),
|
||||
alignment: FractionalOffset.topCenter,
|
||||
alignment: Alignment.topCenter,
|
||||
child: new SizedBox(
|
||||
width: kLogoWidth,
|
||||
child: new Stack(
|
||||
@@ -362,8 +362,8 @@ class _RecipePageState extends State<RecipePage> {
|
||||
background: new DecoratedBox(
|
||||
decoration: new BoxDecoration(
|
||||
gradient: new LinearGradient(
|
||||
begin: const FractionalOffset(0.5, 0.0),
|
||||
end: const FractionalOffset(0.5, 0.40),
|
||||
begin: const Alignment(0.0, -1.0),
|
||||
end: const Alignment(0.0, -0.2),
|
||||
colors: <Color>[const Color(0x60000000), const Color(0x00000000)],
|
||||
),
|
||||
),
|
||||
@@ -450,7 +450,7 @@ class RecipeSheet extends StatelessWidget {
|
||||
package: recipe.ingredientsImagePackage,
|
||||
width: 32.0,
|
||||
height: 32.0,
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
alignment: Alignment.centerLeft,
|
||||
fit: BoxFit.scaleDown
|
||||
)
|
||||
),
|
||||
|
||||
@@ -320,7 +320,7 @@ class _ProductItem extends StatelessWidget {
|
||||
new Column(
|
||||
children: <Widget>[
|
||||
new Align(
|
||||
alignment: FractionalOffset.centerRight,
|
||||
alignment: Alignment.centerRight,
|
||||
child: new _ProductPriceItem(product: product),
|
||||
),
|
||||
new Container(
|
||||
|
||||
@@ -85,7 +85,7 @@ class _VendorItem extends StatelessWidget {
|
||||
new SizedBox(
|
||||
height: 24.0,
|
||||
child: new Align(
|
||||
alignment: FractionalOffset.bottomLeft,
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: new Text(vendor.name, style: theme.vendorTitleStyle),
|
||||
),
|
||||
),
|
||||
@@ -174,7 +174,7 @@ class _Heading extends StatelessWidget {
|
||||
product.imageAsset,
|
||||
package: product.imageAssetPackage,
|
||||
fit: BoxFit.contain,
|
||||
alignment: FractionalOffset.center,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -138,7 +138,7 @@ class GalleryHomeState extends State<GalleryHome> with SingleTickerProviderState
|
||||
child: new Container(
|
||||
height: 48.0,
|
||||
padding: const EdgeInsets.only(left: 16.0),
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
alignment: Alignment.centerLeft,
|
||||
child: new Text(galleryItem.category, style: headerStyle)
|
||||
),
|
||||
)
|
||||
|
||||
@@ -13,7 +13,7 @@ void main() {
|
||||
// The root of our render tree is a RenderPositionedBox, which centers its
|
||||
// child both vertically and horizontally.
|
||||
root: new RenderPositionedBox(
|
||||
alignment: FractionalOffset.center,
|
||||
alignment: Alignment.center,
|
||||
// We use a RenderParagraph to display the text 'Hello, world.' without
|
||||
// any explicit styling.
|
||||
child: new RenderParagraph(
|
||||
|
||||
@@ -34,12 +34,12 @@ void main() {
|
||||
// spin.
|
||||
final RenderTransform spin = new RenderTransform(
|
||||
transform: new Matrix4.identity(),
|
||||
alignment: FractionalOffset.center,
|
||||
alignment: Alignment.center,
|
||||
child: square
|
||||
);
|
||||
// Finally, we center the spinning green square...
|
||||
final RenderBox root = new RenderPositionedBox(
|
||||
alignment: FractionalOffset.center,
|
||||
alignment: Alignment.center,
|
||||
child: spin
|
||||
);
|
||||
// and attach it to the window.
|
||||
|
||||
@@ -100,7 +100,7 @@ void main() {
|
||||
flexRoot.add(proxy);
|
||||
addFlexChildSolidColor(flexRoot, const Color(0xFF0000FF), flex: 1);
|
||||
|
||||
transformBox = new RenderTransform(child: flexRoot, transform: new Matrix4.identity(), alignment: FractionalOffset.center);
|
||||
transformBox = new RenderTransform(child: flexRoot, transform: new Matrix4.identity(), alignment: Alignment.center);
|
||||
final RenderPadding root = new RenderPadding(padding: const EdgeInsets.all(80.0), child: transformBox);
|
||||
|
||||
binding.renderView.child = root;
|
||||
|
||||
Reference in New Issue
Block a user