import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import '../Provider/utils_singleton.dart'; import '../config/constants/app_constant.dart'; import '../utils/colors.dart'; class RatingScreen extends StatelessWidget { const RatingScreen({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( body: Container( decoration: const BoxDecoration( gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ Color(0xFF6B46C1), // Purple Color(0xFF9333EA), // Lighter purple ], ), ), child: Column( children: [ // Header Padding( padding: const EdgeInsets.all(16.0), child: Row( children: [ IconButton( onPressed: () => Navigator.pop(context), icon: const Icon( Icons.arrow_back, color: Colors.white, size: 24, ), ), const SizedBox(width: 8), const Text( 'Rating', style: TextStyle( color: Colors.white, fontSize: 20, fontWeight: FontWeight.w600, ), ), ], ), ), // Content Expanded( child: Container( margin: const EdgeInsets.only(top: 20), decoration: BoxDecoration( color:Theme.of(context).brightness == Brightness.dark?AppColors.blackBackgroundColor : AppColors.whiteBackgroundColor, borderRadius: const BorderRadius.only( topLeft: Radius.circular(24), topRight: Radius.circular(24), ), ), child: Column( children: [ // Rating Section Padding( padding: const EdgeInsets.symmetric(horizontal: 20), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ // Rating Info Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( utils.user?.driver!.rating ?.toStringAsFixed(1) ?? '0.0', style: const TextStyle( fontSize: 48, fontWeight: FontWeight.bold, //color: Color(0xFF1F2937), ), ), Text( '${utils.user?.driver!.totalRidesCompleted} Total User', style: const TextStyle( fontSize: 14, color: Color(0xFF6B7280), ), ), const SizedBox(height: 8), // Star Rating Row( children: List.generate(5, (index) { double rating = utils.user?.driver!.rating ?? 0.0; return Icon( index < rating.floor() ? Icons.star : (index < rating ? Icons.star_half : Icons.star_border), color: const Color(0xFFFF6B35), size: 24, ); }), ), ], ), // User Avatar Container( width: 110, height: 110, decoration: BoxDecoration( shape: BoxShape.circle, border: Border.all( color: const Color(0xFFFF6B35), width: 2, ), image: DecorationImage( image: NetworkImage( "$mediaUrl${utils.user?.image!.url}" ?? '', ), fit: BoxFit.cover, ), ), ), ], ), ), const SizedBox(height: 40), // Total Rides Circle Container( width: 200, height: 200, decoration: const BoxDecoration( shape: BoxShape.circle, gradient: LinearGradient( begin: Alignment.topLeft, end: Alignment.bottomRight, colors: [ Color(0xFF6B46C1), Color(0xFF9333EA), ], ), ), child: Container( margin: const EdgeInsets.all(12), decoration: const BoxDecoration( color: Colors.white, shape: BoxShape.circle, ), child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( '${utils.user?.driver!.totalRidesCanceled!}', style: const TextStyle( fontSize: 48, fontWeight: FontWeight.bold, color: Color(0xFF1F2937), ), ), const Text( 'Total Rate', style: TextStyle( fontSize: 16, color: Color(0xFF6B7280), fontWeight: FontWeight.w500, ), ), ], ), ), ), ), const Spacer(), // App Logo Padding( padding: const EdgeInsets.only(bottom: 40), child: Column( children: [ Container( decoration: const BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(8)), ), child: Center( child: SvgPicture.asset( "assets/images/logo.svg", color: AppColors.primaryColor, ), ), ), ], ), ), ], ), ), ), ], ), ), ); } }