different border radius per device type and os

larger tiles on tablets
This commit is contained in:
2022-09-29 21:01:28 +02:00
parent b8caf579c3
commit cc2f9dbb94
4 changed files with 50 additions and 17 deletions

24
lib/utils/tile_size.dart Normal file
View File

@@ -0,0 +1,24 @@
import 'dart:io';
import 'package:flutter/widgets.dart';
enum DeviceType { phone, tablet }
DeviceType getDeviceType() {
final data = MediaQueryData.fromWindow(WidgetsBinding.instance.window);
return data.size.shortestSide < 550 ? DeviceType.phone : DeviceType.tablet;
}
int calcTileMaxWidth() {
if (Platform.isLinux || Platform.isMacOS || Platform.isWindows) {
return 300;
} else if (Platform.isAndroid || Platform.isIOS) {
if (getDeviceType() == DeviceType.tablet) {
return 150;
} else {
return 100;
}
} else {
return 250;
}
}