mirror of
https://github.com/friebetill/TubeCards.git
synced 2025-08-16 02:57:29 +08:00
21 lines
455 B
Dart
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;
|
|
}
|