Use lottie in flutter for both iOS and Android

Related tags

Image flutter_lottie
Overview

flutter_lottie

Use Lottie in Flutter.

Supports both iOS and Android using lottie-ios and lottie-android

Current Status

Supports most features that both iOS and Android support.

The only dynamic property changing that is supported for now is color and opacity. Project will be updated later to include support for other properties.

Example in the github repo includes a good intro into using the library.

IMPORTANT NOTE

To use with iOS, you will need to add this key to your info.plist file located in: project/ios/Runner/Info.plist

<key>io.flutter.embedded_views_preview</key>
<true />
Comments
  • java.lang.IllegalStateException: Missing values for keyframe.  on Android

    java.lang.IllegalStateException: Missing values for keyframe. on Android

    
    @override
      Widget build(BuildContext context) {
        return CupertinoPageScaffold(
          child: Center(
            child: SizedBox(
              width: 500,
              height: 300,
              child: LottieView.fromFile(
                  autoPlay: true,
                  onViewCreated: onViewCreated,
                  filePath: "asset/animal/ani_hi.json"),
            ),
          ),
        );
      }
    
    
    java.lang.IllegalStateException: Missing values for keyframe.
    E/AndroidRuntime(10726): 	at com.airbnb.lottie.animation.keyframe.ScaleKeyframeAnimation.getValue(ScaleKeyframeAnimation.java:16)
    E/AndroidRuntime(10726): 	at com.airbnb.lottie.animation.keyframe.ScaleKeyframeAnimation.getValue(ScaleKeyframeAnimation.java:9)
    E/AndroidRuntime(10726): 	at com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.getValue(BaseKeyframeAnimation.java:125)
    E/AndroidRuntime(10726): 	at com.airbnb.lottie.animation.keyframe.TransformKeyframeAnimation.getMatrix(TransformKeyframeAnimation.java:118)
    E/AndroidRuntime(10726): 	at com.airbnb.lottie.model.layer.BaseLayer.draw(BaseLayer.java:199)
    E/AndroidRuntime(10726): 	at com.airbnb.lottie.model.layer.CompositionLayer.drawLayer(CompositionLayer.java:100)
    E/AndroidRuntime(10726): 	at com.airbnb.lottie.model.layer.BaseLayer.draw(BaseLayer.java:201)
    E/AndroidRuntime(10726): 	at com.airbnb.lottie.LottieDrawable.draw(LottieDrawable.java:319)
    E/AndroidRuntime(10726): 	at android.widget.ImageView.onDraw(ImageView.java:1360)
    E/AndroidRuntime(10726): 	at android.view.View.draw(View.java:21860)
    E/AndroidRuntime(10726): 	at android.view.View.buildDrawingCacheImpl(View.java:21129)
    E/AndroidRuntime(10726): 	at android.view.View.buildDrawingCache(View.java:20989)
    E/AndroidRuntime(10726): 	at android.view.View.draw(View.java:21578)
    E/AndroidRuntime(10726): 	at android.view.ViewGroup.drawChild(ViewGroup.java:4551)
    E/AndroidRuntime(10726): 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4326)
    E/AndroidRuntime(10726): 	at android.view.View.updateDisplayListIfDirty(View.java:20719)
    E/AndroidRuntime(10726): 	at android.view.View.draw(View.java:21586)
    E/AndroidRuntime(10726): 	at android.view.ViewGroup.drawChild(ViewGroup.java:4551)
    E/AndroidRuntime(10726): 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4326)
    E/AndroidRuntime(10726): 	at android.view.View.updateDisplayListIfDirty(View.java:20719)
    E/AndroidRuntime(10726): 	at android.view.View.draw(View.java:21586)
    E/AndroidRuntime(10726): 	at android.view.ViewGroup.drawChild(ViewGroup.java:4551)
    E/AndroidRuntime(10726): 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4326)
    E/AndroidRuntime(10726): 	at android.view.View.updateDisplayListIfDirty(View.java:20719)
    E/AndroidRuntime(10726): 	at android.view.View.draw(View.java:21586)
    E/AndroidRuntime(10726): 	at android.view.ViewGroup.drawChild(ViewGroup.java:4551)
    E/AndroidRuntime(10726): 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4326)
    E/AndroidRuntime(10726): 	at android.view.View.updateDisplayListIfDirty(View.java:20719)
    E/AndroidRuntime(10726): 	at android.view.View.draw(View.java:21586)
    E/AndroidRuntime(10726): 	at android.view.ViewGroup.drawChild(ViewGroup.java:4551)
    E/AndroidRuntime(10726): 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4326)
    E/AndroidRuntime(10726): 	at android.view.View.draw(View.java:21863)
    E/AndroidRuntime(10726): 	at com.android.internal.policy.DecorView.draw(DecorView.java:1083)
    E/AndroidRuntime(10726): 	at android.view.View.updateDisplayListIfDirty(View.java:20733)
    E/AndroidRuntime(10726): 	at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:725)
    E/AndroidRuntime(10726): 	at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:731)
    E/AndroidRuntime(10726): 	at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:840)
    E/AndroidRuntime(10726): 	at android.view.ViewRootImpl.draw(ViewRootImpl.java:3932)
    E/AndroidRuntime(10726): 	at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:3706)
    E/AndroidRuntime(10726): 	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3014)
    E/AndroidRuntime(10726): 	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1873)
    E/AndroidRuntime(10726): 	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8478)
    E/AndroidRuntime(10726): 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:949)
    E/AndroidRuntime(10726): 	at android.view.Choreographer.doCallbacks(Choreographer.java:761)
    E/AndroidRuntime(10726): 	at android.view.Choreographer.doFrame(Choreographer.java:696)
    E/AndroidRuntime(10726): 	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:935)
    E/AndroidRuntime(10726): 	at android.os.Handler.handleCallback(Handler.java:873)
    E/AndroidRuntime(10726): 	at android.os.Handler.dispatchMessage(Handler.java:99)
    E/AndroidRuntime(10726): 	at android.os.Looper.loop(Looper.java:214)
    E/AndroidRuntime(10726): 	at android.app.ActivityThread.main(ActivityThread.java:6990)
    E/AndroidRuntime(10726): 	at java.lang.reflect.Method.invoke(Native Method)
    E/AndroidRuntime(10726): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    E/AndroidRuntime(10726): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)
    I/Process (10726): Sending signal. PID: 10726 SIG: 9
    
    Samsung Note 9 / Android 9.
    gradle.properties:
    org.gradle.jvmargs=-Xmx1536M
    android.useAndroidX=true
    android.enableJetifier=true
    
    opened by kaina404 3
  • Invalid Composition

    Invalid Composition

    App crashes with the following logs:

    E/AndroidRuntime(11357): java.lang.IllegalStateException: Unable to parse composition E/AndroidRuntime(11357): at com.airbnb.lottie.LottieAnimationView$2.onResult(LottieAnimationView.java:68) E/AndroidRuntime(11357): at com.airbnb.lottie.LottieAnimationView$2.onResult(LottieAnimationView.java:66) E/AndroidRuntime(11357): at com.airbnb.lottie.LottieTask.notifyFailureListeners(LottieTask.java:167) E/AndroidRuntime(11357): at com.airbnb.lottie.LottieTask.access$300(LottieTask.java:26) E/AndroidRuntime(11357): at com.airbnb.lottie.LottieTask$1.run(LottieTask.java:142) E/AndroidRuntime(11357): at android.os.Handler.handleCallback(Handler.java:873) E/AndroidRuntime(11357): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime(11357): at android.os.Looper.loop(Looper.java:193) E/AndroidRuntime(11357): at android.app.ActivityThread.main(ActivityThread.java:6669) E/AndroidRuntime(11357): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(11357): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) E/AndroidRuntime(11357): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) E/AndroidRuntime(11357): Caused by: java.io.FileNotFoundException: flutter_assets/assets/lottie animations/splashscreen.json E/AndroidRuntime(11357): at android.content.res.AssetManager.nativeOpenAsset(Native Method) E/AndroidRuntime(11357): at android.content.res.AssetManager.open(AssetManager.java:744) E/AndroidRuntime(11357): at android.content.res.AssetManager.open(AssetManager.java:721) E/AndroidRuntime(11357): at com.airbnb.lottie.LottieCompositionFactory.fromAssetSync(LottieCompositionFactory.java:100) E/AndroidRuntime(11357): at com.airbnb.lottie.LottieCompositionFactory$1.call(LottieCompositionFactory.java:81) E/AndroidRuntime(11357): at com.airbnb.lottie.LottieCompositionFactory$1.call(LottieCompositionFactory.java:79) E/AndroidRuntime(11357): at java.util.concurrent.FutureTask.run(FutureTask.java:266) E/AndroidRuntime(11357): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) E/AndroidRuntime(11357): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) E/AndroidRuntime(11357): at java.lang.Thread.run(Thread.java:764)

    opened by praharshbhatt 1
  • Error No podspec found for `mark922_flutter_lottie Finished with error: Error running pod install

    Error No podspec found for `mark922_flutter_lottie Finished with error: Error running pod install

    -> Fetching podspec for mark922_flutter_lottie from .symlinks/plugins/mark922_flutter_lottie/ios [!] No podspec found for mark922_flutter_lottie in .symlinks/plugins/mark922_flutter_lottie/ios

    opened by kaina404 0
  • Null Safety Issues

    Null Safety Issues

    Currently experiencing null safety issues with this library

    Error: Cannot run with sound null safety, because the following dependencies
    don't support null safety:
    
     - package:flutter_lottie
    
    opened by RileyManda 0
  • flutter_lottie example not working giving error. Dart Error: Unhandled exception:

    flutter_lottie example not working giving error. Dart Error: Unhandled exception:

    i tried the flutter_lottie exmaple avilable in the code but got the error,

    I/flutter (11371): Creating Method Channel convictiontech/flutter_lottie_0 E/flutter (11371): [ERROR:flutter/shell/common/shell.cc(199)] Dart Error: Unhandled exception: E/flutter (11371): PlatformException(error, java.lang.IllegalStateException: Unable to parse composition E/flutter (11371): at com.airbnb.lottie.LottieAnimationView$2.onResult(LottieAnimationView.java:68) E/flutter (11371): at com.airbnb.lottie.LottieAnimationView$2.onResult(LottieAnimationView.java:66) E/flutter (11371): at com.airbnb.lottie.LottieTask.addFailureListener(LottieTask.java:111) E/flutter (11371): at com.airbnb.lottie.LottieAnimationView.setCompositionTask(LottieAnimationView.java:386) E/flutter (11371): at com.airbnb.lottie.LottieAnimationView.setAnimation(LottieAnimationView.java:338) E/flutter (11371): at com.example.flutter_lottie.LottieView.create(LottieView.java:68) E/flutter (11371): at com.example.flutter_lottie.LottieView.<init>(LottieView.java:38) E/flutter (11371): at com.example.flutter_lottie.LottieViewFactory.create(LottieViewFactory.java:20) E/flutter (11371): at io.flutter.plugin.platform.SingleViewPresentation.onCreate(SingleViewPresentation.java:174) E/flutter (11371): at android.app.Dialog.dispatchOnCreate(Dialog.java:407) E/flutter (11371): at android.app.Dialog.show(Dialog.java:302) E/flutter (11371): at android.app.Presentation.show(Presentation.java:249) E/flutter (11371): at io.flutter.plugin.platform.VirtualDisplayController.<init>(VirtualDisplayController.java:93) E/flutter (11371): at io.flutter.plugin.platform.VirtualDisplayController.create(VirtualDisplayController.java:53) E/flutter (11371): at io.flutter.plugin.platform.PlatformViewsController$1.createPlatformView(PlatformViewsController.java:105) E/flutter (11371): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:96) E/flutter (11371): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:60) E/flutter (11371): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:231) E/flutter (11371): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:93) E/flutter (11371): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:642) E/flutter (11371): at android.os.MessageQueue.nativePollOnce(Native Method) E/flutter (11371): at android.os.MessageQueue.next(MessageQueue.java:326) E/flutter (11371): at android.os.Looper.loop(Looper.java:160) E/flutter (11371): at android.app.ActivityThread.main(ActivityThread.java:6669) E/flutter (11371): at java.lang.reflect.Method.invoke(Native Method) E/flutter (11371): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) E/flutter (11371): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) E/flutter (11371): Caused by: java.io.FileNotFoundException: flutter_assets/assets/animations/donut.json E/flutter (11371): at android.content.res.AssetManager.nativeOpenAsset(Native Method) E/flutter (11371): at android.content.res.AssetManager.open(AssetManager.java:744) E/flutter (11371): at android.content.res.AssetManager.open(AssetManager.java:721) E/flutter (11371): at com.airbnb.lottie.LottieCompositionFactory.fromAssetSync(LottieCompositionFactory.java:100) E/flutter (11371): at com.airbnb.lottie.LottieCompositionFactory$1.call(LottieCompositionFactory.java:81) E/flutter (11371): at com.airbnb.lottie.LottieCompositionFactory$1.call(LottieCompositionFactory.java:79) E/flutter (11371): at java.util.concurrent.FutureTask.run(FutureTask.java:266) E/flutter (11371): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) E/flutter (11371): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) E/flutter (11371): at java.lang.Thread.run(Thread.java:764) E/flutter (11371): , null)

    opened by rahulsinghk 0
