Files
TubeCards/lib/utils/responsiveness/form_factor.dart
friebetill 80f218097d Initial commit
Add Space version 2.0.1
2022-03-28 14:56:00 +02:00

21 lines
455 B
Dart

import 'package:flutter/widgets.dart';
import 'breakpoints.dart';
// Form factor of devices.
enum FormFactor {
// Phones
small,
// Tablets and above
large,
}
FormFactor getFormFactor(BuildContext context) {
// Use .shortestSide to detect device type regardless of orientation
final deviceWidth = MediaQuery.of(context).size.shortestSide;
return deviceWidth > Breakpoint.mobileToLarge
? FormFactor.large
: FormFactor.small;
}