sizeTo method

Widget sizeTo(
  1. Size size, {
  2. Size? from,
})

Applies a SizeEffect that constrains this Widget to size, optionally animating from from.

Both axes are set together. To animate one axis while leaving the other unconstrained — or to give each axis its own starting value — use sizeOf instead, since Size cannot express "no constraint on this axis".

Implementation

Widget sizeTo(Size size, {Size? from}) {
  return EffectWidget(
    start: from == null
        ? null
        : SizeEffect(width: from.width, height: from.height),
    end: SizeEffect(width: size.width, height: size.height),
    child: this,
  );
}