VideoDimensions instead of width height

This commit is contained in:
Hiroshi Horie
2021-12-13 21:49:42 +07:00
parent 3384bc6c6e
commit a82c5a7a50
7 changed files with 60 additions and 60 deletions
+18 -2
View File
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'extensions.dart';
import 'dart:math' as math;
typedef CancelListenFunc = Function();
@@ -134,12 +135,27 @@ class RTCIceServer {
}
@immutable
class TrackDimension {
class VideoDimensions {
final int width;
final int height;
const TrackDimension(
const VideoDimensions(
this.width,
this.height,
);
@override
String toString() => 'VideoDimensions(${width}×${height})';
/// Returns the larger value
int max() => math.max(width, height);
VideoDimensions copyWith({
int? width,
int? height,
}) =>
VideoDimensions(
width ?? this.width,
height ?? this.height,
);
}