lottie_loader 0.0.1 copy "lottie_loader: ^0.0.1" to clipboard
lottie_loader: ^0.0.1 copied to clipboard

Flutter Pacakge that can allow you to use lottie animations as loader.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:lottie_loader/lottie_loader.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Lottie Loader Example',
      home: const HomeScreen(),
    );
  }
}

class HomeScreen extends StatefulWidget {
  const HomeScreen({super.key});

  @override
  State<HomeScreen> createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
  final LoaderController _controller = LoaderController();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Lottie Loader Example')),
      body: AnimatedBuilder(
        animation: _controller,
        builder: (context, _) {
          return Stack(
            children: [
              Center(
                child: ElevatedButton(
                  onPressed: () async {
                    _controller.showLoader();
                    await Future.delayed(const Duration(seconds: 3));
                    _controller.hideLoader();
                  },
                  child: const Text('Show Loader'),
                ),
              ),
              if (_controller.isVisible)
                const LottieLoaderOverlay(
                  overlayOpacity: 0.6,
                  child: LoaderWidget(
                    height: 300,
                    width: 300,
                    lottieAnimationPath: 'assets/Animation - 1734834675750.json',
                    isNetwork: false,
                  ),
                ),
            ],
          );
        },
      ),
    );
  }
}
2
likes
0
points
27
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter Pacakge that can allow you to use lottie animations as loader.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, lottie

More

Packages that depend on lottie_loader