scaled method

Widget scaled(
  1. BuildContext context, {
  2. double baseWidth = 375.0,
})

Scale the widget based on screen size

Implementation

Widget scaled(BuildContext context, {double baseWidth = 375.0}) {
  final screenWidth = MediaQuery.of(context).size.width;
  final scaleFactor = screenWidth / baseWidth;

  return Transform.scale(
    scale: scaleFactor,
    child: this,
  );
}