mirror of
https://github.com/friebetill/TubeCards.git
synced 2025-08-14 09:54:12 +08:00
32 lines
910 B
Dart
32 lines
910 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:shimmer/shimmer.dart';
|
|
|
|
import '../utils/themes/custom_theme.dart';
|
|
|
|
class ImagePlaceholder extends StatelessWidget {
|
|
const ImagePlaceholder({
|
|
this.duration = const Duration(milliseconds: 1200),
|
|
Key? key,
|
|
}) : super(key: key);
|
|
|
|
/// Duration of the shimmer animation.
|
|
final Duration duration;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final baseColor = Theme.of(context).brightness == Brightness.light
|
|
? Colors.grey.shade300
|
|
: Theme.of(context).custom.elevation4DPColor;
|
|
final highlightColor = Theme.of(context).brightness == Brightness.light
|
|
? Colors.grey.shade200
|
|
: Theme.of(context).custom.elevation8DPColor;
|
|
|
|
return Shimmer.fromColors(
|
|
baseColor: baseColor,
|
|
highlightColor: highlightColor,
|
|
period: duration,
|
|
child: Container(color: baseColor),
|
|
);
|
|
}
|
|
}
|