β Custom Loading
The progress indicator that comes with Flutter, by default is okay in most places, but not in every place.
Last updated
class PopularProducts extends StatelessWidget {
const PopularProducts({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Column(
....
// While loading use π
// const ProductsSkelton(),
SizedBox(
height: 220,
child: ListView.builder(
....
),
)
],
);
}
}
class ProductCardSkelton extends StatelessWidget {
const ProductCardSkelton({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return SizedBox(
height: 220,
width: 140,
child: Padding(
padding: const EdgeInsets.all(defaultPadding / 2),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
AspectRatio(
aspectRatio: 1.15,
child: Skeleton(),
),
Spacer(flex: 2),
Skeleton(height: 12, width: 64),
Spacer(flex: 2),
Skeleton(),
Spacer(),
Skeleton(),
Spacer(flex: 2),
Skeleton(height: 12, width: 80),
Spacer(),
],
),
),
);
}
}