[video_player] fixed misleading size and aspect ratio documentation (#3668)
diff --git a/packages/video_player/video_player/CHANGELOG.md b/packages/video_player/video_player/CHANGELOG.md
index e5c30a0..08a5e44 100644
--- a/packages/video_player/video_player/CHANGELOG.md
+++ b/packages/video_player/video_player/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 2.0.2
+
+* Fix `VideoPlayerValue` size and aspect ratio documentation
+
## 2.0.1
* Remove the deprecated API "exoPlayer.setAudioAttributes".
diff --git a/packages/video_player/video_player/lib/src/closed_caption_file.dart b/packages/video_player/video_player/lib/src/closed_caption_file.dart
index eae9bf5..64ab1f6 100644
--- a/packages/video_player/video_player/lib/src/closed_caption_file.dart
+++ b/packages/video_player/video_player/lib/src/closed_caption_file.dart
@@ -31,11 +31,12 @@
///
/// This is not recommended for direct use unless you are writing a parser for
/// a new closed captioning file type.
- const Caption(
- {required this.number,
- required this.start,
- required this.end,
- required this.text});
+ const Caption({
+ required this.number,
+ required this.start,
+ required this.end,
+ required this.text,
+ });
/// The number that this caption was assigned.
final int number;
@@ -52,8 +53,12 @@
/// A no caption object. This is a caption with [start] and [end] durations of zero,
/// and an empty [text] string.
- static const Caption none =
- Caption(number: 0, start: Duration.zero, end: Duration.zero, text: '');
+ static const Caption none = Caption(
+ number: 0,
+ start: Duration.zero,
+ end: Duration.zero,
+ text: '',
+ );
@override
String toString() {
diff --git a/packages/video_player/video_player/lib/video_player.dart b/packages/video_player/video_player/lib/video_player.dart
index 6a2af76..96dd73d 100644
--- a/packages/video_player/video_player/lib/video_player.dart
+++ b/packages/video_player/video_player/lib/video_player.dart
@@ -87,12 +87,10 @@
/// A description of the error if present.
///
- /// If [hasError] is false this is [null].
+ /// If [hasError] is false this is `null`.
final String? errorDescription;
/// The [size] of the currently loaded video.
- ///
- /// Is null when [initialized] is false.
final Size size;
/// Indicates whether or not the video has been loaded and is ready to play.
@@ -102,8 +100,12 @@
/// [errorDescription] should have information about the problem.
bool get hasError => errorDescription != null;
- /// Returns [size.width] / [size.height] when size is non-null, or `1.0.` when
- /// size is null or the aspect ratio would be less than or equal to 0.0.
+ /// Returns [size.width] / [size.height].
+ ///
+ /// Will return `1.0` if:
+ /// * [isInitialized] is `false`
+ /// * [size.width], or [size.height] is equal to `0.0`
+ /// * aspect ratio would be less than or equal to `0.0`
double get aspectRatio {
if (!isInitialized || size.width == 0 || size.height == 0) {
return 1.0;
diff --git a/packages/video_player/video_player/pubspec.yaml b/packages/video_player/video_player/pubspec.yaml
index 3c6a34c..17442d7 100644
--- a/packages/video_player/video_player/pubspec.yaml
+++ b/packages/video_player/video_player/pubspec.yaml
@@ -1,7 +1,7 @@
name: video_player
description: Flutter plugin for displaying inline video with other Flutter
widgets on Android, iOS, and web.
-version: 2.0.1
+version: 2.0.2
homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player
flutter: