import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:shimmer/shimmer.dart'; class RideCardShimmer extends StatelessWidget { const RideCardShimmer({Key? key}) : super(key: key); @override Widget build(BuildContext context) { // Base and highlight colors for the shimmer effect final baseColor = Colors.grey[300]!; final highlightColor = Colors.grey[100]!; // Helper to create a shimmering placeholder box Widget placeholderBox({double? width, double height = 16, double radius = 4}) { return Container( width: width, height: height, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(radius), ), ); } return Shimmer.fromColors( baseColor: baseColor, highlightColor: highlightColor, child: Container( margin: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0), padding: EdgeInsets.symmetric(horizontal: 31.sp, vertical: 18.sp), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(20.0), ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ // Rider Info Padding( padding: EdgeInsets.only(top: 8.sp, bottom: 8.sp), child: Row( children: [ placeholderBox(width: 40.sp, height: 40.sp, radius: 20.sp), SizedBox(width: 12.sp), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ placeholderBox(height: 20, width: 120), SizedBox(height: 8.sp), placeholderBox(height: 14, width: 60), ], ), ), placeholderBox(height: 20, width: 80), ], ), ), SizedBox(height: 9.sp), // Location Details placeholderBox(height: 56.sp, width: double.infinity, radius: 8), SizedBox(height: 1.sp), placeholderBox(height: 56.sp, width: double.infinity, radius: 8), SizedBox(height: 17.sp), // Distance placeholderBox(height: 20, width: 100), SizedBox(height: 16.sp), // Buttons Row( children: [ Expanded(child: placeholderBox(height: 48, radius: 25)), SizedBox(width: 16.sp), Expanded(child: placeholderBox(height: 48, radius: 25)), ], ), ], ), ), ); } }