Skip to content

Commit

Permalink
expose a Duration object from ui.FrameInfo (flutter#4345)
Browse files Browse the repository at this point in the history
  • Loading branch information
amirh authored Nov 9, 2017
1 parent fb6f3e0 commit c1b5e06
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/ui/painting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,9 @@ typedef void ImageDecoderCallback(Image result);
/// Obtain a FrameInfo with [Codec.getNextFrame].
abstract class FrameInfo extends NativeFieldWrapperClass2 {
// The duration this frame should be shown.
int get durationMillis native "FrameInfo_durationMillis";
Duration get duration => new Duration(milliseconds: _durationMillis);

int get _durationMillis native "FrameInfo_durationMillis";

// The Image object for this frame.
Image get image native "FrameInfo_image";
Expand Down
4 changes: 2 additions & 2 deletions testing/dart/codec_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void main() {
for (int i = 0; i < 5; i++) {
ui.FrameInfo frameInfo = await codec.getNextFrame();
decodedFrameInfos.add([
frameInfo.durationMillis,
frameInfo.duration.inMilliseconds,
frameInfo.image.width,
frameInfo.image.height,
]);
Expand All @@ -62,7 +62,7 @@ void main() {
for (int i = 0; i < 2; i++) {
ui.FrameInfo frameInfo = await codec.getNextFrame();
decodedFrameInfos.add([
frameInfo.durationMillis,
frameInfo.duration.inMilliseconds,
frameInfo.image.width,
frameInfo.image.height,
]);
Expand Down

0 comments on commit c1b5e06

Please sign in to comment.