build method
根据屏幕尺寸返回对应的Widget
Implementation
@override
Widget build(BuildContext context) {
final Size size = MediaQuery.of(context).size;
final double width = size.width;
if (width >= 1100) {
// 桌面端优先显示
if (desktop != null) return desktop!;
if (tablet != null) return tablet!;
return mobile;
}
if (width >= 650) {
// 平板端
if (tablet != null) return tablet!;
if (desktop != null) return desktop!;
return mobile;
}
// 移动端
return mobile;
}