getDeviceType method
Determines the DeviceType from the current context.
Implementation
DeviceType getDeviceType() {
final Orientation orientation = MediaQuery.of(this).orientation;
if (MediaQuery.of(this).size.shortestSide < 550) {
if (orientation == Orientation.landscape) {
return DeviceType.phoneLandscape;
} else {
return DeviceType.phonePortrait;
}
} else if (orientation == Orientation.landscape) {
return DeviceType.tabletLandscape;
} else {
return DeviceType.tabletPortrait;
}
}