image.dart 21.5 KB
Newer Older
1 2 3 4
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5
import 'dart:async';
6
import 'dart:io' show File;
7
import 'dart:typed_data';
8

9
import 'package:flutter/foundation.dart';
10
import 'package:flutter/painting.dart';
11 12 13 14
import 'package:flutter/services.dart';

import 'basic.dart';
import 'framework.dart';
Ian Hickson's avatar
Ian Hickson committed
15
import 'localizations.dart';
16
import 'media_query.dart';
17
import 'ticker_provider.dart';
18

19
export 'package:flutter/painting.dart' show
20 21
  AssetImage,
  ExactAssetImage,
22 23 24 25 26
  FileImage,
  ImageConfiguration,
  ImageInfo,
  ImageStream,
  ImageProvider,
27
  MemoryImage,
28
  NetworkImage;
29

30 31 32 33 34
/// Creates an [ImageConfiguration] based on the given [BuildContext] (and
/// optionally size).
///
/// This is the object that must be passed to [BoxPainter.paint] and to
/// [ImageProvider.resolve].
35 36 37
///
/// If this is not called from a build method, then it should be reinvoked
/// whenever the dependencies change, e.g. by calling it from
38
/// [State.didChangeDependencies], so that any changes in the environment are
39 40 41 42 43
/// picked up (e.g. if the device pixel ratio changes).
///
/// See also:
///
///  * [ImageProvider], which has an example showing how this might be used.
44 45 46
ImageConfiguration createLocalImageConfiguration(BuildContext context, { Size size }) {
  return new ImageConfiguration(
    bundle: DefaultAssetBundle.of(context),
47
    devicePixelRatio: MediaQuery.of(context, nullOk: true)?.devicePixelRatio ?? 1.0,
Ian Hickson's avatar
Ian Hickson committed
48 49
    locale: Localizations.localeOf(context, nullOk: true),
    textDirection: Directionality.of(context),
50
    size: size,
51
    platform: defaultTargetPlatform,
52 53 54
  );
}

55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
/// Prefetches an image into the image cache.
///
/// Returns a [Future] that will complete when the first image yielded by the
/// [ImageProvider] is available.
///
/// If the image is later used by an [Image] or [BoxDecoration] or [FadeInImage],
/// it will probably be loaded faster.  The consumer of the image does not need
/// to use the same [ImageProvider] instance.  The [ImageCache] will find the image
/// as long as both images share the same key.
///
/// The [BuildContext] and [Size] are used to select an image configuration
/// (see [createLocalImageConfiguration]).
///
/// See also:
///
///   * [ImageCache], which holds images that may be reused.
Future<Null> precacheImage(ImageProvider provider, BuildContext context, { Size size }) {
  final ImageConfiguration config = createLocalImageConfiguration(context, size: size);
  final Completer<Null> completer = new Completer<Null>();
  final ImageStream stream = provider.resolve(config);
  void listener(ImageInfo image, bool sync) {
    completer.complete();
  }
  stream.addListener(listener);
  completer.future.then((Null _) { stream.removeListener(listener); });
  return completer.future;
}

