Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@
build/
example/ios/Flutter/Flutter.podspec
flutter_export_environment.sh
pubspec.lock
pubspec.lock
pubspec_overrides.yaml
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## 0.2.0

- **FEAT**: Add runtime animation replacement methods (`setAnimationFromURL`, `setAnimationFromAsset`, `setAnimationFromJson`) on `LottieController`
- **PERF**: Android: Enable async updates and simplify platform view for better performance
- **FIX**: Replace deprecated `Color.value` with `toARGB32()`
- **FIX**: Android: Move failure listener to init for all animation sources
- **FIX**: Validate dynamic value updates on iOS and Android to avoid crashes on malformed color or opacity inputs
- **FIX**: Android: Align `setAnimationProgress` and `setProgressWithFrame` behavior with iOS
- **BUILD**: Upgrade Kotlin to 2.1.0, AGP to 8.7.0, Java to 17
- **BUILD**: Upgrade lottie-android 6.3.0 → 6.7.1
- **BUILD**: Upgrade lottie-ios ~> 4.4.3 → ~> 4.6.0
- **BUILD**: Upgrade appcompat 1.6.1 → 1.7.1

## 0.1.4

- **FEAT**: Provide animation state changes as stream to lottie controller
Expand Down
73 changes: 73 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with
code in this repository.

## Project Overview

Flutter plugin that wraps native Lottie animation libraries (lottie-ios and
lottie-android) to render animations using platform-specific implementations.
Forked from flutter_lottie.

## Common Commands

```bash
# Install melos (if not installed)
dart pub global activate melos

# Bootstrap packages
melos bootstrap

# Run analysis
melos run analyze

# Check formatting (CI uses this)
melos run format:check:dart

# Format code
melos run format:dart
```

## Architecture

### Platform Channel Communication

The plugin uses Flutter's Method Channel and Event Channel pattern:

- **Method Channels** (`de.lotum/lottie_native_[id]`): Send commands to native
(play, pause, stop, etc.)
- **Event Channels** (`de.lotum/lottie_native_state_[id]`): Stream animation
state changes (loaded, started, finished, cancelled)

Each LottieView instance gets unique channels using its viewId.

### Key Components

**Dart (lib/src/):**

- `LottieView` - Widget with factory constructors: `fromURL`, `fromAsset`,
`fromJson`
- `LottieController` - Animation lifecycle management, exposes play/pause/stop
and state streams
- `LOTValue` - Type system for dynamic animation properties (LOTColorValue,
LOTOpacityValue)

**Android (android/src/main/kotlin/):**

- `LottieNativePlugin` - Plugin entry point
- `LottieView` - Wraps LottieAnimationView, handles MethodCall routing

**iOS (ios/Classes/):**

- `LottieNativePlugin` - Plugin entry point
- `LottieView` - Wraps LottieAnimationView, implements FlutterStreamHandler

### Native Dependencies

- Android: `com.airbnb.android:lottie`
- iOS: `lottie-ios`

## Monorepo Structure

Uses Melos to manage root plugin + example app. The example app in `example/`
contains sample animations and demonstrates the API.
16 changes: 8 additions & 8 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ group 'de.lotum.lottie_native'
version '1.0-SNAPSHOT'

buildscript {
ext.kotlin_version = '1.7.10'
ext.kotlin_version = '2.1.0'

repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:8.2.0'
classpath 'com.android.tools.build:gradle:8.7.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand All @@ -26,15 +26,15 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 33
compileSdk 34

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '17'
}

namespace 'de.lotum.lottie_native'
Expand All @@ -49,6 +49,6 @@ android {
}

dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.airbnb.android:lottie:6.3.0'
implementation 'androidx.appcompat:appcompat:1.7.1'
implementation 'com.airbnb.android:lottie:6.7.1'
}
Loading
Loading