detect static method
Classifies the device into a PaymentsDisplaySize bucket.
Uses MediaQueryData.size.shortestSide so the result is stable across
portrait <-> landscape rotation.
Implementation
static PaymentsDisplaySize detect(BuildContext context) {
final shortest = MediaQuery.of(context).size.shortestSide;
if (shortest < 360) return PaymentsDisplaySize.xSmall;
if (shortest < 380) return PaymentsDisplaySize.small;
if (shortest < 600) return PaymentsDisplaySize.standard;
return PaymentsDisplaySize.large;
}