scaleToWidth method

Widget scaleToWidth({
  1. required BuildContext context,
  2. double factor = 1.0,
})

Scales the widget proportionally to the screen's width.

Implementation

Widget scaleToWidth({
  required BuildContext context,
  double factor = 1.0,
}) {
  final screenWidth = MediaQuery.of(context).size.width;
  return Transform.scale(
    scale: screenWidth / 100 * factor,
    child: this,
  );
}