Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[video_player] add assertion for rotation to be a multiple of 90
Signed-off-by: ふぁ <[email protected]>
  • Loading branch information
fa0311 committed Mar 20, 2025
commit b11717beb9831c9b4cf8867ecee1469a04fbebde
6 changes: 4 additions & 2 deletions packages/video_player/video_player/lib/video_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -888,10 +888,12 @@ class _VideoPlayerWithRotation extends StatelessWidget {

@override
Widget build(BuildContext context) {
assert(rotation % 90 == 0, 'Rotation must be a multiple of 90');
if (rotation % 90 != 0 || rotation == 0) {
if (rotation == 0) {
return child;
}
if (rotation % 90 != 0) {
throw ArgumentError('Rotation must be a multiple of 90');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An argument error should be thrown at the point where it is passed as an argument, which is the constructor on line 884.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue has been fixed.

}
return RotatedBox(
quarterTurns: rotation ~/ 90,
child: child,
Expand Down