Owner
Cameron Smith
Programmer and Co-Founder at Storm Code.
Cameron Smith
Crop any widget/image in Android, iOS, Web and Desktop with fancy and customizable UI, in pure Dart code.

crop A Flutter package for cropping any widget, not only images. This package is entirely written in Dart and supports Android, iOS, Web and Desktop.

Mahdi 225 Jan 6, 2023
A Flutter plugin for Android and iOS supports cropping images

Image Cropper A Flutter plugin for Android and iOS supports cropping images. This plugin is based on two different native libraries so it comes with d

HungHD 891 Dec 28, 2022
Flutter plugin that allows you to display multi image picker on iOS and Android. 👌🔝🎉

IMPORTANT: This repository has been archived and no longer mantained. As I don't have time anymore to work on the package it became very outdated. For

Radoslav Vitanov 898 Apr 29, 2021
📸 Easy to use yet very customizable zoomable image widget for Flutter, Photo View provides a gesture sensitive zoomable widget. Photo View is largely used to show interacive images and other stuff such as SVG.

Flutter Photo View A simple zoomable image/content widget for Flutter. PhotoView enables images to become able to zoom and pan with user gestures such

Fire Slime Games 1.7k Jan 3, 2023
Minimal Unsplash Android App to easily search and download images

Minimal Unsplash Android App to easily search and download images

