I am trying to lock the orientation of the screen, no matter how the device is orientated. It works fine on phone sized devices but does not work on tablet sized devices. Below is my current code.
UPDATE: After further testing it appears to be more specific to devices with a screen ratio of around 4:3 running Android API 29 and 30. Any suggestions on how to proceed?
@override
void initState() {
super.initState();
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
]);
}
@override
dispose() {
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
DeviceOrientation.landscapeRight,
DeviceOrientation.landscapeLeft,
]);
super.dispose();
}
@override
Widget build(BuildContext context) {
WidgetsFlutterBinding.ensureInitialized();
// SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
SystemChrome.setSystemUIOverlayStyle(