Files
TubeCards/lib/widgets/image_placeholder.dart
friebetill 80f218097d Initial commit
Add Space version 2.0.1
2022-03-28 14:56:00 +02:00

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),
);
}
}