Skip to content

Commit d306f98

Browse files
authored
[video_player] fixed misleading size and aspect ratio documentation (flutter#3668)
1 parent 735e1a5 commit d306f98

File tree

4 files changed

+24
-13
lines changed

4 files changed

+24
-13
lines changed

packages/video_player/video_player/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.0.2
2+
3+
* Fix `VideoPlayerValue` size and aspect ratio documentation
4+
15
## 2.0.1
26

37
* Remove the deprecated API "exoPlayer.setAudioAttributes".

packages/video_player/video_player/lib/src/closed_caption_file.dart

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ class Caption {
3131
///
3232
/// This is not recommended for direct use unless you are writing a parser for
3333
/// a new closed captioning file type.
34-
const Caption(
35-
{required this.number,
36-
required this.start,
37-
required this.end,
38-
required this.text});
34+
const Caption({
35+
required this.number,
36+
required this.start,
37+
required this.end,
38+
required this.text,
39+
});
3940

4041
/// The number that this caption was assigned.
4142
final int number;
@@ -52,8 +53,12 @@ class Caption {
5253

5354
/// A no caption object. This is a caption with [start] and [end] durations of zero,
5455
/// and an empty [text] string.
55-
static const Caption none =
56-
Caption(number: 0, start: Duration.zero, end: Duration.zero, text: '');
56+
static const Caption none = Caption(
57+
number: 0,
58+
start: Duration.zero,
59+
end: Duration.zero,
60+
text: '',
61+
);
5762

5863
@override
5964
String toString() {

packages/video_player/video_player/lib/video_player.dart

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,10 @@ class VideoPlayerValue {
8787

8888
/// A description of the error if present.
8989
///
90-
/// If [hasError] is false this is [null].
90+
/// If [hasError] is false this is `null`.
9191
final String? errorDescription;
9292

9393
/// The [size] of the currently loaded video.
94-
///
95-
/// Is null when [initialized] is false.
9694
final Size size;
9795

9896
/// Indicates whether or not the video has been loaded and is ready to play.
@@ -102,8 +100,12 @@ class VideoPlayerValue {
102100
/// [errorDescription] should have information about the problem.
103101
bool get hasError => errorDescription != null;
104102

105-
/// Returns [size.width] / [size.height] when size is non-null, or `1.0.` when
106-
/// size is null or the aspect ratio would be less than or equal to 0.0.
103+
/// Returns [size.width] / [size.height].
104+
///
105+
/// Will return `1.0` if:
106+
/// * [isInitialized] is `false`
107+
/// * [size.width], or [size.height] is equal to `0.0`
108+
/// * aspect ratio would be less than or equal to `0.0`
107109
double get aspectRatio {
108110
if (!isInitialized || size.width == 0 || size.height == 0) {
109111
return 1.0;

packages/video_player/video_player/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: video_player
22
description: Flutter plugin for displaying inline video with other Flutter
33
widgets on Android, iOS, and web.
4-
version: 2.0.1
4+
version: 2.0.2
55
homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player
66

77
flutter:

0 commit comments

Comments
 (0)