Files
Regroup/lib/Utils/Common/ShimmerCommon.dart
2024-07-29 15:20:19 +05:30

67 lines
1.8 KiB
Dart

import 'package:flutter/material.dart';
import 'package:shimmer/shimmer.dart';
class ShimmerCommon extends StatelessWidget {
const ShimmerCommon({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xFF222935), body: _buildShimmerBody());
}
// Build shimmer effect for the body
Widget _buildShimmerBody() {
return ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.vertical,
itemCount: 4,
itemBuilder: (context, index) {
return SizedBox(
height: MediaQuery.of(context).size.height > 700 ? 220 : 270,
child: _buildShimmerInsightWidget(),
);
},
);
}
// Build shimmer UI for InsightWidget
Widget _buildShimmerInsightWidget() {
return Shimmer.fromColors(
baseColor: Colors.grey[500]!,
highlightColor: Colors.grey[300]!,
child: Container(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: double.infinity,
height: 20,
color: Colors.grey[500],
),
const SizedBox(height: 8),
Container(
width: double.infinity,
height: 20,
color: Colors.grey[500],
),
const SizedBox(height: 8),
Container(
width: double.infinity,
height: 20,
color: Colors.grey[500],
),
const SizedBox(height: 8),
Container(
width: double.infinity,
height: 20,
color: Colors.grey[500],
),
],
),
),
);
}
}