83 84 85 86 87
/// A widget that displays an image.
///
/// Several constructors are provided for the various ways that an image can be
/// specified:
///
88 89 90 91 92 93
///  * [new Image], for obtaining an image from an [ImageProvider].
///  * [new Image.asset], for obtaining an image from an [AssetBundle]
///    using a key.
///  * [new Image.network], for obtaining an image from a URL.
///  * [new Image.file], for obtaining an image from a [File].
///  * [new Image.memory], for obtaining an image from a [Uint8List].
94
///
95 96
/// The following image formats are supported: {@macro flutter.dart:ui.imageFormats}
///
97 98 99 100 101 102
/// To automatically perform pixel-density-aware asset resolution, specify the
/// image using an [AssetImage] and make sure that a [MaterialApp], [WidgetsApp],
/// or [MediaQuery] widget exists above the [Image] widget in the widget tree.
///
/// The image is painted using [paintImage], which describes the meanings of the
/// various fields on this class in more detail.
103 104 105
///
/// See also:
///
Ian Hickson's avatar
Ian Hickson committed
106 107 108 109
///  * [Icon], which shows an image from a font.
///  * [new Ink.image], which is the preferred way to show an image in a
///    material application (especially if the image is in a [Material] and will
///    have an [InkWell] on top of it).
110 111 112 113
class Image extends StatefulWidget {
  /// Creates a widget that displays an image.
  ///
  /// To show an image from the network or from an asset bundle, consider using
114
  /// [new Image.network] and [new Image.asset] respectively.
115
  ///
Ian Hickson's avatar
Ian Hickson committed
116 117
  /// The [image], [alignment], [repeat], and [matchTextDirection] arguments
  /// must not be null.
Ian Hickson's avatar
Ian Hickson committed
118 119 120 121 122
  ///
  /// Either the [width] and [height] arguments should be specified, or the
  /// widget should be placed in a context that sets tight layout constraints.
  /// Otherwise, the image dimensions will change as the image is loaded, which
  /// will result in ugly layout changes.
123
  const Image({
124 125 126 127 128
    Key key,
    @required this.image,
    this.width,
    this.height,
    this.color,
129
    this.colorBlendMode,
130
    this.fit,
131
    this.alignment: Alignment.center,
132 133
    this.repeat: ImageRepeat.noRepeat,
    this.centerSlice,
Ian Hickson's avatar
Ian Hickson committed
134
    this.matchTextDirection: false,
135
    this.gaplessPlayback: false,
136
  }) : assert(image != null),
Ian Hickson's avatar
Ian Hickson committed
137 138 139
       assert(alignment != null),
       assert(repeat != null),
       assert(matchTextDirection != null),
140
       super(key: key);
141 142 143 144

