shimmer_ai 1.1.0 copy "shimmer_ai: ^1.1.0" to clipboard
shimmer_ai: ^1.1.0 copied to clipboard

A powerful Flutter package that provides zero-configuration shimmer loading placeholders. Easily add smooth, dynamic shimmer effects to any widget—Text, Container, ListTile, and more— with a simple on [...]

example/shimmer_ai_example.dart

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

void main() => runApp(const MyApp());

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: ShimmerDemoPage(),
    );
  }
}

/// A simple StatefulWidget that toggles
/// shimmer loading effect on/off.
class ShimmerDemoPage extends StatefulWidget {
  const ShimmerDemoPage({super.key});

  @override
  State<ShimmerDemoPage> createState() => _ShimmerDemoPageState();
}

class _ShimmerDemoPageState extends State<ShimmerDemoPage> {
  // Controls whether the shimmer is shown or the real content
  bool isLoading = true;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('shimmer_ai demo'),
      ),
      body: Padding(
        padding: const EdgeInsets.all(20),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            // Example 1: Text widget with shimmer effect
            Text(
              'Hello Shimmer!',
              style: const TextStyle(fontSize: 28, fontWeight: FontWeight.bold),
            ).withShimmerAi(loading: isLoading),

            const SizedBox(height: 30),

            // Example 2: CircleAvatar with shimmer
            CircleAvatar(
              radius: 40,
              backgroundImage: NetworkImage(
                'https://avatars.githubusercontent.com/u/14101776?v=4',
              ),
            ).withShimmerAi(loading: isLoading),

            const SizedBox(height: 30),

            // Example 3: Colored Container with shimmer
            Container(
              width: 200,
              height: 40,
              decoration: BoxDecoration(
                color: Colors.blueAccent,
                borderRadius: BorderRadius.circular(12),
              ),
              alignment: Alignment.center,
              child: Text(
                'Button',
                style: const TextStyle(color: Colors.white, fontSize: 20),
              ),
            ).withShimmerAi(loading: isLoading),

            const SizedBox(height: 50),

            // Toggle button to switch loading state
            ElevatedButton(
              onPressed: () {
                setState(() {
                  isLoading = !isLoading;
                });
              },
              child: Text(isLoading ? 'Show Content' : 'Show Shimmer'),
            ),
          ],
        ),
      ),
    );
  }
}
24
likes
0
points
59
downloads

Publisher

unverified uploader

Weekly Downloads

A powerful Flutter package that provides zero-configuration shimmer loading placeholders. Easily add smooth, dynamic shimmer effects to any widget—Text, Container, ListTile, and more— with a simple one-line extension method `.withShimmerAi()`. Perfect for creating skeleton loaders, loading states, and polished user experiences.

Repository (GitHub)
View/report issues

Topics

#flutter #shimmer #skeleton-loader #loading-animation #flutter-ui

License

unknown (license)

Dependencies

flutter, shimmer

More

Packages that depend on shimmer_ai