I would like to enable my application screen to landscape or portrait only for tablets. Still on Portrait for smartphone The application was developed by Flutter.
You can set portrait with SystemChrome
final data = MediaQueryData.fromWindow(WidgetsBinding.instance!.window);
if(data.size.shortestSide > 600) { // check if its bigger
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
} else { // otherwise will be ..
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
]);
}
Play with digit to get the best