scaleToScreen method
Widget
scaleToScreen({
- required BuildContext context,
- double widthFactor = 1.0,
- double heightFactor = 1.0,
Combines scaling for both width and height.
Implementation
Widget scaleToScreen({
required BuildContext context,
double widthFactor = 1.0,
double heightFactor = 1.0,
}) {
final screenWidth = MediaQuery.of(context).size.width;
final screenHeight = MediaQuery.of(context).size.height;
return Transform.scale(
scale: (screenWidth / 100 * widthFactor) * (screenHeight / 100 * heightFactor),
child: this,
);
}