scaleToMaxHeight method
Widget
scaleToMaxHeight({
- required BuildContext context,
- double maxHeight = 800,
- double factor = 1.0,
Scales the widget conditionally based on a maximum height.
Implementation
Widget scaleToMaxHeight({
required BuildContext context,
double maxHeight = 800,
double factor = 1.0,
}) {
final screenHeight = MediaQuery.of(context).size.height;
final scale = screenHeight < maxHeight ? (screenHeight / maxHeight) * factor : factor;
return Transform.scale(
scale: scale,
child: this,
);
}