NineTileBoxWidget.asset constructor

NineTileBoxWidget.asset({
  1. required String path,
  2. required double tileSize,
  3. required double destTileSize,
  4. Images? images,
  5. double? width,
  6. double? height,
  7. Widget? child,
  8. EdgeInsetsGeometry? padding,
  9. WidgetBuilder? errorBuilder,
  10. WidgetBuilder? loadingBuilder,
  11. String? package,
  12. Key? key,
})

Loads image from the asset path and renders it as a widget.

It will use the loadingBuilder while the image from path is loading. To render without loading, or when you want to have a gapless playback when the path value changes, consider loading the image beforehand and direct pass it to the default constructor.

The path is the full path of the asset, as declared in the pubspec.yaml, for example assets/images/player.png. When a package is given, the path is resolved relative to that package's assets.

Implementation

NineTileBoxWidget.asset({
  required String path,
  required this.tileSize,
  required this.destTileSize,
  Images? images,
  this.width,
  this.height,
  this.child,
  this.padding,
  this.errorBuilder,
  this.loadingBuilder,
  String? package,
  super.key,
}) : _imageFuture = (images ?? Flame.images).load(path, package: package);