Files
Regroup/lib/Utils/Common/ShimmerCommon.dart

155 lines
4.8 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.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.separated(
separatorBuilder: (context, index) {
return SizedBox(
height: 10.h,
);
},
shrinkWrap: true,
scrollDirection: Axis.vertical,
itemCount: 4,
itemBuilder: (context, index) {
return _buildShimmerInsightWidget();
},
);
}
// Build shimmer UI for InsightWidget
Widget _buildShimmerInsightWidget() {
return Shimmer.fromColors(
baseColor: Colors.white12,
highlightColor: Colors.white24,
child: Container(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
CircleAvatar(
radius: 25.r,
backgroundColor: Colors.grey[300],
),
SizedBox(width: 12.w),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 100.w,
height: 16.h,
color: Colors.grey[300],
),
SizedBox(height: 5.h),
Row(
children: [
Container(
width: 14.w,
height: 14.w,
color: Colors.grey[300],
),
SizedBox(width: 7.w),
Container(
width: 60.w,
height: 12.h,
color: Colors.grey[300],
),
SizedBox(width: 7.w),
Container(
width: 4.sp,
height: 4.sp,
color: Colors.grey[300],
),
SizedBox(width: 6.w),
Container(
width: 30.w,
height: 12.h,
color: Colors.grey[300],
),
],
)
],
),
Spacer(),
Container(
width: 16.w,
height: 18.h,
color: Colors.grey[300],
),
SizedBox(width: 5.w),
],
),
SizedBox(height: 20.h),
Container(
height: 360.h,
width: double.infinity,
color: Colors.grey[300],
),
SizedBox(height: 20.h),
Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
// Container(
// width: 30.w,
// height: 30.h,
// color: Colors.grey[300],
// ),
CircleAvatar(
radius: 20.r,
backgroundColor: Colors.grey[300],
),
SizedBox(width: 12.w),
Container(
width: 60.w,
height: 14.h,
color: Colors.grey[300],
),
SizedBox(width: 20.w),
CircleAvatar(
radius: 20.r,
backgroundColor: Colors.grey[300],
),
SizedBox(width: 12.w),
Container(
width: 60.w,
height: 14.h,
color: Colors.grey[300],
),
SizedBox(width: 12.w),
CircleAvatar(
radius: 20.r,
backgroundColor: Colors.grey[300],
),
],
),
SizedBox(height: 12.h),
Container(
height: 1.h,
width: double.infinity,
color: Colors.grey[300],
),
SizedBox(height: 12.h),
],
)
],
),
),
);
}
}