Hello I want to fetch device auto rotation is on or off using native android code as when I have to show popup to enable auto-rotation on if user has portrait mode on to take image in landscape view so for that I have used below mention package.
native_device_orientation: ^1.1.4
Here in this I have added popup on all landscape mode (i.e. landscape, landscapeRight, landscapeLeft) it works fine when auto-rotation is off.
- But the problem is when auto-rotation is on when the phone is tilted to 45 degree the popup blinks and get disappear.
Here I m attaching code for reference
OrientationBuilder(
builder: (BuildContext context, Orientation orientation) {
return orientation == Orientation.portrait
? NativeDeviceOrientedWidget(
useSensor: MediaQuery.of(context).orientation == Orientation.portrait && MediaQuery.of(context).orientation != Orientation.landscape ? true : false,
fallback: (context) {
return portraitMode( context);
},
landscape: (context) {
return const RotationDialog();
},
landscapeLeft: (context) {
return const RotationDialog();
},
landscapeRight: (context) {
return const RotationDialog();
},
portrait: (context) {
return portraitMode(context);
},
portraitUp: (context) {
return portraitMode(context);
},
portraitDown: (context) {
return portraitMode(context);
},
)
: landscapeMode(context);
I think have to fix it with native code or please let me know if I have done something wrong in code, also tried it by checking Orientation but did not worked.
If this could be fixed by native code open for suggestions of that too.
Looking forward for your suggestion any help will be helpful. Thanks in advance