Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
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
1 change: 1 addition & 0 deletions packages/video_player/video_player/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 2.9.4
Copy link
Collaborator

Choose a reason for hiding this comment

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

This needs a new version bump; the previous one was lost in a merge.

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. A new version bump has been added.

Copy link
Collaborator

Choose a reason for hiding this comment

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


* Reduces the position update interval from 500ms to 100ms.
* Fix layout issue caused by Transform.rotate not affecting space calculation.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Fixes

See the CHANGELOG style guide linked from the PR checklist.


## 2.9.3

Expand Down
19 changes: 12 additions & 7 deletions packages/video_player/video_player/lib/video_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import 'dart:async';
import 'dart:io';
import 'dart:math' as math;

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -887,12 +886,18 @@ class _VideoPlayerWithRotation extends StatelessWidget {
final Widget child;

@override
Widget build(BuildContext context) => rotation == 0
? child
: Transform.rotate(
angle: rotation * math.pi / 180,
child: child,
);
Widget build(BuildContext context) {
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,
);
}
}

/// Used to configure the [VideoProgressIndicator] widget's colors for how it
Expand Down
22 changes: 6 additions & 16 deletions packages/video_player/video_player/test/video_player_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

import 'dart:async';
import 'dart:io';
import 'dart:math' as math;
import 'dart:typed_data';

import 'package:flutter/foundation.dart' show kIsWeb;
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -178,28 +176,20 @@ void main() {
addTearDown(controller.dispose);
controller.textureId = 1;
await tester.pumpWidget(VideoPlayer(controller));
final Transform actualRotationCorrection =
find.byType(Transform).evaluate().single.widget as Transform;
final Float64List actualRotationCorrectionStorage =
actualRotationCorrection.transform.storage;
final Float64List expectedMatrixStorage =
Matrix4.rotationZ(math.pi).storage;
expect(actualRotationCorrectionStorage.length,
equals(expectedMatrixStorage.length));
for (int i = 0; i < actualRotationCorrectionStorage.length; i++) {
expect(actualRotationCorrectionStorage[i],
moreOrLessEquals(expectedMatrixStorage[i]));
}
final RotatedBox actualRotationCorrection =
find.byType(RotatedBox).evaluate().single.widget as RotatedBox;
final int actualQuarterTurns = actualRotationCorrection.quarterTurns;
expect(actualQuarterTurns, equals(2));
});

testWidgets('no transform when rotationCorrection is zero',
testWidgets('no RotatedBox when rotationCorrection is zero',
(WidgetTester tester) async {
final FakeController controller =
FakeController.value(const VideoPlayerValue(duration: Duration.zero));
addTearDown(controller.dispose);
controller.textureId = 1;
await tester.pumpWidget(VideoPlayer(controller));
expect(find.byType(Transform), findsNothing);
expect(find.byType(RotatedBox), findsNothing);
});

group('ClosedCaption widget', () {
Expand Down