  /// Creates a widget that displays an [ImageStream] obtained from the network.
  ///
  /// The [src], [scale], and [repeat] arguments must not be null.
Ian Hickson's avatar
Ian Hickson committed
145 146 147 148 149
  ///
  /// Either the [width] and [height] arguments should be specified, or the
  /// widget should be placed in a context that sets tight layout constraints.
  /// Otherwise, the image dimensions will change as the image is loaded, which
  /// will result in ugly layout changes.
150 151
  ///
  /// All network images are cached regardless of HTTP headers.
Ian Hickson's avatar
Ian Hickson committed
152 153 154
  ///
  /// An optional [headers] argument can be used to send custom HTTP headers
  /// with the image request.
155
  Image.network(String src, {
156 157 158 159 160
    Key key,
    double scale: 1.0,
    this.width,
    this.height,
    this.color,
161
    this.colorBlendMode,
162
    this.fit,
163
    this.alignment: Alignment.center,
164 165
    this.repeat: ImageRepeat.noRepeat,
    this.centerSlice,
Ian Hickson's avatar
Ian Hickson committed
166
    this.matchTextDirection: false,
167
    this.gaplessPlayback: false,
168 169
    Map<String, String> headers,
  }) : image = new NetworkImage(src, scale: scale, headers: headers),
Ian Hickson's avatar
Ian Hickson committed
170 171 172
       assert(alignment != null),
       assert(repeat != null),
       assert(matchTextDirection != null),
173 174
       super(key: key);

Ian Hickson's avatar
Ian Hickson committed
175 176 177 178
  /// Creates a widget that displays an [ImageStream] obtained from a [File].
  ///
  /// The [file], [scale], and [repeat] arguments must not be null.
  ///
Ian Hickson's avatar
Ian Hickson committed
179 180 181 182 183
  /// Either the [width] and [height] arguments should be specified, or the
  /// widget should be placed in a context that sets tight layout constraints.
  /// Otherwise, the image dimensions will change as the image is loaded, which
  /// will result in ugly layout changes.
  ///
Ian Hickson's avatar
Ian Hickson committed
184 185 186 187 188 189 190 191
  /// On Android, this may require the
  /// `android.permission.READ_EXTERNAL_STORAGE` permission.
  Image.file(File file, {
    Key key,
    double scale: 1.0,
    this.width,
    this.height,
    this.color,
192
    this.colorBlendMode,
Ian Hickson's avatar
Ian Hickson committed
193
    this.fit,
194
    this.alignment: Alignment.center,
Ian Hickson's avatar
Ian Hickson committed
195 196
    this.repeat: ImageRepeat.noRepeat,
    this.centerSlice,
Ian Hickson's avatar
Ian Hickson committed
197
    this.matchTextDirection: false,
198
    this.gaplessPlayback: false,
Ian Hickson's avatar
Ian Hickson committed
199
  }) : image = new FileImage(file, scale: scale),
Ian Hickson's avatar
Ian Hickson committed
200 201 202
       assert(alignment != null),
       assert(repeat != null),
       assert(matchTextDirection != null),
Ian Hickson's avatar
Ian Hickson committed
203 204
       super(key: key);

205 206 207
  /// Creates a widget that displays an [ImageStream] obtained from an asset
  /// bundle. The key for the image is given by the `name` argument.
  ///
208 209 210 211
  /// The `package` argument must be non-null when displaying an image from a
  /// package and null otherwise. See the `Assets in packages` section for
  /// details.
  ///
212 213 214
  /// If the `bundle` argument is omitted or null, then the
  /// [DefaultAssetBundle] will be used.
  ///
215 216
  /// By default, the pixel-density-aware asset resolution will be attempted. In
  /// addition:
217
  ///
218 219
  /// * If the `scale` argument is provided and is not null, then the exact
  /// asset specified will be used.
220 221 222 223 224 225 226
  //
  // TODO(ianh): Implement the following (see ../services/image_resolution.dart):
  // ///
  // /// * If [width] and [height] are both specified, and [scale] is not, then
  // ///   size-aware asset resolution will be attempted also, with the given
  // ///   dimensions interpreted as logical pixels.
  // ///
Ian Hickson's avatar
Ian Hickson committed
227 228 229
  // /// * If the images have platform, locale, or directionality variants, the
  // ///   current platform, locale, and directionality are taken into account
  // ///   during asset resolution as well.
230 231
  ///
  /// The [name] and [repeat] arguments must not be null.
232
  ///
Ian Hickson's avatar
Ian Hickson committed
233 234 235 236 237
  /// Either the [width] and [height] arguments should be specified, or the
  /// widget should be placed in a context that sets tight layout constraints.
  /// Otherwise, the image dimensions will change as the image is loaded, which
  /// will result in ugly layout changes.
  ///
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
  /// ## Sample code
  ///
  /// Suppose that the project's `pubspec.yaml` file contains the following:
  ///
  /// ```yaml
  /// flutter:
  ///   assets:
  ///     - images/cat.png
  ///     - images/2x/cat.png
  ///     - images/3.5x/cat.png
  /// ```
  ///
  /// On a screen with a device pixel ratio of 2.0, the following widget would
  /// render the `images/2x/cat.png` file:
  ///
  /// ```dart
  /// new Image.asset('images/cat.png')
  /// ```
  ///
  /// This corresponds to the file that is in the project's `images/2x/`
  /// directory with the name `cat.png` (the paths are relative to the
  /// `pubspec.yaml` file).
  ///
261 262 263 264 265 266 267 268
  /// On a device with a 4.0 device pixel ratio, the `images/3.5x/cat.png` asset
  /// would be used. On a device with a 1.0 device pixel ratio, the
  /// `images/cat.png` resource would be used.
  ///
  /// The `images/cat.png` image can be omitted from disk (though it must still
  /// be present in the manifest). If it is omitted, then on a device with a 1.0
  /// device pixel ratio, the `images/2x/cat.png` image would be used instead.
  ///
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
  ///
  /// ## Assets in packages
  ///
  /// To create the widget with an asset from a package, the [package] argument
  /// must be provided. For instance, suppose a package called `my_icons` has
  /// `icons/heart.png` .
  ///
  /// Then to display the image, use:
  ///
  /// ```dart
  /// new Image.asset('icons/heart.png', package: 'my_icons')
  /// ```
  ///
  /// Assets used by the package itself should also be displayed using the
  /// [package] argument as above.
  ///
285
  /// If the desired asset is specified in the `pubspec.yaml` of the package, it
286
  /// is bundled automatically with the app. In particular, assets used by the
287
  /// package itself must be specified in its `pubspec.yaml`.
288 289
  ///
  /// A package can also choose to have assets in its 'lib/' folder that are not
290
  /// specified in its `pubspec.yaml`. In this case for those images to be
291 292 293 294 295 296 297 298 299
  /// bundled, the app has to specify which ones to include. For instance a
  /// package named `fancy_backgrounds` could have:
  ///
  /// ```
  /// lib/backgrounds/background1.png
  /// lib/backgrounds/background2.png
  /// lib/backgrounds/background3.png
  ///```
  ///
300
  /// To include, say the first image, the `pubspec.yaml` of the app should
301 302 303 304 305 306 307
  /// specify it in the assets section:
  ///
  /// ```yaml
  ///  assets:
  ///    - packages/fancy_backgrounds/backgrounds/background1.png
  /// ```
  ///
Ian Hickson's avatar
Ian Hickson committed
308
  /// The `lib/` is implied, so it should not be included in the asset path.
309 310
  ///
  ///
311 312 313 314 315 316
  /// See also:
  ///
  ///  * [AssetImage], which is used to implement the behavior when the scale is
  ///    omitted.
  ///  * [ExactAssetImage], which is used to implement the behavior when the
  ///    scale is present.
317 318
  ///  * <https://flutter.io/assets-and-images/>, an introduction to assets in
  ///    Flutter.
319
  Image.asset(String name, {
320 321 322 323 324 325
    Key key,
    AssetBundle bundle,
    double scale,
    this.width,
    this.height,
    this.color,
326
    this.colorBlendMode,
327
    this.fit,
328
    this.alignment: Alignment.center,
329 330
    this.repeat: ImageRepeat.noRepeat,
    this.centerSlice,
Ian Hickson's avatar
Ian Hickson committed
331
    this.matchTextDirection: false,
332
    this.gaplessPlayback: false,
Ian Hickson's avatar
Ian Hickson committed
333
    String package,
334
  }) : image = scale != null
Ian Hickson's avatar
Ian Hickson committed
335 336 337 338 339 340
         ? new ExactAssetImage(name, bundle: bundle, scale: scale, package: package)
         : new AssetImage(name, bundle: bundle, package: package),
       assert(alignment != null),
       assert(repeat != null),
       assert(matchTextDirection != null),
       super(key: key);
341

342 343 344
  /// Creates a widget that displays an [ImageStream] obtained from a [Uint8List].
  ///
  /// The [bytes], [scale], and [repeat] arguments must not be null.
Ian Hickson's avatar
Ian Hickson committed
345 346 347 348 349
  ///
  /// Either the [width] and [height] arguments should be specified, or the
  /// widget should be placed in a context that sets tight layout constraints.
  /// Otherwise, the image dimensions will change as the image is loaded, which
  /// will result in ugly layout changes.
350 351 352 353 354 355
  Image.memory(Uint8List bytes, {
    Key key,
    double scale: 1.0,
    this.width,
    this.height,
    this.color,
356
    this.colorBlendMode,
357
    this.fit,
358
    this.alignment: Alignment.center,
359 360
    this.repeat: ImageRepeat.noRepeat,
    this.centerSlice,
Ian Hickson's avatar
Ian Hickson committed
361
    this.matchTextDirection: false,
362
    this.gaplessPlayback: false,
363
  }) : image = new MemoryImage(bytes, scale: scale),
Ian Hickson's avatar
Ian Hickson committed
364 365 366
       assert(alignment != null),
       assert(repeat != null),
       assert(matchTextDirection != null),
367 368
       super(key: key);

369 370 371 372 373 374 375
  /// The image to display.
  final ImageProvider image;

