Skip to content

Commit bcd5e31

Browse files
Fix animation jerk in portrait only widgets
1 parent bffccd9 commit bcd5e31

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

lib/ui/components/portrait_only_widget.dart

+16-7
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,22 @@ class PortraitOnlyWidget extends StatelessWidget {
4949

5050
@override
5151
Widget build(BuildContext context) {
52-
return NativeDeviceOrientationReader(
53-
builder: (context) {
54-
final orientation = NativeDeviceOrientationReader.orientation(context);
55-
return RotatedBox(
56-
quarterTurns: _getTurnsDirection(orientation),
57-
child: _child ?? _builder!(context, orientation.deviceOrientation),
58-
);
52+
return OrientationBuilder(
53+
builder: (context, _) {
54+
return FutureBuilder(
55+
future: NativeDeviceOrientationCommunicator().orientation(),
56+
builder: (context, snapshot) {
57+
final orientation = snapshot.data;
58+
return RotatedBox(
59+
quarterTurns:
60+
orientation == null ? 0 : _getTurnsDirection(orientation),
61+
child: _child ??
62+
_builder!(
63+
context,
64+
orientation?.deviceOrientation,
65+
),
66+
);
67+
});
5968
},
6069
);
6170
}

0 commit comments

Comments
 (0)