advanced_shimmer 1.0.2
advanced_shimmer: ^1.0.2 copied to clipboard
A customizable Flutter shimmer loading package with multiple shimmer animation styles and ready-made shimmer widgets.
import 'package:advanced_shimmer/advanced_shimmer.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
/// Example app for Advanced Shimmer package.
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Advanced Shimmer Demo',
home: Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
backgroundColor: Colors.white,
title: const Text('Advanced Shimmer'),
),
body: LayoutBuilder(
builder: (context, constraints) {
final isTablet = constraints.maxWidth > 600;
return SingleChildScrollView(
padding: EdgeInsets.symmetric(
horizontal: isTablet ? 32 : 16,
vertical: 16,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_sectionTitle('Basic Shimmer'),
const AdvancedShimmer(
width: double.infinity,
height: 80,
),
const SizedBox(height: 32),
_sectionTitle('Shimmer Card'),
const ShimmerCard(),
const SizedBox(height: 32),
_sectionTitle('Shimmer Text'),
const ShimmerText(width: 220),
const SizedBox(height: 8),
const ShimmerText(width: 180),
const SizedBox(height: 32),
_sectionTitle('Shimmer Avatar'),
const Center(
child: ShimmerAvatar(size: 80),
),
const SizedBox(height: 32),
_sectionTitle('Shimmer List Tile'),
const ShimmerListTile(),
const SizedBox(height: 12),
const ShimmerListTile(),
const SizedBox(height: 32),
_sectionTitle('Shimmer Button'),
const Center(
child: ShimmerButton(),
),
const SizedBox(height: 32),
_sectionTitle('Shimmer Paragraph'),
const ShimmerParagraph(),
const SizedBox(height: 32),
_sectionTitle('Shimmer Container'),
Center(
child: ShimmerContainer(
width: isTablet ? 500 : double.infinity,
height: 120,
),
),
const SizedBox(height: 32),
_sectionTitle('Shimmer Grid'),
SizedBox(
height: isTablet ? 500 : 450,
child: ShimmerGrid(
crossAxisCount: isTablet ? 3 : 2,
),
),
const SizedBox(height: 40),
],
),
);
},
),
),
);
}
Widget _sectionTitle(String title) {
return Padding(
padding: const EdgeInsets.only(bottom: 12),
child: Text(
title,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w700,
),
),
);
}
}