Skip to content

Commit

Permalink
Fix animation jerk in portrait only widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
proninyaroslav committed Oct 12, 2024
1 parent bffccd9 commit bcd5e31
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions lib/ui/components/portrait_only_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,22 @@ class PortraitOnlyWidget extends StatelessWidget {

@override
Widget build(BuildContext context) {
return NativeDeviceOrientationReader(
builder: (context) {
final orientation = NativeDeviceOrientationReader.orientation(context);
return RotatedBox(
quarterTurns: _getTurnsDirection(orientation),
child: _child ?? _builder!(context, orientation.deviceOrientation),
);
return OrientationBuilder(
builder: (context, _) {
return FutureBuilder(
future: NativeDeviceOrientationCommunicator().orientation(),
builder: (context, snapshot) {
final orientation = snapshot.data;
return RotatedBox(
quarterTurns:
orientation == null ? 0 : _getTurnsDirection(orientation),
child: _child ??
_builder!(
context,
orientation?.deviceOrientation,
),
);
});
},
);
}
Expand Down

0 comments on commit bcd5e31

Please sign in to comment.