first commit
This commit is contained in:
219
siro_rider/lib/views/Rate/rate_captain.dart
Normal file
219
siro_rider/lib/views/Rate/rate_captain.dart
Normal file
@@ -0,0 +1,219 @@
|
||||
import 'package:siro_rider/controller/home/map/ride_lifecycle_controller.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../constant/colors.dart';
|
||||
import '../../constant/style.dart';
|
||||
import '../../controller/firebase/firbase_messge.dart';
|
||||
import '../../controller/payment/payment_controller.dart';
|
||||
import '../../controller/rate/rate_conroller.dart';
|
||||
import '../widgets/elevated_btn.dart';
|
||||
import '../widgets/my_scafold.dart';
|
||||
|
||||
class RateDriverFromPassenger extends StatelessWidget {
|
||||
RateDriverFromPassenger({super.key});
|
||||
final RateController controller = Get.put(RateController());
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MyScafolld(
|
||||
title: 'Rate Driver'.tr,
|
||||
body: [
|
||||
Positioned(
|
||||
top: 10,
|
||||
left: Get.width * .1,
|
||||
right: Get.width * .1,
|
||||
child: Container(
|
||||
// height: Get.height * 6,
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Container(
|
||||
height: Get.height * .5,
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text(
|
||||
'${'Total price to '.tr}${Get.find<RideLifecycleController>().driverName}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
width: 2,
|
||||
color: AppColor.redColor,
|
||||
)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Text(
|
||||
(double.parse(controller.price
|
||||
.toString()) *
|
||||
.12 +
|
||||
double.parse(controller.price
|
||||
.toString()))
|
||||
.toStringAsFixed(2),
|
||||
style: AppStyle.number.copyWith(
|
||||
color: AppColor.redColor,
|
||||
textBaseline:
|
||||
TextBaseline.ideographic,
|
||||
decoration:
|
||||
TextDecoration.lineThrough,
|
||||
decorationColor:
|
||||
AppColor.redColor),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
width: 2,
|
||||
color: AppColor.greenColor,
|
||||
)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Text(
|
||||
controller.price.toString(),
|
||||
style: AppStyle.number,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
child: Text(
|
||||
'Exclusive offers and discounts always with the Intaleq app'
|
||||
.tr,
|
||||
style: AppStyle.title.copyWith(
|
||||
color: AppColor.redColor,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
(Get.find<PaymentController>()
|
||||
.isWalletChecked ==
|
||||
true)
|
||||
? const DriverTipWidget()
|
||||
: const SizedBox(),
|
||||
],
|
||||
),
|
||||
)),
|
||||
),
|
||||
Center(
|
||||
child: RatingBar.builder(
|
||||
initialRating: 0,
|
||||
itemCount: 5,
|
||||
itemSize: 50,
|
||||
itemPadding: const EdgeInsets.symmetric(horizontal: 2),
|
||||
itemBuilder: (context, index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return const Icon(
|
||||
Icons.sentiment_very_dissatisfied,
|
||||
color: Colors.red,
|
||||
);
|
||||
case 1:
|
||||
return const Icon(
|
||||
Icons.sentiment_dissatisfied,
|
||||
color: Colors.redAccent,
|
||||
);
|
||||
case 2:
|
||||
return const Icon(
|
||||
Icons.sentiment_neutral,
|
||||
color: Colors.amber,
|
||||
);
|
||||
case 3:
|
||||
return const Icon(
|
||||
Icons.sentiment_satisfied,
|
||||
color: Colors.lightGreen,
|
||||
);
|
||||
case 4:
|
||||
return const Icon(
|
||||
Icons.sentiment_very_satisfied,
|
||||
color: Colors.green,
|
||||
);
|
||||
default:
|
||||
return const Icon(
|
||||
Icons.sentiment_neutral,
|
||||
color: Colors.amber,
|
||||
);
|
||||
} //
|
||||
},
|
||||
onRatingUpdate: (rating) {
|
||||
controller.selectRateItem(rating);
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * .75,
|
||||
child: TextFormField(
|
||||
maxLines: 4,
|
||||
minLines: 1,
|
||||
keyboardType: TextInputType.multiline,
|
||||
controller: controller.comment,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Enter your Note'.tr,
|
||||
hintText: 'Type something...'.tr,
|
||||
prefixIcon: Icon(
|
||||
Icons.rate_review, color: AppColor.grayColor), // Add an icon as a prefix
|
||||
suffixIcon: IconButton(
|
||||
icon: const Icon(
|
||||
Icons.clear,
|
||||
color: AppColor.redColor,
|
||||
), // Add an icon as a suffix
|
||||
onPressed: () {
|
||||
controller.comment.clear();
|
||||
},
|
||||
),
|
||||
border:
|
||||
const OutlineInputBorder(), // Add a border around the input field
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color:
|
||||
AppColor.grayColor.withValues(alpha: 0.5)), // Customize the border color
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: AppColor
|
||||
.greenColor), // Customize the border color when focused
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: AppColor
|
||||
.redColor), // Customize the border color when there's an error
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
MyElevatedButton(
|
||||
title: 'Submit rating'.tr,
|
||||
onPressed: () => controller.addRateToDriver())
|
||||
],
|
||||
),
|
||||
)),
|
||||
],
|
||||
isleading: false);
|
||||
}
|
||||
}
|
||||
166
siro_rider/lib/views/Rate/rating_driver_bottom.dart
Normal file
166
siro_rider/lib/views/Rate/rating_driver_bottom.dart
Normal file
@@ -0,0 +1,166 @@
|
||||
import 'package:siro_rider/views/home/map_page_passenger.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../constant/colors.dart';
|
||||
import '../../constant/links.dart';
|
||||
import '../../constant/style.dart';
|
||||
import '../../controller/home/map_passenger_controller.dart';
|
||||
import '../../controller/rate/rate_conroller.dart';
|
||||
import '../widgets/elevated_btn.dart';
|
||||
import '../widgets/my_scafold.dart';
|
||||
|
||||
// ملاحظة: تم حذف جميع الأكواد المتعلقة بالسعر والإكرامية كما طُلِب.
|
||||
// التركيز الآن على التقييم والملاحظات فقط.
|
||||
|
||||
class RatingDriverBottomSheet extends StatelessWidget {
|
||||
RatingDriverBottomSheet({super.key});
|
||||
final RateController controller = Get.put(RateController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// تم تبسيط استخدام MyScafolld لإزالة الـ Positioned واستخدام تصميم مركزي ونظيف.
|
||||
return MyScafolld(
|
||||
title: 'Rate Driver'.tr,
|
||||
body: [
|
||||
Center(
|
||||
child: Container(
|
||||
width: Get.width * .85,
|
||||
padding: const EdgeInsets.all(24),
|
||||
// يفترض أن AppStyle.boxDecoration1 يوفر تصميمًا جميلاً مع حواف مدورة وظل.
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
// 1. قسم معلومات السائق والترحيب
|
||||
CircleAvatar(
|
||||
radius: 30,
|
||||
backgroundImage: NetworkImage(
|
||||
'${AppLink.server}/portrate_captain_image/${controller.driverId}.jpg'),
|
||||
onBackgroundImageError: (exception, stackTrace) => Icon(
|
||||
Icons.person,
|
||||
size: 30,
|
||||
color: AppColor.cyanBlue),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// رسالة ترحيب مركزة على تجربة الرحلة
|
||||
Text(
|
||||
'${'How was your trip with'.tr} ${controller.driverName}?',
|
||||
style: AppStyle.title
|
||||
.copyWith(fontSize: 20, fontWeight: FontWeight.bold),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// نص إرشادي يؤكد على أهمية التقييم لتحسين الجودة
|
||||
Text(
|
||||
'Your valuable feedback helps us improve our service quality.'
|
||||
.tr,
|
||||
style: AppStyle.title
|
||||
.copyWith(color: AppColor.grayColor, fontSize: 14),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
|
||||
const SizedBox(height: 32),
|
||||
|
||||
// 2. شريط التقييم (النجمي)
|
||||
Center(
|
||||
child: RatingBar.builder(
|
||||
initialRating: 0,
|
||||
itemCount: 5,
|
||||
itemSize: 50, // حجم كبير لجعله النقطة البؤرية
|
||||
glow: true,
|
||||
glowColor: Colors.amber.shade200,
|
||||
itemPadding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
itemBuilder: (context, index) {
|
||||
// استخدام أيقونات المشاعر مع أيقونة النجمة للحصول على مظهر أكثر جاذبية
|
||||
switch (index) {
|
||||
case 0:
|
||||
return const Icon(Icons.sentiment_very_dissatisfied,
|
||||
color: Colors.red);
|
||||
case 1:
|
||||
return const Icon(Icons.sentiment_dissatisfied,
|
||||
color: Colors.redAccent);
|
||||
case 2:
|
||||
return const Icon(Icons.sentiment_neutral,
|
||||
color: Colors.amber);
|
||||
case 3:
|
||||
return const Icon(Icons.sentiment_satisfied,
|
||||
color: Colors.lightGreen);
|
||||
case 4:
|
||||
return const Icon(Icons.sentiment_very_satisfied,
|
||||
color: Colors.green);
|
||||
default:
|
||||
return const Icon(Icons.star_rounded,
|
||||
color: Colors.amber);
|
||||
}
|
||||
},
|
||||
onRatingUpdate: (rating) {
|
||||
controller.selectRateItem(rating);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 32),
|
||||
|
||||
// 3. قسم التعليقات (الملاحظات)
|
||||
SizedBox(
|
||||
width: Get.width * .75,
|
||||
child: TextFormField(
|
||||
maxLines: 4,
|
||||
minLines: 1,
|
||||
keyboardType: TextInputType.multiline,
|
||||
controller: controller.comment,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Leave a detailed comment (Optional)'.tr,
|
||||
hintText:
|
||||
'Share your experience to help us improve...'.tr,
|
||||
prefixIcon:
|
||||
Icon(Icons.rate_review, color: AppColor.grayColor),
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(Icons.clear, color: AppColor.redColor),
|
||||
onPressed: () {
|
||||
controller.comment.clear();
|
||||
},
|
||||
),
|
||||
// تحسين شكل الحدود لتكون أكثر جمالية
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12)),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide:
|
||||
BorderSide(color: AppColor.grayColor.withOpacity(0.5), width: 1),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(
|
||||
color: AppColor.greenColor,
|
||||
width: 2), // لون جذاب عند التركيز
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 32),
|
||||
|
||||
// 4. زر الإرسال
|
||||
MyElevatedButton(
|
||||
title: 'Submit Rating'.tr,
|
||||
onPressed: () async {
|
||||
await controller.addRateToDriver();
|
||||
Get.offAll(() => MapPagePassenger());
|
||||
// Get.find<MapPassengerController>()
|
||||
// .getRideStatusFromStartApp();
|
||||
})
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
isleading: false,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user