5/29/5
This commit is contained in:
@@ -3,7 +3,6 @@ import 'package:SEFER/constant/links.dart';
|
||||
import 'package:SEFER/constant/style.dart';
|
||||
import 'package:SEFER/controller/home/captin/home_captain_controller.dart';
|
||||
import 'package:SEFER/views/notification/available_rides_page.dart';
|
||||
import 'package:SEFER/views/widgets/mycircular.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -25,198 +24,182 @@ class DrawerCaptain extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
String writeText(int times) {
|
||||
return '*' * times;
|
||||
}
|
||||
|
||||
return Drawer(
|
||||
child: ListView(
|
||||
padding: EdgeInsets.zero,
|
||||
children: [
|
||||
// Other drawer items
|
||||
UserAccountsDrawerHeader(
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColor.greenColor,
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
AppColor.primaryColor,
|
||||
AppColor.secondaryColor,
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
),
|
||||
currentAccountPictureSize: const Size.square(100),
|
||||
arrowColor: AppColor.deepPurpleAccent,
|
||||
accountName: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
box.read(BoxName.nameDriver).toString(),
|
||||
style: AppStyle.title,
|
||||
),
|
||||
const Spacer(),
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
Get.find<HomeCaptainController>().rating.toString(),
|
||||
style: AppStyle.number.copyWith(color: Colors.amber),
|
||||
),
|
||||
Container(
|
||||
// width: Get.width * .4,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 4, vertical: 1),
|
||||
color: AppColor.greenColor,
|
||||
child: RatingBar.builder(
|
||||
initialRating: 5,
|
||||
minRating: 1,
|
||||
direction: Axis.horizontal,
|
||||
itemCount: 5,
|
||||
itemSize: 20,
|
||||
itemPadding:
|
||||
const EdgeInsets.symmetric(horizontal: 2),
|
||||
itemBuilder: (context, _) => const Icon(
|
||||
Icons.star,
|
||||
color: Colors.amber,
|
||||
),
|
||||
onRatingUpdate: (rating) {}),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
accountEmail: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: Text(
|
||||
box.read(BoxName.emailDriver),
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
currentAccountPicture: Stack(
|
||||
children: [
|
||||
GetBuilder<ImageController>(builder: (imageController) {
|
||||
return imageController.isloading
|
||||
? const MyCircularProgressIndicator()
|
||||
: CircleAvatar(
|
||||
radius: 45,
|
||||
backgroundImage: NetworkImage(
|
||||
'${AK.serverPHP}/portrate_captain_image/${box.read(BoxName.driverID)}.jpg'),
|
||||
);
|
||||
}),
|
||||
Positioned(
|
||||
right: 0,
|
||||
top: 0,
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
imageController.choosImage(
|
||||
AppLink.uploadImage1, 'portrait');
|
||||
},
|
||||
icon: const Icon(Icons.edit),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const UserAccountHeader(),
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: Icons.account_balance_wallet,
|
||||
text: 'Wallet'.tr,
|
||||
onTap: () =>
|
||||
Get.to(() => WalletCaptain(), transition: Transition.native),
|
||||
),
|
||||
|
||||
ListTile(
|
||||
leading: const Icon(Icons.account_balance_wallet),
|
||||
title: Text(
|
||||
'Wallet'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
onTap: () {
|
||||
// Handle wallet item tap
|
||||
Get.to(() => WalletCaptain(), transition: Transition.native);
|
||||
},
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: Icons.person,
|
||||
text: 'Profile'.tr,
|
||||
onTap: () => Get.to(() => const ProfileCaptain(),
|
||||
transition: Transition.rightToLeftWithFade),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.person),
|
||||
title: Text(
|
||||
'Profile'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
onTap: () {
|
||||
// Handle profile item tap
|
||||
Get.to(() => const ProfileCaptain(),
|
||||
transition: Transition.rightToLeftWithFade);
|
||||
},
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: Icons.history,
|
||||
text: 'History of Trip'.tr,
|
||||
onTap: () => Get.to(() => const HistoryCaptain(),
|
||||
transition: Transition.downToUp),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(
|
||||
Icons.history,
|
||||
),
|
||||
title: Text(
|
||||
'History of Trip'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
onTap: () {
|
||||
Get.to(() => const HistoryCaptain(),
|
||||
transition: Transition.downToUp);
|
||||
// Handle history of trip item tap
|
||||
},
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: Icons.phonelink_ring_rounded,
|
||||
text: 'Available for rides'.tr,
|
||||
onTap: () => Get.to(() => const AvailableRidesPage(),
|
||||
transition: Transition.rightToLeftWithFade),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.phonelink_ring_rounded),
|
||||
title: Text(
|
||||
'Available for rides'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
onTap: () {
|
||||
Get.to(() => const AvailableRidesPage(),
|
||||
transition: Transition.rightToLeftWithFade);
|
||||
// Handle history of trip item tap
|
||||
},
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: Icons.notifications,
|
||||
text: 'Notifications'.tr,
|
||||
onTap: () => Get.to(() => const NotificationCaptain(),
|
||||
transition: Transition.upToDown),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.notifications),
|
||||
title: Text(
|
||||
'Notifications'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
onTap: () {
|
||||
// Handle notifications item tap
|
||||
Get.to(() => const NotificationCaptain(),
|
||||
transition: Transition.upToDown);
|
||||
},
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: Icons.help,
|
||||
text: 'Helping Center'.tr,
|
||||
onTap: () =>
|
||||
Get.to(() => HelpCaptain(), transition: Transition.size),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.help),
|
||||
title: Text(
|
||||
'Helping Center'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
onTap: () {
|
||||
// Handle helping center item tap
|
||||
Get.to(() => HelpCaptain(), transition: Transition.size);
|
||||
},
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: Icons.settings,
|
||||
text: 'Settings'.tr,
|
||||
onTap: () => Get.to(() => const SettingsCaptain(),
|
||||
transition: Transition.cupertino),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.settings),
|
||||
title: Text(
|
||||
'Settings'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
onTap: () {
|
||||
// Handle settings item tap
|
||||
Get.to(() => const SettingsCaptain(),
|
||||
transition: Transition.cupertino);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.exit_to_app),
|
||||
title: Text(
|
||||
'Sign Out'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
onTap: () {
|
||||
// Handle sign out item tap
|
||||
Get.to(() => const LogoutCaptain(),
|
||||
transition: Transition.cupertinoDialog);
|
||||
},
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: Icons.exit_to_app,
|
||||
text: 'Sign Out'.tr,
|
||||
onTap: () => Get.to(() => const LogoutCaptain(),
|
||||
transition: Transition.cupertinoDialog),
|
||||
),
|
||||
_buildDivider(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDivider() {
|
||||
return const Divider(
|
||||
thickness: 1,
|
||||
height: 1,
|
||||
color: AppColor.accentColor,
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDrawerItem({
|
||||
required IconData icon,
|
||||
required String text,
|
||||
required GestureTapCallback onTap,
|
||||
}) {
|
||||
return ListTile(
|
||||
leading: Icon(icon, color: AppColor.accentColor),
|
||||
title: Text(text, style: AppStyle.title),
|
||||
onTap: onTap,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class UserAccountHeader extends StatelessWidget {
|
||||
const UserAccountHeader({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return UserAccountsDrawerHeader(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.greenColor,
|
||||
gradient: LinearGradient(
|
||||
colors: AppColor.gradientStartEnd,
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
),
|
||||
currentAccountPictureSize: const Size.square(100),
|
||||
arrowColor: AppColor.deepPurpleAccent,
|
||||
accountName: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
box.read(BoxName.nameDriver).toString(),
|
||||
style: AppStyle.title.copyWith(color: AppColor.backgroundColor),
|
||||
),
|
||||
const Spacer(),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
Get.find<HomeCaptainController>().rating.toString(),
|
||||
style: AppStyle.number.copyWith(color: Colors.amber),
|
||||
),
|
||||
Container(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 4, vertical: 1),
|
||||
color: AppColor.greenColor,
|
||||
child: RatingBar.builder(
|
||||
initialRating: double.parse(
|
||||
Get.find<HomeCaptainController>().rating.toString()),
|
||||
minRating: 1,
|
||||
direction: Axis.horizontal,
|
||||
itemCount: 5,
|
||||
itemSize: 20,
|
||||
itemPadding: const EdgeInsets.symmetric(horizontal: 2),
|
||||
itemBuilder: (context, _) => const Icon(
|
||||
Icons.star,
|
||||
color: Colors.amber,
|
||||
),
|
||||
onRatingUpdate: (rating) {},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
accountEmail: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: Text(
|
||||
box.read(BoxName.emailDriver),
|
||||
style: AppStyle.title.copyWith(color: AppColor.backgroundColor),
|
||||
),
|
||||
),
|
||||
currentAccountPicture:
|
||||
GetBuilder<ImageController>(builder: (imageController) {
|
||||
return Stack(
|
||||
children: [
|
||||
imageController.isloading
|
||||
? const CircularProgressIndicator()
|
||||
: CircleAvatar(
|
||||
radius: 45,
|
||||
backgroundImage: NetworkImage(
|
||||
'${AK.serverPHP}/portrate_captain_image/${box.read(BoxName.driverID)}.jpg',
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
right: 0,
|
||||
top: 0,
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
imageController.choosImage(AppLink.uploadImage1, 'portrait');
|
||||
},
|
||||
icon: const Icon(Icons.edit),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,59 +120,56 @@ GetBuilder<MapDriverController> driverEndRideBar() {
|
||||
],
|
||||
)
|
||||
: const SizedBox(),
|
||||
(mapDriverController.carType == 'Mashwari' ||
|
||||
mapDriverController.carType == 'Comfort') &&
|
||||
mapDriverController.remainingTimeTimerRideBegin > 60
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
MyElevatedButton(
|
||||
title: 'End Ride'.tr,
|
||||
onPressed: () {
|
||||
mapDriverController.finishRideFromDriver();
|
||||
},
|
||||
kolor: AppColor.redColor,
|
||||
),
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
print(Get.find<HomeCaptainController>()
|
||||
.comfortPrice);
|
||||
},
|
||||
child: Text(
|
||||
mapDriverController.carType,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
mapDriverController.remainingTimeTimerRideBegin <
|
||||
60
|
||||
? MyElevatedButton(
|
||||
title: 'End Ride'.tr,
|
||||
onPressed: () {
|
||||
mapDriverController
|
||||
.finishRideFromDriver();
|
||||
},
|
||||
kolor: AppColor.redColor,
|
||||
)
|
||||
: const SizedBox(),
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Text(
|
||||
mapDriverController.carType,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
)
|
||||
],
|
||||
// (mapDriverController.carType == 'Mashwari' ||
|
||||
// mapDriverController.carType == 'Comfort' ||
|
||||
// mapDriverController.carType == 'lady') &&
|
||||
// mapDriverController.remainingTimeTimerRideBegin > 60
|
||||
// ? Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
// children: [
|
||||
// MyElevatedButton(
|
||||
// title: 'End Ride'.tr,
|
||||
// onPressed: () {
|
||||
// mapDriverController.finishRideFromDriver();
|
||||
// },
|
||||
// kolor: AppColor.redColor,
|
||||
// ),
|
||||
// Container(
|
||||
// decoration: AppStyle.boxDecoration1,
|
||||
// child: Text(
|
||||
// mapDriverController.carType,
|
||||
// style: AppStyle.title,
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// )
|
||||
// :
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
// mapDriverController.remainingTimeTimerRideBegin <
|
||||
// 60
|
||||
// ?
|
||||
MyElevatedButton(
|
||||
title: 'End Ride'.tr,
|
||||
onPressed: () {
|
||||
mapDriverController.finishRideFromDriver();
|
||||
},
|
||||
kolor: AppColor.redColor,
|
||||
),
|
||||
// : const SizedBox(),
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Text(
|
||||
mapDriverController.carType,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
mapDriverController.carType != 'Comfort' &&
|
||||
mapDriverController.carType != 'Mashwari'
|
||||
mapDriverController.carType != 'Mashwari' &&
|
||||
mapDriverController.carType != 'Lady'
|
||||
? Stack(
|
||||
children: [
|
||||
SizedBox(
|
||||
|
||||
Reference in New Issue
Block a user