vector_math.dart icon indicating copy to clipboard operation
vector_math.dart copied to clipboard

Offer reasonable 1D replacement for `.scale` and `.scaled`

Open timcreatedit opened this issue 6 months ago • 0 comments

After the deprecation of Matrix4.scale() and Matrix4.scaled(), it seems like there is no way to easily write one of the most common use-cases in Flutter anymore. There should be a replacement for uniformly scaling a matrix by a single factor in x y and z.

For example:

Widget build(BuildContext context) {
    return AnimatedContainer(
        // ...
        transform: Matrix4.identity().scaledByFactor(active ? 2 : 1);
        // ...
    );
}

timcreatedit avatar Aug 28 '25 12:08 timcreatedit