Houshan-Basa/lib/ui/widgets/sections/loading/default_placeholder.dart

37 lines
1.0 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:hoshan/ui/theme/colors.dart';
import 'package:hoshan/ui/theme/cubit/theme_mode_cubit.dart';
import 'package:shimmer/shimmer.dart';
class DefaultPlaceHolder extends StatelessWidget {
final Widget child;
final bool enabled;
final double? width;
final double? height;
const DefaultPlaceHolder(
{super.key,
required this.child,
this.enabled = true,
this.width,
this.height});
@override
Widget build(BuildContext context) {
final isDark = context.read<ThemeModeCubit>().state == ThemeMode.dark;
return enabled
? IgnorePointer(
ignoring: true,
child: SizedBox(
width: width,
height: height,
child: Shimmer.fromColors(
baseColor: AppColors.gray[isDark ? 800 : 400],
highlightColor: AppColors.gray[isDark ? 900 : 600],
child: child),
),
)
: child;
}
}