9/20/1
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import 'package:SEFER/constant/api_key.dart';
|
||||
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/auth/captin/contact_us_page.dart';
|
||||
import 'package:SEFER/views/auth/captin/invite_driver_screen.dart';
|
||||
@@ -9,7 +8,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/constant/colors.dart';
|
||||
import 'package:SEFER/main.dart';
|
||||
import 'package:SEFER/views/auth/captin/logout_captain.dart';
|
||||
import 'package:SEFER/views/home/Captin/history/history_captain.dart';
|
||||
@@ -19,98 +17,97 @@ import 'package:SEFER/views/home/my_wallet/walet_captain.dart';
|
||||
import 'package:SEFER/views/home/profile/profile_captain.dart';
|
||||
import 'package:SEFER/views/notification/notification_captain.dart';
|
||||
|
||||
import '../../../../constant/colors.dart';
|
||||
import '../../../../controller/functions/upload_image.dart';
|
||||
import '../maintain_center_page.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class DrawerCaptain extends StatelessWidget {
|
||||
ImageController imageController = Get.put(ImageController());
|
||||
class CupertinoDrawerCaptain extends StatelessWidget {
|
||||
final ImageController imageController = Get.put(ImageController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Drawer(
|
||||
child: ListView(
|
||||
padding: EdgeInsets.zero,
|
||||
children: [
|
||||
const UserAccountHeader(),
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: Icons.account_balance_wallet,
|
||||
text: 'Wallet'.tr,
|
||||
onTap: () =>
|
||||
Get.to(() => WalletCaptain(), transition: Transition.native),
|
||||
),
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: Icons.person,
|
||||
text: 'Profile'.tr,
|
||||
onTap: () => Get.to(() => ProfileCaptain(),
|
||||
transition: Transition.rightToLeftWithFade),
|
||||
),
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: Icons.history,
|
||||
text: 'History of Trip'.tr,
|
||||
onTap: () => Get.to(() => const HistoryCaptain(),
|
||||
transition: Transition.downToUp),
|
||||
),
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: Icons.phonelink_ring_rounded,
|
||||
text: 'Available for rides'.tr,
|
||||
onTap: () => Get.to(() => const AvailableRidesPage(),
|
||||
transition: Transition.rightToLeftWithFade),
|
||||
),
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: Icons.notifications,
|
||||
text: 'Notifications'.tr,
|
||||
onTap: () => Get.to(() => const NotificationCaptain(),
|
||||
transition: Transition.upToDown),
|
||||
),
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: Icons.help,
|
||||
text: 'Helping Center'.tr,
|
||||
onTap: () =>
|
||||
Get.to(() => HelpCaptain(), transition: Transition.size),
|
||||
),
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: Icons.share_outlined,
|
||||
text: 'Share App'.tr,
|
||||
onTap: () =>
|
||||
Get.to(() => InviteDriverScreen(), transition: Transition.size),
|
||||
),
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: Icons.car_repair_outlined,
|
||||
text: "Maintenance Center".tr,
|
||||
onTap: () =>
|
||||
Get.to(() => MaintainCenterPage(), transition: Transition.size),
|
||||
),
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: Icons.contact_mail_rounded,
|
||||
text: "Contact Us".tr,
|
||||
onTap: () =>
|
||||
Get.to(() => ContactUsPage(), transition: Transition.cupertino),
|
||||
),
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: Icons.settings,
|
||||
text: 'Settings'.tr,
|
||||
onTap: () => Get.to(() => const SettingsCaptain(),
|
||||
transition: Transition.cupertino),
|
||||
),
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: Icons.exit_to_app,
|
||||
text: 'Sign Out'.tr,
|
||||
onTap: () => Get.to(() => const LogoutCaptain(),
|
||||
transition: Transition.cupertinoDialog),
|
||||
),
|
||||
_buildDivider(),
|
||||
],
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
middle: Text('Menu'.tr),
|
||||
),
|
||||
child: SafeArea(
|
||||
child: CustomScrollView(
|
||||
slivers: [
|
||||
const SliverToBoxAdapter(child: const UserAccountHeader()),
|
||||
SliverList(
|
||||
delegate: SliverChildListDelegate([
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: CupertinoIcons.money_dollar,
|
||||
text: 'Wallet'.tr,
|
||||
onTap: () => Get.to(() => WalletCaptain()),
|
||||
),
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: CupertinoIcons.person,
|
||||
text: 'Profile'.tr,
|
||||
onTap: () => Get.to(() => ProfileCaptain()),
|
||||
),
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: CupertinoIcons.clock,
|
||||
text: 'History of Trip'.tr,
|
||||
onTap: () => Get.to(() => const HistoryCaptain()),
|
||||
),
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: CupertinoIcons.car_detailed,
|
||||
text: 'Available for rides'.tr,
|
||||
onTap: () => Get.to(() => const AvailableRidesPage()),
|
||||
),
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: CupertinoIcons.bell,
|
||||
text: 'Notifications'.tr,
|
||||
onTap: () => Get.to(() => const NotificationCaptain()),
|
||||
),
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: CupertinoIcons.question_circle,
|
||||
text: 'Helping Center'.tr,
|
||||
onTap: () => Get.to(() => HelpCaptain()),
|
||||
),
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: CupertinoIcons.share,
|
||||
text: 'Share App'.tr,
|
||||
onTap: () => Get.to(() => InviteDriverScreen()),
|
||||
),
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: CupertinoIcons.wrench,
|
||||
text: "Maintenance Center".tr,
|
||||
onTap: () => Get.to(() => MaintainCenterPage()),
|
||||
),
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: CupertinoIcons.mail,
|
||||
text: "Contact Us".tr,
|
||||
onTap: () => Get.to(() => ContactUsPage()),
|
||||
),
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: CupertinoIcons.settings,
|
||||
text: 'Settings'.tr,
|
||||
onTap: () => Get.to(() => const SettingsCaptain()),
|
||||
),
|
||||
_buildDivider(),
|
||||
_buildDrawerItem(
|
||||
icon: CupertinoIcons.square_arrow_right,
|
||||
text: 'Sign Out'.tr,
|
||||
onTap: () => Get.to(() => const LogoutCaptain()),
|
||||
),
|
||||
_buildDivider(),
|
||||
]),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -119,19 +116,27 @@ class DrawerCaptain extends StatelessWidget {
|
||||
return const Divider(
|
||||
thickness: 1,
|
||||
height: 1,
|
||||
color: AppColor.accentColor,
|
||||
color: CupertinoColors.systemGrey4,
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDrawerItem({
|
||||
required IconData icon,
|
||||
required String text,
|
||||
required GestureTapCallback onTap,
|
||||
required VoidCallback onTap,
|
||||
}) {
|
||||
return ListTile(
|
||||
leading: Icon(icon, color: AppColor.accentColor),
|
||||
title: Text(text, style: AppStyle.title),
|
||||
onTap: onTap,
|
||||
return CupertinoButton(
|
||||
onPressed: onTap,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(icon, color: CupertinoColors.activeBlue),
|
||||
const SizedBox(width: 10),
|
||||
Text(text, style: const TextStyle(color: CupertinoColors.label)),
|
||||
const Spacer(),
|
||||
const Icon(CupertinoIcons.right_chevron,
|
||||
color: CupertinoColors.systemGrey),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -141,90 +146,102 @@ class UserAccountHeader extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return UserAccountsDrawerHeader(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.greenColor,
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: AppColor.gradientStartEnd,
|
||||
colors: [AppColor.blueColor, AppColor.twitterColor],
|
||||
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.secondaryColor),
|
||||
),
|
||||
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.secondaryColor),
|
||||
),
|
||||
),
|
||||
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',
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
GetBuilder<ImageController>(
|
||||
builder: (imageController) {
|
||||
return Stack(
|
||||
children: [
|
||||
imageController.isloading
|
||||
? const CupertinoActivityIndicator()
|
||||
: Container(
|
||||
width: 100,
|
||||
height: 100,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
image: DecorationImage(
|
||||
fit: BoxFit.cover,
|
||||
image: NetworkImage(
|
||||
'${AK.serverPHP}/portrate_captain_image/${box.read(BoxName.driverID)}.jpg',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
right: 0,
|
||||
top: 0,
|
||||
child: CupertinoButton(
|
||||
onPressed: () {
|
||||
imageController.choosImagePicture(
|
||||
AppLink.uploadImage1, 'portrait');
|
||||
},
|
||||
child: const Icon(CupertinoIcons.pencil_circle_fill,
|
||||
color: CupertinoColors.white),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
right: 0,
|
||||
top: 0,
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
imageController.choosImagePicture(
|
||||
AppLink.uploadImage1, 'portrait');
|
||||
},
|
||||
icon: const Icon(Icons.edit),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
box.read(BoxName.nameDriver).toString(),
|
||||
style: const TextStyle(
|
||||
color: CupertinoColors.white,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Text(
|
||||
box.read(BoxName.emailDriver),
|
||||
style: const TextStyle(color: CupertinoColors.white, fontSize: 14),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
Get.find<HomeCaptainController>().rating.toString(),
|
||||
style: const TextStyle(
|
||||
color: CupertinoColors.systemYellow, fontSize: 16),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
const SizedBox(width: 5),
|
||||
// You might want to replace this with a Cupertino-style rating widget
|
||||
// For now, we'll use text to represent stars
|
||||
// const Text('★★★★★',
|
||||
// style: TextStyle(color: CupertinoColors.systemYellow)),
|
||||
|
||||
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) {},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user