  /// If non-null, require the image to have this width.
  ///
  /// If null, the image will pick a size that best preserves its intrinsic
  /// aspect ratio.
Ian Hickson's avatar
Ian Hickson committed
376 377 378 379 380 381
  ///
  /// It is strongly recommended that either both the [width] and the [height]
  /// be specified, or that the widget be placed in a context that sets tight
  /// layout constraints, so that the image does not change size as it loads.
  /// Consider using [fit] to adapt the image's rendering to fit the given width
  /// and height if the exact image dimensions are not known in advance.
382 383 384 385 386 387
  final double width;

  /// If non-null, require the image to have this height.
  ///
  /// If null, the image will pick a size that best preserves its intrinsic
  /// aspect ratio.
Ian Hickson's avatar
Ian Hickson committed
388 389 390 391 392 393
  ///
  /// It is strongly recommended that either both the [width] and the [height]
  /// be specified, or that the widget be placed in a context that sets tight
  /// layout constraints, so that the image does not change size as it loads.
  /// Consider using [fit] to adapt the image's rendering to fit the given width
  /// and height if the exact image dimensions are not known in advance.
394 395
  final double height;

396
  /// If non-null, this color is blended with each image pixel using [colorBlendMode].
397 398
  final Color color;

399 400 401 402 403 404 405 406 407 408
  /// Used to combine [color] with this image.
  ///
  /// The default is [BlendMode.srcIn]. In terms of the blend mode, [color] is
  /// the source and this image is the destination.
  ///
  /// See also:
  ///
  ///  * [BlendMode], which includes an illustration of the effect of each blend mode.
  final BlendMode colorBlendMode;

Adam Barth's avatar
Adam Barth committed
409
  /// How to inscribe the image into the space allocated during layout.
410 411 412
  ///
  /// The default varies based on the other fields. See the discussion at
  /// [paintImage].
413
  final BoxFit fit;
414 415 416

