xvrh / lottie-flutter

Render After Effects animations natively on Flutter. This package is a pure Dart implementation of a Lottie player.
https://pub.dev/packages/lottie
MIT License
1.16k stars 196 forks source link

How to display a circular image? #245

Closed karmalove closed 1 year ago

karmalove commented 1 year ago

My original image is rectangle, I want to show circle image。 eg: Assets.lib.res.lottie.love.data.lottie( imageProviderFactory: (image) { if (image.fileName == 'img_0.png') { // return CachedNetworkImageProvider( // 'https://img2.baidu.com/it/u=3684117954,695988885&fm=253&fmt=auto&app=138&f=JPEG?w=400&h=400', // ); } else { return null; } }, delegates: LottieDelegates( image: (composition, image) { if(image.id=='image_0') { loadImage( const NetworkImage( 'https://img2.baidu.com/it/u=3684117954,695988885&fm=253&fmt=auto&app=138&f=JPEG?w=400&h=400', ), ).then((value) { return composition.images['image_0']?.loadedImage = value; }); } //Use the default method: // composition.images[image.id].loadedImage; return null; }, ), ),