shimmer_alternative 0.0.1 shimmer_alternative: ^0.0.1 copied to clipboard
A Flutter package to show shimmer effect while loading cards, containers, text, and text fields.
import 'package:flutter/material.dart';
import 'package:shimmer_alternative/shimmer_alternative.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Shimmer Alternative Example'),
),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
ShimmerAlternative(
duration: Duration(seconds: 2),
direction: ShimmerDirection.ttb,
child: Container(
width: double.infinity,
height: 150.0,
color: Colors.grey[300],
),
),
SizedBox(height: 20),
ShimmerAlternative(
duration: Duration(seconds: 3),
direction: ShimmerDirection.btt,
child: Text(
'Loading text...',
style: TextStyle(
fontSize: 24.0,
fontWeight: FontWeight.bold,
color: Colors.grey[300],
),
),
),
SizedBox(height: 20),
ShimmerAlternative(
duration: Duration(seconds: 1),
direction: ShimmerDirection.rtl,
child: TextField(
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: 'Loading...',
fillColor: Colors.grey[300],
filled: true,
),
),
),
],
),
),
),
);
}
}