Yash Garg 18 Dec 7, 2022
Simple and effective cross platform image saver for flutter, supported web and desktop

Simple and effective cross platform image saver for flutter, supported web and desktop

7c00 3 Oct 5, 2022
A flutter carousel widget, support infinite scroll, and custom child widget.

carousel_slider A carousel slider widget. Features Infinite scroll Custom child widgets Auto play Supported platforms Flutter Android Flutter iOS Flut

serenader 1.4k Dec 30, 2022
A Flutter widget that paints an image and moves it at a slower speed than the main scrolling content.

A Flutter widget that paints an image and moves it at a slower speed than the main scrolling content. Installation Add dependency to your pubspec.yaml

Anatoly Pulyaevskiy 272 Dec 23, 2022
SVG parsing, rendering, and widget library for Flutter

flutter_svg Draw SVG (and some Android VectorDrawable (XML)) files on a Flutter Widget. Getting Started This is a Dart-native rendering library. Issue

Dan Field 1.5k Jan 6, 2023
Download, cache and show images in a flutter app

Cached network image A flutter library to show images from the internet and keep them in the cache directory. How to use The CachedNetworkImage can be

Baseflow 2.1k Jan 3, 2023
A simple and easy flutter demo to crop image

flutter_image_crop A simple demo to crop image on flutter easily. A Chinese version of this document can be found here Flutter_image_crop Plugin will

