Scaling widgets

To scale widgets, we use the typical Transform.scale(), constructor. To scale up a widget, for example, we can use it as follows:

Transform.scale(
scale: 2.0,
child: RaisedButton(
child: Text("scaled up"),
onPressed: () {},
),
);

And to get the same result using the default Transform constructor, we use the following:

Transform(
transform: Matrix4.identity()..scale(2.0, 2.0),
alignment: Alignment.center,
child: RaisedButton(
child: Text("scaled up"),
onPressed: () {},
),
);

In a very similar way to the rotation, we must specify both the origin of the transformation with the alignment property and the Matrix4 instance describing the scale transformation.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.43.140