@@ -323,14 +323,18 @@ class _State extends State<Lottie> {
323323}
324324
325325class TVGCanvas extends CustomPainter {
326- TVGCanvas (
327- {required this .image,
328- required this .width,
329- required this .height,
330- required this .lottieWidth,
331- required this .lottieHeight,
332- required this .renderWidth,
333- required this .renderHeight});
326+ TVGCanvas ({
327+ required this .image,
328+ required this .width,
329+ required this .height,
330+ required this .lottieWidth,
331+ required this .lottieHeight,
332+ required this .renderWidth,
333+ required this .renderHeight,
334+ this .fit = BoxFit .none,
335+ this .filterQuality = FilterQuality .high,
336+ this .alignment = Alignment .center,
337+ });
334338
335339 double width;
336340 double height;
@@ -343,6 +347,10 @@ class TVGCanvas extends CustomPainter {
343347
344348 ui.Image image;
345349
350+ BoxFit fit;
351+ FilterQuality filterQuality;
352+ Alignment alignment;
353+
346354 @override
347355 void paint (Canvas canvas, Size size) {
348356 final left = renderWidth > width ? 0.0 : (width - renderWidth) / 2 ;
@@ -352,9 +360,9 @@ class TVGCanvas extends CustomPainter {
352360 canvas: canvas,
353361 rect: Rect .fromLTWH (left, top, renderWidth, renderHeight),
354362 image: image,
355- fit: BoxFit .none, //NOTE: Should make it a param
356- filterQuality: FilterQuality .high, //NOTE: Should make it a param
357- alignment: Alignment .center, //NOTE: Should make it a param
363+ fit: fit,
364+ filterQuality: filterQuality,
365+ alignment: alignment,
358366 );
359367 }
360368
0 commit comments