Rumahjo-Android-APP/lib/Ui/screens/chat/chatAudio/widgets/lottie_animation.dart

45 lines
1.0 KiB
Dart
Raw Permalink Normal View History

2024-09-07 00:58:50 +00:00
import 'package:flutter/material.dart';
import 'package:lottie/lottie.dart';
class LottieAnimation extends StatefulWidget {
const LottieAnimation({Key? key}) : super(key: key);
@override
State<LottieAnimation> createState() => _LottieAnimationState();
}
class _LottieAnimationState extends State<LottieAnimation>
with SingleTickerProviderStateMixin {
late AnimationController controller;
@override
void initState() {
super.initState();
controller = AnimationController(vsync: this);
}
@override
void dispose() {
controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Container(
child: Lottie.asset(
'assets/animation/dustbin_grey.json',
controller: controller,
onLoaded: (composition) {
controller
..duration = composition.duration
..forward();
debugPrint("Lottie Duration: ${composition.duration}");
},
height: 40,
width: 40,
),
);
}
}