different border radius per device type and os
larger tiles on tablets
This commit is contained in:
24
lib/utils/tile_size.dart
Normal file
24
lib/utils/tile_size.dart
Normal 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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user