Gif constructor
const
Gif({
- Key? key,
- required ImageProvider<
Object> image, - required GifController controller,
- int? fps,
- Duration? duration,
- Autostart autostart = Autostart.no,
- Widget placeholder(
- BuildContext context
- VoidCallback? onFetchCompleted,
- String? semanticLabel,
- bool excludeFromSemantics = false,
- double? width,
- double? height,
- Color? color,
- BlendMode? colorBlendMode,
- BoxFit? fit,
- AlignmentGeometry alignment = Alignment.center,
- ImageRepeat repeat = ImageRepeat.noRepeat,
- Rect? centerSlice,
- bool matchTextDirection = false,
- 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');