  /// How to align the image within its bounds.
  ///
Ian Hickson's avatar
Ian Hickson committed
417
  /// The alignment aligns the given position in the image to the given position
418 419 420
  /// in the layout bounds. For example, a [Alignment] alignment of (-1.0,
  /// -1.0) aligns the image to the top-left corner of its layout bounds, while a
  /// [Alignment] alignment of (1.0, 1.0) aligns the bottom right of the
Ian Hickson's avatar
Ian Hickson committed
421
  /// image with the bottom right corner of its layout bounds. Similarly, an
422
  /// alignment of (0.0, 1.0) aligns the bottom middle of the image with the
Ian Hickson's avatar
Ian Hickson committed
423 424 425 426 427 428
  /// middle of the bottom edge of its layout bounds.
  ///
  /// To display a subpart of an image, consider using a [CustomPainter] and
  /// [Canvas.drawImageRect].
  ///
  /// If the [alignment] is [TextDirection]-dependent (i.e. if it is a
429
  /// [AlignmentDirectional]), then an ambient [Directionality] widget
Ian Hickson's avatar
Ian Hickson committed
430 431
  /// must be in scope.
  ///
432
  /// Defaults to [Alignment.center].
433 434 435 436 437 438 439
  ///
  /// See also:
  ///
  ///  * [Alignment], a class with convenient constants typically used to
  ///    specify an [AlignmentGeometry].
  ///  * [AlignmentDirectional], like [Alignment] for specifying alignments
  ///    relative to text direction.
440
  final AlignmentGeometry alignment;
441 442 443 444 445 446 447 448 449 450 451 452 453

  /// How to paint any portions of the layout bounds not covered by the image.
  final ImageRepeat repeat;

  /// The center slice for a nine-patch image.
  ///
  /// The region of the image inside the center slice will be stretched both
  /// horizontally and vertically to fit the image into its destination. The
  /// region of the image above and below the center slice will be stretched
  /// only horizontally and the region of the image to the left and right of
  /// the center slice will be stretched only vertically.
  final Rect centerSlice;

Ian Hickson's avatar
Ian Hickson committed
454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470
  /// Whether to paint the image in the direction of the [TextDirection].
  ///
  /// If this is true, then in [TextDirection.ltr] contexts, the image will be
  /// drawn with its origin in the top left (the "normal" painting direction for
  /// images); and in [TextDirection.rtl] contexts, the image will be drawn with
  /// a scaling factor of -1 in the horizontal direction so that the origin is
  /// in the top right.
  ///
  /// This is occasionally used with images in right-to-left environments, for
  /// images that were designed for left-to-right locales. Be careful, when
  /// using this, to not flip images with integral shadows, text, or other
  /// effects that will look incorrect when flipped.
  ///
  /// If this is true, there must be an ambient [Directionality] widget in
  /// scope.
  final bool matchTextDirection;

471 472 473 474 475 476 477 478
  /// Whether to continue showing the old image (true), or briefly show nothing
  /// (false), when the image provider changes.
  final bool gaplessPlayback;

  @override
  _ImageState createState() => new _ImageState();

