Gif constructor

const Gif({
  1. Key? key,
  2. required ImageProvider<Object> image,
  3. required GifController controller,
  4. int? fps,
  5. Duration? duration,
  6. Autostart autostart = Autostart.no,
  7. Widget placeholder(
    1. BuildContext context
    )?,
  8. VoidCallback? onFetchCompleted,
  9. String? semanticLabel,
  10. bool excludeFromSemantics = false,
  11. double? width,
  12. double? height,
  13. Color? color,
  14. BlendMode? colorBlendMode,
  15. BoxFit? fit,
  16. AlignmentGeometry alignment = Alignment.center,
  17. ImageRepeat repeat = ImageRepeat.noRepeat,
  18. Rect? centerSlice,
  19. bool matchTextDirection = false,
  20. bool useCache = true,
})

Creates a widget that displays a controllable gif.

fps frames per second at which this should be rendered.

duration whole playback duration for this gif.

autostart if and how to start this gif. Defaults to Autostart.no.

placeholder this widget is rendered during the gif frames fetch.

onFetchCompleted is called when the frames fetch finishes and the gif can be rendered.

Only one of the two can be set: fps or duration If controller.duration and fps are not specified, the original gif framerate will be used.

Implementation

const Gif({
  super.key,
  required this.image,
  required this.controller,
  this.fps,
  this.duration,
  this.autostart = Autostart.no,
  this.placeholder,
  this.onFetchCompleted,
  this.semanticLabel,
  this.excludeFromSemantics = false,
  this.width,
  this.height,
  this.color,
  this.colorBlendMode,
  this.fit,
  this.alignment = Alignment.center,
  this.repeat = ImageRepeat.noRepeat,
  this.centerSlice,
  this.matchTextDirection = false,
  this.useCache = true,
})  : assert(fps == null || duration == null,
          'only one of the two can be set [fps] [duration]'),
      assert(fps == null || fps > 0, 'fps must be greater than 0');