路小飞 3 Jul 8, 2021
A Flutter image editor with support for paint, text, filters, emojis, stickers and more

Flutter Image Editor Plugin with simple, easy support for image editing using Paints, Text, Filters, Emoji and Sticker like stories.

null 44 Dec 22, 2022
Multiavatar is a free and open-source multicultural avatar maker.

Flutter Wrapper for Multiavatar Multiavatar is a multicultural avatar maker. Multiavatar represents people from multiple races, multiple cultures, multiple age groups, multiple worldviews and walks of life.

Iheb Briki 69 Dec 19, 2022
Instagram tool to download images, reels, videos and more.

Instagram tool to download images, reels, videos and more.

Yuji 34 Jan 2, 2023
Load GIF images and can set framerate

Load GIF images and can set framerate

Rafael Almeida Barbosa 9 Dec 14, 2022
Draw triangle by setting 2 sides and an angle

Draw_Triangle Draw a triangle by setting 2 sides and an angle. Set an offset (-1<x<1,-1<y<1) from which side a and side b are drawn. Features Draw a t

Omer Stoler 1 Nov 16, 2021
A Dart port of zxing that encode and decode multiple 1D/2D barcodes.

ZXing-Dart A Dart port of zxing that encode and decode multiple 1D/2D barcodes. Progress Core package translate Core test translate Core unit test(all

shirne 35 Dec 14, 2022
A simple Flutter Package to Mimic iMessage Image Picker for Flutter

A simple Flutter Package to Mimic iMessage Image Picker for Flutter

Paras Jain 64 Dec 26, 2022
A Flutter package for manipulating bitmaps

Flutter Bitmap A minimalist Flutter package to perform fast bitmaps operations. The focus here is to provide a cool bitmap manipulation interface. The

Renan 152 Dec 23, 2022