  @override
479
  void debugFillProperties(DiagnosticPropertiesBuilder description) {
480 481 482 483 484 485 486
    super.debugFillProperties(description);
    description.add(new DiagnosticsProperty<ImageProvider>('image', image));
    description.add(new DoubleProperty('width', width, defaultValue: null));
    description.add(new DoubleProperty('height', height, defaultValue: null));
    description.add(new DiagnosticsProperty<Color>('color', color, defaultValue: null));
    description.add(new EnumProperty<BlendMode>('colorBlendMode', colorBlendMode, defaultValue: null));
    description.add(new EnumProperty<BoxFit>('fit', fit, defaultValue: null));
487
    description.add(new DiagnosticsProperty<AlignmentGeometry>('alignment', alignment, defaultValue: null));
488 489
    description.add(new EnumProperty<ImageRepeat>('repeat', repeat, defaultValue: ImageRepeat.noRepeat));
    description.add(new DiagnosticsProperty<Rect>('centerSlice', centerSlice, defaultValue: null));
Ian Hickson's avatar
Ian Hickson committed
490
    description.add(new FlagProperty('matchTextDirection', value: matchTextDirection, ifTrue: 'match text direction'));
491 492 493 494 495 496
  }
}

class _ImageState extends State<Image> {
  ImageStream _imageStream;
  ImageInfo _imageInfo;
497
  bool _isListeningToStream = false;
498 499

  @override
500
  void didChangeDependencies() {
501
    _resolveImage();
502 503 504 505 506 507

    if (TickerMode.of(context))
      _listenToStream();
    else
      _stopListeningToStream();

508
    super.didChangeDependencies();
509 510
  }

511
  @override
512
  void didUpdateWidget(Image oldWidget) {
513
    super.didUpdateWidget(oldWidget);
514
    if (widget.image != oldWidget.image)
515 516 517
      _resolveImage();
  }

518 519
  @override
  void reassemble() {
520
    _resolveImage(); // in case the image cache was flushed
521 522 523
    super.reassemble();
  }

524
  void _resolveImage() {
525 526 527 528 529 530 531
    final ImageStream newStream =
      widget.image.resolve(createLocalImageConfiguration(
          context,
          size: widget.width != null && widget.height != null ? new Size(widget.width, widget.height) : null
      ));
    assert(newStream != null);
    _updateSourceStream(newStream);
532 533
  }

534
  void _handleImageChanged(ImageInfo imageInfo, bool synchronousCall) {
535 536 537 538 539
    setState(() {
      _imageInfo = imageInfo;
    });
  }

540 541 542 543 544 545 546 547 548 549
  // Update _imageStream to newStream, and moves the stream listener
  // registration from the old stream to the new stream (if a listener was
  // registered).
  void _updateSourceStream(ImageStream newStream) {
    if (_imageStream?.key == newStream?.key)
      return;

    if (_isListeningToStream)
      _imageStream.removeListener(_handleImageChanged);

550 551 552
    if (!widget.gaplessPlayback)
      setState(() { _imageInfo = null; });

553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571
    _imageStream = newStream;
    if (_isListeningToStream)
      _imageStream.addListener(_handleImageChanged);
  }

  void _listenToStream() {
    if (_isListeningToStream)
      return;
    _imageStream.addListener(_handleImageChanged);
    _isListeningToStream = true;
  }

  void _stopListeningToStream() {
    if (!_isListeningToStream)
      return;
    _imageStream.removeListener(_handleImageChanged);
    _isListeningToStream = false;
  }

572
  @override
573 574
  void dispose() {
    assert(_imageStream != null);
575
    _stopListeningToStream();
576 577
    super.dispose();
  }
578

579 580
  @override
  Widget build(BuildContext context) {
581 582
    return new RawImage(
      image: _imageInfo?.image,
583 584
      width: widget.width,
      height: widget.height,
585
      scale: _imageInfo?.scale ?? 1.0,
586
      color: widget.color,
587
      colorBlendMode: widget.colorBlendMode,
588 589 590
      fit: widget.fit,
      alignment: widget.alignment,
      repeat: widget.repeat,
Ian Hickson's avatar
Ian Hickson committed
591 592
      centerSlice: widget.centerSlice,
      matchTextDirection: widget.matchTextDirection,
593 594
    );
  }
595 596

  @override
597
  void debugFillProperties(DiagnosticPropertiesBuilder description) {
598 599 600
    super.debugFillProperties(description);
    description.add(new DiagnosticsProperty<ImageStream>('stream', _imageStream));
    description.add(new DiagnosticsProperty<ImageInfo>('pixels', _imageInfo));
601
  }
602
}