39 lines
904 B
Dart
39 lines
904 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:shimmer/shimmer.dart';
|
|
|
|
class ShimmerLoading extends StatelessWidget {
|
|
final double width;
|
|
final double height;
|
|
final ShapeBorder shapeBorder;
|
|
|
|
const ShimmerLoading.rectangular({
|
|
super.key,
|
|
this.width = double.infinity,
|
|
required this.height,
|
|
}) : shapeBorder = const RoundedRectangleBorder();
|
|
|
|
const ShimmerLoading.circular({
|
|
super.key,
|
|
required this.width,
|
|
required this.height,
|
|
this.shapeBorder = const CircleBorder(),
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Shimmer.fromColors(
|
|
baseColor: Colors.grey[300]!,
|
|
highlightColor: Colors.grey[100]!,
|
|
loop: 0,
|
|
child: Container(
|
|
width: width,
|
|
height: height,
|
|
decoration: ShapeDecoration(
|
|
color: Colors.grey[400]!,
|
|
shape: shapeBorder,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|