|
|
|
@ -1,5 +1,6 @@ |
|
|
|
import 'package:flutter/foundation.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
import 'package:flutter/services.dart'; |
|
|
|
|
|
|
|
class MyDevice { |
|
|
|
static const MyDevice _i = MyDevice._internal(); |
|
|
|
@ -58,4 +59,28 @@ class MyDevice { |
|
|
|
static bool isWeb() { |
|
|
|
return kIsWeb; |
|
|
|
} |
|
|
|
|
|
|
|
/// Set Device based on Orientation |
|
|
|
static Future<void> setPortrait() async { |
|
|
|
await SystemChrome.setPreferredOrientations([ |
|
|
|
DeviceOrientation.portraitUp, |
|
|
|
]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
static Future<void> setLandscape() async { |
|
|
|
await SystemChrome.setPreferredOrientations([ |
|
|
|
DeviceOrientation.landscapeLeft, |
|
|
|
DeviceOrientation.landscapeRight, |
|
|
|
]); |
|
|
|
} |
|
|
|
|
|
|
|
static Future<void> setAllOrientations() async { |
|
|
|
await SystemChrome.setPreferredOrientations([ |
|
|
|
DeviceOrientation.landscapeLeft, |
|
|
|
DeviceOrientation.landscapeRight, |
|
|
|
DeviceOrientation.portraitUp, |
|
|
|
DeviceOrientation.portraitDown, |
|
|
|
]); |
|
|
|
} |
|
|
|
} |