Files
umbrix/lib/core/widget/shimmer_skeleton.dart

41 lines
968 B
Dart
Raw Normal View History

2024-02-11 00:29:09 +03:30
import 'package:flutter/material.dart';
import 'package:flutter_animate/flutter_animate.dart';
import 'package:umbrix/core/widget/skeleton_widget.dart';
2024-02-11 00:29:09 +03:30
class ShimmerSkeleton extends StatelessWidget {
const ShimmerSkeleton({
this.width,
this.height,
this.widthFactor,
this.heightFactor,
this.color,
this.duration = const Duration(seconds: 1),
super.key,
});
final double? width;
final double? height;
final double? widthFactor;
final double? heightFactor;
final Color? color;
final Duration duration;
@override
Widget build(BuildContext context) {
return Skeleton(
width: width,
height: height,
widthFactor: widthFactor,
heightFactor: heightFactor,
)
.animate(
onPlay: (controller) => controller.loop(),
)
.shimmer(
duration: duration,
angle: 45,
color: color ?? Theme.of(context).colorScheme.secondary,
);
}
}