Initial commit
This commit is contained in:
703
lib/app/cab_screen/cab_dashboard_screen.dart
Normal file
703
lib/app/cab_screen/cab_dashboard_screen.dart
Normal file
@@ -0,0 +1,703 @@
|
||||
import 'package:driver/app/auth_screen/login_screen.dart';
|
||||
import 'package:driver/app/cab_screen/cab_order_list_screen.dart';
|
||||
import 'package:driver/app/change%20langauge/change_language_screen.dart';
|
||||
import 'package:driver/app/chat_screens/driver_inbox_screen.dart';
|
||||
import 'package:driver/app/edit_profile_screen/edit_profile_screen.dart';
|
||||
import 'package:driver/app/terms_and_condition/terms_and_condition_screen.dart';
|
||||
import 'package:driver/app/verification_screen/verification_screen.dart';
|
||||
import 'package:driver/app/wallet_screen/wallet_screen.dart';
|
||||
import 'package:driver/app/withdraw_method_setup_screens/withdraw_method_setup_screen.dart';
|
||||
import 'package:driver/constant/constant.dart';
|
||||
import 'package:driver/constant/show_toast_dialog.dart';
|
||||
import 'package:driver/controllers/cab_dashboard_controller.dart';
|
||||
import 'package:driver/services/audio_player_service.dart';
|
||||
import 'package:driver/themes/app_them_data.dart';
|
||||
import 'package:driver/themes/custom_dialog_box.dart';
|
||||
import 'package:driver/themes/theme_controller.dart';
|
||||
import 'package:driver/utils/fire_store_utils.dart';
|
||||
import 'package:driver/utils/network_image_widget.dart';
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:in_app_review/in_app_review.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
|
||||
import '../vehicle_information_screen/vehicle_information_screen.dart';
|
||||
import 'cab_home_screen.dart';
|
||||
|
||||
class CabDashboardScreen extends StatelessWidget {
|
||||
const CabDashboardScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final themeController = Get.find<ThemeController>();
|
||||
return Obx(() {
|
||||
final isDark = themeController.isDark.value;
|
||||
return GetX(
|
||||
init: CabDashBoardController(),
|
||||
builder: (controller) {
|
||||
return Scaffold(
|
||||
drawerEnableOpenDragGesture: false,
|
||||
appBar: AppBar(
|
||||
// backgroundColor: isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
titleSpacing: 5,
|
||||
title: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Welcome Back 👋'.tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
fontSize: 12,
|
||||
fontFamily: AppThemeData.medium,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
Constant.userModel!.fullName().tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
fontSize: 14,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
Constant.userModel!.ownerId != null && Constant.userModel!.ownerId!.isNotEmpty
|
||||
? SizedBox()
|
||||
: InkWell(
|
||||
onTap: () {
|
||||
Get.to(const WalletScreen(isAppBarShow: true));
|
||||
},
|
||||
child: SvgPicture.asset("assets/icons/ic_wallet_home.svg")),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Get.to(const EditProfileScreen());
|
||||
},
|
||||
child: SvgPicture.asset("assets/icons/ic_user_business.svg")),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
],
|
||||
leading: Builder(builder: (context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Scaffold.of(context).openDrawer();
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Container(
|
||||
decoration: ShapeDecoration(
|
||||
color: isDark ? AppThemeData.carRent600 : AppThemeData.carRent50,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(120),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: SvgPicture.asset("assets/icons/ic_drawer_open.svg"),
|
||||
)),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
drawer: const DrawerView(),
|
||||
body: controller.drawerIndex.value == 0
|
||||
? const CabHomeScreen()
|
||||
: controller.drawerIndex.value == 1
|
||||
? const CabOrderListScreen()
|
||||
: controller.drawerIndex.value == 2
|
||||
? const WalletScreen(
|
||||
isAppBarShow: false,
|
||||
)
|
||||
: controller.drawerIndex.value == 3
|
||||
? const WithdrawMethodSetupScreen()
|
||||
: controller.drawerIndex.value == 4
|
||||
? const VerificationScreen()
|
||||
: controller.drawerIndex.value == 5
|
||||
? const DriverInboxScreen()
|
||||
: controller.drawerIndex.value == 6
|
||||
? const VehicleInformationScreen()
|
||||
: controller.drawerIndex.value == 7
|
||||
? const ChangeLanguageScreen()
|
||||
: controller.drawerIndex.value == 8
|
||||
? const TermsAndConditionScreen(type: "temsandcondition")
|
||||
: const TermsAndConditionScreen(type: "privacy"),
|
||||
);
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class DrawerView extends StatelessWidget {
|
||||
const DrawerView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final themeController = Get.find<ThemeController>();
|
||||
return Obx(() {
|
||||
var isDark = themeController.isDark.value;
|
||||
return GetX(
|
||||
init: CabDashBoardController(),
|
||||
builder: (controller) {
|
||||
return Drawer(
|
||||
backgroundColor: isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(top: MediaQuery.of(context).viewPadding.top + 20, left: 16, right: 16),
|
||||
child: ListView(
|
||||
padding: EdgeInsets.zero,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: [
|
||||
ClipOval(
|
||||
child: NetworkImageWidget(
|
||||
imageUrl: Constant.userModel == null ? "" : Constant.userModel!.profilePictureURL.toString(),
|
||||
height: 55,
|
||||
width: 55,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
Constant.userModel!.fullName().tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
fontSize: 18,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'${Constant.userModel!.email}'.tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
fontSize: 14,
|
||||
fontFamily: AppThemeData.regular,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
ListTile(
|
||||
visualDensity: const VisualDensity(horizontal: 0, vertical: -2),
|
||||
contentPadding: const EdgeInsets.only(left: 0.0, right: 0.0),
|
||||
trailing: Transform.scale(
|
||||
scale: 0.8,
|
||||
child: CupertinoSwitch(
|
||||
value: controller.userModel.value.isActive ?? false,
|
||||
activeTrackColor: AppThemeData.primary300,
|
||||
onChanged: (value) async {
|
||||
if (Constant.isDriverVerification == true) {
|
||||
if (controller.userModel.value.isDocumentVerify == true) {
|
||||
controller.userModel.value.isActive = value;
|
||||
controller.userModel.value.inProgressOrderID = Constant.userModel!.inProgressOrderID;
|
||||
controller.userModel.value.orderCabRequestData = Constant.userModel!.orderCabRequestData;
|
||||
if (controller.userModel.value.isActive == true) {
|
||||
controller.updateCurrentLocation();
|
||||
}
|
||||
await FireStoreUtils.updateUser(controller.userModel.value);
|
||||
} else {
|
||||
ShowToastDialog.showToast("Document verification is pending. Please proceed to set up your document verification.".tr);
|
||||
}
|
||||
} else {
|
||||
controller.userModel.value.isActive = value;
|
||||
controller.userModel.value.inProgressOrderID = Constant.userModel!.inProgressOrderID;
|
||||
controller.userModel.value.orderCabRequestData = Constant.userModel!.orderCabRequestData;
|
||||
if (controller.userModel.value.isActive == true) {
|
||||
controller.updateCurrentLocation();
|
||||
}
|
||||
await FireStoreUtils.updateUser(controller.userModel.value);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
dense: true,
|
||||
title: Text(
|
||||
'Available Status'.tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey100 : AppThemeData.grey800,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
child: Text(
|
||||
'About App'.tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey400 : AppThemeData.grey500,
|
||||
fontSize: 12,
|
||||
fontFamily: AppThemeData.medium,
|
||||
),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
visualDensity: const VisualDensity(horizontal: 0, vertical: -2),
|
||||
contentPadding: const EdgeInsets.only(left: 0.0, right: 0.0),
|
||||
leading: SvgPicture.asset(
|
||||
"assets/icons/ic_home_add.svg",
|
||||
width: 20,
|
||||
),
|
||||
trailing: const Icon(Icons.keyboard_arrow_right_rounded, size: 24),
|
||||
dense: true,
|
||||
title: Text(
|
||||
'Home'.tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey100 : AppThemeData.grey800,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Get.back();
|
||||
controller.drawerIndex.value = 0;
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
visualDensity: const VisualDensity(horizontal: 0, vertical: -2),
|
||||
contentPadding: const EdgeInsets.only(left: 0.0, right: 0.0),
|
||||
leading: SvgPicture.asset(
|
||||
"assets/icons/ic_shoping_cart.svg",
|
||||
colorFilter: ColorFilter.mode(AppThemeData.primary300, BlendMode.srcIn),
|
||||
),
|
||||
trailing: const Icon(Icons.keyboard_arrow_right_rounded, size: 24),
|
||||
dense: true,
|
||||
title: Text(
|
||||
'Orders'.tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey100 : AppThemeData.grey800,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Get.back();
|
||||
controller.drawerIndex.value = 1;
|
||||
},
|
||||
),
|
||||
Constant.userModel!.ownerId != null && Constant.userModel!.ownerId!.isNotEmpty
|
||||
? SizedBox()
|
||||
: ListTile(
|
||||
visualDensity: const VisualDensity(horizontal: 0, vertical: -2),
|
||||
contentPadding: const EdgeInsets.only(left: 0.0, right: 0.0),
|
||||
leading: SvgPicture.asset(
|
||||
"assets/icons/ic_wallet.svg",
|
||||
colorFilter: ColorFilter.mode(AppThemeData.primary300, BlendMode.srcIn),
|
||||
),
|
||||
trailing: const Icon(Icons.keyboard_arrow_right_rounded, size: 24),
|
||||
dense: true,
|
||||
title: Text(
|
||||
'Wallet'.tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey100 : AppThemeData.grey800,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Get.back();
|
||||
controller.drawerIndex.value = 2;
|
||||
},
|
||||
),
|
||||
Constant.userModel!.ownerId != null && Constant.userModel!.ownerId!.isNotEmpty
|
||||
? SizedBox()
|
||||
: ListTile(
|
||||
visualDensity: const VisualDensity(horizontal: 0, vertical: -2),
|
||||
contentPadding: const EdgeInsets.only(left: 0.0, right: 0.0),
|
||||
leading: SvgPicture.asset(
|
||||
"assets/icons/ic_settings.svg",
|
||||
),
|
||||
trailing: const Icon(Icons.keyboard_arrow_right_rounded, size: 24),
|
||||
dense: true,
|
||||
title: Text(
|
||||
'Withdrawal Method'.tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey100 : AppThemeData.grey800,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Get.back();
|
||||
controller.drawerIndex.value = 3;
|
||||
},
|
||||
),
|
||||
(((Constant.userModel?.ownerId == null || Constant.userModel!.ownerId!.isEmpty) && Constant.isDriverVerification == true) &&
|
||||
!((Constant.userModel?.ownerId != null && Constant.userModel!.ownerId!.isNotEmpty && Constant.isOwnerVerification == true)))
|
||||
? ListTile(
|
||||
visualDensity: const VisualDensity(horizontal: 0, vertical: -2),
|
||||
contentPadding: const EdgeInsets.only(left: 0.0, right: 0.0),
|
||||
leading: SvgPicture.asset("assets/icons/ic_notes.svg"),
|
||||
trailing: const Icon(Icons.keyboard_arrow_right_rounded, size: 24),
|
||||
dense: true,
|
||||
title: Text(
|
||||
'Document Verification'.tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey100 : AppThemeData.grey800,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Get.back();
|
||||
controller.drawerIndex.value = 4;
|
||||
},
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
ListTile(
|
||||
visualDensity: const VisualDensity(horizontal: 0, vertical: -2),
|
||||
contentPadding: const EdgeInsets.only(left: 0.0, right: 0.0),
|
||||
leading: SvgPicture.asset(
|
||||
"assets/icons/ic_chat.svg",
|
||||
),
|
||||
trailing: const Icon(Icons.keyboard_arrow_right_rounded, size: 24),
|
||||
dense: true,
|
||||
title: Text(
|
||||
'Inbox'.tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey100 : AppThemeData.grey800,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Get.back();
|
||||
controller.drawerIndex.value = 5;
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
visualDensity: const VisualDensity(horizontal: 0, vertical: -2),
|
||||
contentPadding: const EdgeInsets.only(left: 0.0, right: 0.0),
|
||||
leading: Icon(Icons.car_crash),
|
||||
trailing: const Icon(Icons.keyboard_arrow_right_rounded, size: 24),
|
||||
dense: true,
|
||||
title: Text(
|
||||
'Vehicle Information'.tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey100 : AppThemeData.grey800,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Get.back();
|
||||
controller.drawerIndex.value = 6;
|
||||
},
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
child: Text(
|
||||
'App Preferences'.tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey400 : AppThemeData.grey500,
|
||||
fontSize: 12,
|
||||
fontFamily: AppThemeData.medium,
|
||||
),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
visualDensity: const VisualDensity(horizontal: 0, vertical: -2),
|
||||
contentPadding: const EdgeInsets.only(left: 0.0, right: 0.0),
|
||||
leading: SvgPicture.asset(
|
||||
"assets/icons/ic_change_language.svg",
|
||||
),
|
||||
trailing: const Icon(Icons.keyboard_arrow_right_rounded, size: 24),
|
||||
dense: true,
|
||||
title: Text(
|
||||
'Change Language'.tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey100 : AppThemeData.grey800,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Get.back();
|
||||
controller.drawerIndex.value = 7;
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
visualDensity: const VisualDensity(horizontal: 0, vertical: -2),
|
||||
contentPadding: const EdgeInsets.only(left: 0.0, right: 0.0),
|
||||
leading: SvgPicture.asset(
|
||||
"assets/icons/ic_light_dark.svg",
|
||||
),
|
||||
trailing: Transform.scale(
|
||||
scale: 0.8,
|
||||
child: CupertinoSwitch(
|
||||
value: controller.isDarkModeSwitch.value,
|
||||
activeTrackColor: AppThemeData.primary300,
|
||||
onChanged: (value) {
|
||||
controller.toggleDarkMode(value);
|
||||
},
|
||||
),
|
||||
),
|
||||
dense: true,
|
||||
title: Text(
|
||||
'Dark Mode'.tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey100 : AppThemeData.grey800,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
child: Text(
|
||||
'Social'.tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey400 : AppThemeData.grey500,
|
||||
fontSize: 12,
|
||||
fontFamily: AppThemeData.medium,
|
||||
),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
visualDensity: const VisualDensity(horizontal: 0, vertical: -2),
|
||||
contentPadding: const EdgeInsets.only(left: 0.0, right: 0.0),
|
||||
leading: SvgPicture.asset(
|
||||
"assets/icons/ic_share.svg",
|
||||
),
|
||||
trailing: const Icon(Icons.keyboard_arrow_right_rounded, size: 24),
|
||||
dense: true,
|
||||
title: Text(
|
||||
'Share app'.tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey100 : AppThemeData.grey800,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Get.back();
|
||||
Share.share(
|
||||
'${'Check out eMart, your ultimate food delivery application!'.tr} \n\n${'Google Play:'.tr} ${Constant.googlePlayLink} \n\n${'App Store:'.tr} ${Constant.appStoreLink}',
|
||||
subject: 'Look what I made!'.tr);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
visualDensity: const VisualDensity(horizontal: 0, vertical: -2),
|
||||
contentPadding: const EdgeInsets.only(left: 0.0, right: 0.0),
|
||||
leading: SvgPicture.asset(
|
||||
"assets/icons/ic_rate.svg",
|
||||
),
|
||||
trailing: const Icon(Icons.keyboard_arrow_right_rounded, size: 24),
|
||||
dense: true,
|
||||
title: Text(
|
||||
'Rate the app'.tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey100 : AppThemeData.grey800,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Get.back();
|
||||
final InAppReview inAppReview = InAppReview.instance;
|
||||
inAppReview.requestReview();
|
||||
},
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
child: Text(
|
||||
'Legal'.tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey400 : AppThemeData.grey500,
|
||||
fontSize: 12,
|
||||
fontFamily: AppThemeData.medium,
|
||||
),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
visualDensity: const VisualDensity(horizontal: 0, vertical: -2),
|
||||
contentPadding: const EdgeInsets.only(left: 0.0, right: 0.0),
|
||||
leading: SvgPicture.asset(
|
||||
"assets/icons/ic_terms_condition.svg",
|
||||
colorFilter: ColorFilter.mode(AppThemeData.primary300, BlendMode.srcIn),
|
||||
),
|
||||
trailing: const Icon(Icons.keyboard_arrow_right_rounded, size: 24),
|
||||
dense: true,
|
||||
title: Text(
|
||||
'Terms and Conditions'.tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey100 : AppThemeData.grey800,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Get.back();
|
||||
controller.drawerIndex.value = 8;
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
visualDensity: const VisualDensity(horizontal: 0, vertical: -2),
|
||||
contentPadding: const EdgeInsets.only(left: 0.0, right: 0.0),
|
||||
leading: SvgPicture.asset(
|
||||
"assets/icons/ic_privacyPolicy.svg",
|
||||
colorFilter: const ColorFilter.mode(AppThemeData.danger300, BlendMode.srcIn),
|
||||
),
|
||||
trailing: const Icon(Icons.keyboard_arrow_right_rounded, size: 24),
|
||||
dense: true,
|
||||
title: Text(
|
||||
'Privacy Policy'.tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey100 : AppThemeData.grey800,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Get.back();
|
||||
controller.drawerIndex.value = 9;
|
||||
},
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
ListTile(
|
||||
visualDensity: const VisualDensity(horizontal: 0, vertical: -2),
|
||||
contentPadding: const EdgeInsets.only(left: 0.0, right: 0.0),
|
||||
leading: SvgPicture.asset(
|
||||
"assets/icons/ic_logout.svg",
|
||||
colorFilter: const ColorFilter.mode(AppThemeData.danger300, BlendMode.srcIn),
|
||||
),
|
||||
trailing: const Icon(
|
||||
Icons.keyboard_arrow_right_rounded,
|
||||
size: 24,
|
||||
color: AppThemeData.danger300,
|
||||
),
|
||||
dense: true,
|
||||
title: Text(
|
||||
'Log out'.tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.danger300 : AppThemeData.danger300,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Get.back();
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return CustomDialogBox(
|
||||
title: "Log out".tr,
|
||||
descriptions: "Are you sure you want to log out? You will need to enter your credentials to log back in.".tr,
|
||||
positiveString: "Log out".tr,
|
||||
negativeString: "Cancel".tr,
|
||||
positiveClick: () async {
|
||||
await AudioPlayerService.playSound(false);
|
||||
Constant.userModel!.fcmToken = "";
|
||||
await FireStoreUtils.updateUser(Constant.userModel!);
|
||||
await FirebaseAuth.instance.signOut();
|
||||
Get.offAll(const LoginScreen());
|
||||
},
|
||||
negativeClick: () {
|
||||
Get.back();
|
||||
},
|
||||
img: Image.asset(
|
||||
'assets/images/ic_logout.gif',
|
||||
height: 50,
|
||||
width: 50,
|
||||
),
|
||||
);
|
||||
});
|
||||
},
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return CustomDialogBox(
|
||||
title: "Delete Account".tr,
|
||||
descriptions: "Are you sure you want to delete your account? This action is irreversible and will permanently remove all your data.".tr,
|
||||
positiveString: "Delete".tr,
|
||||
negativeString: "Cancel".tr,
|
||||
positiveClick: () async {
|
||||
ShowToastDialog.showLoader("Please wait".tr);
|
||||
await FireStoreUtils.deleteUser().then((value) {
|
||||
ShowToastDialog.closeLoader();
|
||||
if (value == true) {
|
||||
ShowToastDialog.showToast("Account deleted successfully".tr);
|
||||
Get.offAll(const LoginScreen());
|
||||
} else {
|
||||
ShowToastDialog.showToast("Contact Administrator".tr);
|
||||
}
|
||||
});
|
||||
},
|
||||
negativeClick: () {
|
||||
Get.back();
|
||||
},
|
||||
img: Image.asset(
|
||||
'assets/icons/delete_dialog.gif',
|
||||
height: 50,
|
||||
width: 50,
|
||||
),
|
||||
);
|
||||
});
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
"assets/icons/ic_delete.svg",
|
||||
colorFilter: const ColorFilter.mode(AppThemeData.danger300, BlendMode.srcIn),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text(
|
||||
'Delete Account'.tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.danger300 : AppThemeData.danger300,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Center(
|
||||
child: Text(
|
||||
"V : ${Constant.appVersion}",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontSize: 14,
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
1281
lib/app/cab_screen/cab_home_screen.dart
Normal file
1281
lib/app/cab_screen/cab_home_screen.dart
Normal file
File diff suppressed because it is too large
Load Diff
427
lib/app/cab_screen/cab_order_details.dart
Normal file
427
lib/app/cab_screen/cab_order_details.dart
Normal file
@@ -0,0 +1,427 @@
|
||||
import 'package:dotted_border/dotted_border.dart';
|
||||
import 'package:driver/themes/responsive.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../constant/constant.dart';
|
||||
import '../../controllers/cab_order_details_controller.dart';
|
||||
import '../../themes/app_them_data.dart';
|
||||
import 'package:flutter_map/flutter_map.dart' as fm;
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart' as gmap;
|
||||
import 'package:latlong2/latlong.dart' as osm;
|
||||
import '../../themes/theme_controller.dart';
|
||||
import '../../utils/network_image_widget.dart';
|
||||
|
||||
class CabOrderDetails extends StatelessWidget {
|
||||
const CabOrderDetails({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final themeController = Get.find<ThemeController>();
|
||||
final isDark = themeController.isDark.value;
|
||||
return GetX(
|
||||
init: CabOrderDetailsController(),
|
||||
builder: (controller) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
"Ride Details",
|
||||
style: TextStyle(
|
||||
color: isDark ? Colors.white : Colors.black,
|
||||
),
|
||||
),
|
||||
backgroundColor: isDark ? Colors.black : Colors.white,
|
||||
iconTheme: IconThemeData(
|
||||
color: isDark ? Colors.white : Colors.black,
|
||||
),
|
||||
),
|
||||
body: controller.isLoading.value
|
||||
? Constant.loader()
|
||||
: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
color: isDark ? AppThemeData.greyDark50 : AppThemeData.grey50,
|
||||
border: Border.all(color: isDark ? AppThemeData.greyDark200 : AppThemeData.grey200),
|
||||
),
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Text(
|
||||
"${'Order Id:'.tr} ${Constant.orderId(orderId: controller.cabOrder.value.id.toString())}".tr,
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
fontSize: 18,
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Container(
|
||||
margin: const EdgeInsets.only(bottom: 16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: isDark ? AppThemeData.greyDark50 : AppThemeData.grey50,
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
border: Border.all(color: isDark ? AppThemeData.greyDark200 : AppThemeData.grey200),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"${'Booking Date:'.tr}${controller.formatDate(controller.cabOrder.value.scheduleDateTime!)}".tr,
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
fontSize: 18,
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Icon(Icons.stop_circle_outlined, color: Colors.green),
|
||||
DottedBorder(
|
||||
options: CustomPathDottedBorderOptions(
|
||||
color: Colors.grey.shade400,
|
||||
strokeWidth: 2,
|
||||
dashPattern: [4, 4],
|
||||
customPath: (size) => Path()
|
||||
..moveTo(size.width / 2, 0)
|
||||
..lineTo(size.width / 2, size.height),
|
||||
),
|
||||
child: const SizedBox(width: 20, height: 55),
|
||||
),
|
||||
Icon(Icons.radio_button_checked, color: Colors.red),
|
||||
],
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
// Source Location Name
|
||||
Expanded(
|
||||
child: Text(
|
||||
controller.cabOrder.value.sourceLocationName.toString(),
|
||||
style: AppThemeData.semiBoldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(color: AppThemeData.warning300, width: 1),
|
||||
color: AppThemeData.warning50,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
||||
child: Text(
|
||||
controller.cabOrder.value.status.toString(),
|
||||
style: AppThemeData.boldTextStyle(fontSize: 14, color: AppThemeData.warning500),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
DottedBorder(
|
||||
options: CustomPathDottedBorderOptions(
|
||||
color: Colors.grey.shade400,
|
||||
strokeWidth: 2,
|
||||
dashPattern: [4, 4],
|
||||
customPath: (size) => Path()
|
||||
..moveTo(0, size.height / 2) // start from left center
|
||||
..lineTo(size.width, size.height / 2), // draw to right center
|
||||
),
|
||||
child: const SizedBox(width: 295, height: 3),
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
Text(
|
||||
controller.cabOrder.value.destinationLocationName.toString(),
|
||||
style: AppThemeData.semiBoldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// map view show
|
||||
Container(
|
||||
height: 180,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
color: isDark ? AppThemeData.greyDark50 : AppThemeData.grey50,
|
||||
border: Border.all(color: isDark ? AppThemeData.greyDark200 : AppThemeData.grey200),
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
child: Constant.selectedMapType == "osm"
|
||||
? fm.FlutterMap(
|
||||
options: fm.MapOptions(
|
||||
initialCenter: osm.LatLng(controller.cabOrder.value.sourceLocation!.latitude!, controller.cabOrder.value.sourceLocation!.longitude!),
|
||||
initialZoom: 13,
|
||||
),
|
||||
children: [
|
||||
fm.TileLayer(urlTemplate: "https://tile.openstreetmap.org/{z}/{x}/{y}.png"),
|
||||
|
||||
// Only show polyline if points exist
|
||||
if (controller.osmPolyline.isNotEmpty)
|
||||
fm.PolylineLayer(polylines: [fm.Polyline(points: controller.osmPolyline.toList(), color: Colors.blue, strokeWidth: 4)]),
|
||||
|
||||
fm.MarkerLayer(
|
||||
markers: [
|
||||
fm.Marker(
|
||||
point: osm.LatLng(controller.cabOrder.value.sourceLocation!.latitude!, controller.cabOrder.value.sourceLocation!.longitude!),
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: Image.asset('assets/icons/ic_cab_pickup.png', width: 10, height: 10),
|
||||
),
|
||||
fm.Marker(
|
||||
point: osm.LatLng(
|
||||
controller.cabOrder.value.destinationLocation!.latitude!,
|
||||
controller.cabOrder.value.destinationLocation!.longitude!,
|
||||
),
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: Image.asset('assets/icons/ic_cab_destination.png', width: 10, height: 10),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
: gmap.GoogleMap(
|
||||
initialCameraPosition: gmap.CameraPosition(
|
||||
target: gmap.LatLng(controller.cabOrder.value.sourceLocation!.latitude!, controller.cabOrder.value.sourceLocation!.longitude!),
|
||||
zoom: 13,
|
||||
),
|
||||
polylines: controller.googlePolylines.toSet(),
|
||||
markers: controller.googleMarkers.toSet(),
|
||||
),
|
||||
),
|
||||
),
|
||||
controller.cabOrder.value.driver != null
|
||||
? Column(
|
||||
children: [
|
||||
const SizedBox(height: 16),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
color: isDark ? AppThemeData.greyDark50 : AppThemeData.grey50,
|
||||
border: Border.all(color: isDark ? AppThemeData.greyDark200 : AppThemeData.grey200),
|
||||
),
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"About Customer".tr,
|
||||
style: AppThemeData.boldTextStyle(fontSize: 14, color: isDark ? AppThemeData.greyDark500 : AppThemeData.grey500),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 52,
|
||||
height: 52,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadiusGeometry.circular(10),
|
||||
child: NetworkImageWidget(
|
||||
imageUrl: controller.cabOrder.value.author?.profilePictureURL ?? '',
|
||||
height: 70,
|
||||
width: 70,
|
||||
borderRadius: 35,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 20),
|
||||
Text(
|
||||
controller.cabOrder.value.author?.fullName() ?? '',
|
||||
style: AppThemeData.boldTextStyle(color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900, fontSize: 18),
|
||||
),
|
||||
// Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Text(
|
||||
// controller.cabOrder.value.author?.fullName() ?? '',
|
||||
// style: AppThemeData.boldTextStyle(color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900, fontSize: 18),
|
||||
// ),
|
||||
// Text(
|
||||
// "${controller.cabOrder.value.author?.vehicleType ?? ''} | ${controller.cabOrder.value.author?.carMakes.toString()}",
|
||||
// style: TextStyle(
|
||||
// fontFamily: AppThemeData.medium,
|
||||
// color: isDark ? AppThemeData.greyDark700 : AppThemeData.grey700,
|
||||
// fontSize: 14,
|
||||
// ),
|
||||
// ),
|
||||
// Text(
|
||||
// controller.cabOrder.value.driver?.carNumber ?? '',
|
||||
// style: AppThemeData.boldTextStyle(color: isDark ? AppThemeData.greyDark700 : AppThemeData.grey700, fontSize: 16),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: SizedBox(),
|
||||
const SizedBox(height: 16),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
color: isDark ? AppThemeData.greyDark50 : AppThemeData.grey50,
|
||||
border: Border.all(color: isDark ? AppThemeData.greyDark200 : AppThemeData.grey200),
|
||||
),
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
_iconTile(
|
||||
controller.cabOrder.value.distance != null
|
||||
? "${double.tryParse(controller.cabOrder.value.distance.toString())?.toStringAsFixed(2) ?? '--'} KM"
|
||||
: "-- KM",
|
||||
"Distance".tr,
|
||||
"assets/icons/ic_distance_parcel.svg",
|
||||
isDark,
|
||||
),
|
||||
_iconTile(controller.cabOrder.value.duration ?? '--', "Duration".tr, "assets/icons/ic_duration.svg", isDark),
|
||||
_iconTile(
|
||||
Constant.amountShow(amount: controller.cabOrder.value.subTotal),
|
||||
"${controller.cabOrder.value.paymentMethod}".tr,
|
||||
"assets/icons/ic_rate_parcel.svg",
|
||||
isDark,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
color: isDark ? AppThemeData.greyDark50 : AppThemeData.grey50,
|
||||
border: Border.all(color: isDark ? AppThemeData.greyDark200 : AppThemeData.grey200),
|
||||
),
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("Order Summary".tr, style: AppThemeData.boldTextStyle(fontSize: 14, color: AppThemeData.grey500)),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
// Subtotal
|
||||
_summaryTile("Subtotal".tr, Constant.amountShow(amount: controller.subTotal.value.toString()), isDark, null),
|
||||
|
||||
// Discount
|
||||
_summaryTile("Discount".tr, Constant.amountShow(amount: controller.discount.value.toString()), isDark, null),
|
||||
|
||||
// Tax List
|
||||
...List.generate(controller.cabOrder.value.taxSetting!.length, (index) {
|
||||
return _summaryTile(
|
||||
"${controller.cabOrder.value.taxSetting![index].title} ${controller.cabOrder.value.taxSetting![index].type == 'fix' ? '' : '(${controller.cabOrder.value.taxSetting![index].tax}%)'}",
|
||||
Constant.amountShow(
|
||||
amount: Constant.getTaxValue(
|
||||
amount: ((double.tryParse(controller.cabOrder.value.subTotal.toString()) ?? 0.0) -
|
||||
(double.tryParse(controller.cabOrder.value.discount.toString()) ?? 0.0))
|
||||
.toString(),
|
||||
taxModel: controller.cabOrder.value.taxSetting![index],
|
||||
).toString(),
|
||||
),
|
||||
isDark,
|
||||
null);
|
||||
}),
|
||||
|
||||
const Divider(),
|
||||
|
||||
// Total
|
||||
_summaryTile("Order Total".tr, Constant.amountShow(amount: controller.totalAmount.value.toString()), isDark, null),
|
||||
_summaryTile(
|
||||
"Admin Commission (${controller.cabOrder.value.adminCommission}${controller.cabOrder.value.adminCommissionType == "Percentage" || controller.cabOrder.value.adminCommissionType == "percentage" ? "%" : Constant.currencyModel!.symbol})"
|
||||
.tr,
|
||||
Constant.amountShow(amount: controller.adminCommission.value.toString()),
|
||||
isDark,
|
||||
AppThemeData.danger300,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
controller.cabOrder.value.driver!.ownerId != null && controller.cabOrder.value.driver!.ownerId!.isNotEmpty ||
|
||||
controller.cabOrder.value.status == Constant.orderPlaced
|
||||
? SizedBox()
|
||||
: Container(
|
||||
width: Responsive.width(100, context),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: isDark ? AppThemeData.danger50 : AppThemeData.danger50),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Note : Admin commission will be debited from your wallet balance. \n \nAdmin commission will apply on your booking Amount minus Discount(if applicable).",
|
||||
style: AppThemeData.boldTextStyle(fontSize: 16, color: isDark ? AppThemeData.danger300 : AppThemeData.danger300),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _iconTile(String value, title, icon, bool isDark) {
|
||||
return Column(
|
||||
children: [
|
||||
// Icon(icon, color: AppThemeData.primary300),
|
||||
SvgPicture.asset(icon, height: 28, width: 28, color: isDark ? AppThemeData.greyDark800 : AppThemeData.grey800),
|
||||
const SizedBox(height: 6),
|
||||
Text(value, style: AppThemeData.semiBoldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark800 : AppThemeData.grey800)),
|
||||
const SizedBox(height: 6),
|
||||
Text(title, style: AppThemeData.semiBoldTextStyle(fontSize: 12, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _summaryTile(String title, String value, bool isDark, Color? colors) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(title, style: AppThemeData.mediumTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark800 : AppThemeData.grey800)),
|
||||
Text(
|
||||
value,
|
||||
style: AppThemeData.semiBoldTextStyle(fontSize: title == "Order Total" ? 18 : 16, color: colors ?? (isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
182
lib/app/cab_screen/cab_order_list_screen.dart
Normal file
182
lib/app/cab_screen/cab_order_list_screen.dart
Normal file
@@ -0,0 +1,182 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../constant/constant.dart';
|
||||
import '../../controllers/cab_order_list_controller.dart';
|
||||
import '../../models/cab_order_model.dart';
|
||||
import '../../themes/app_them_data.dart';
|
||||
import 'package:dotted_border/dotted_border.dart';
|
||||
import '../../themes/theme_controller.dart';
|
||||
import 'cab_order_details.dart';
|
||||
|
||||
class CabOrderListScreen extends StatelessWidget {
|
||||
const CabOrderListScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final themeController = Get.find<ThemeController>();
|
||||
return Obx(() {
|
||||
final isDark = themeController.isDark.value;
|
||||
return GetX(
|
||||
init: CabOrderListController(),
|
||||
builder: (controller) {
|
||||
return DefaultTabController(
|
||||
length: controller.tabTitles.length,
|
||||
initialIndex: controller.tabTitles.indexOf(controller.selectedTab.value),
|
||||
child: Scaffold(
|
||||
body: Column(
|
||||
children: [
|
||||
// TabBar
|
||||
TabBar(
|
||||
onTap: (index) {
|
||||
controller.selectTab(controller.tabTitles[index]);
|
||||
},
|
||||
// isScrollable: true,
|
||||
indicatorColor: AppThemeData.primary300,
|
||||
labelColor: AppThemeData.primary300,
|
||||
dividerColor: isDark ? Colors.black : Colors.white,
|
||||
unselectedLabelColor: AppThemeData.primary300.withOpacity(0.60),
|
||||
labelStyle: AppThemeData.boldTextStyle(fontSize: 14),
|
||||
unselectedLabelStyle: AppThemeData.mediumTextStyle(fontSize: 14),
|
||||
tabs: controller.tabTitles.map((title) => Tab(child: Center(child: Text(title)))).toList(),
|
||||
),
|
||||
|
||||
// Body: loader or TabBarView
|
||||
Expanded(
|
||||
child: controller.isLoading.value
|
||||
? Constant.loader()
|
||||
: TabBarView(
|
||||
children: controller.tabTitles.map((title) {
|
||||
// filter by tab using controller helper
|
||||
final orders = controller.getOrdersForTab(title);
|
||||
|
||||
if (orders.isEmpty) {
|
||||
return Center(
|
||||
child: Text(
|
||||
"No orders found",
|
||||
style: AppThemeData.mediumTextStyle(color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return ListView.builder(
|
||||
padding: const EdgeInsets.all(16),
|
||||
itemCount: orders.length,
|
||||
itemBuilder: (context, index) {
|
||||
CabOrderModel order = orders[index];
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Get.to(() => CabOrderDetails(), arguments: {"cabOrderModel": order});
|
||||
},
|
||||
child: Container(
|
||||
margin: const EdgeInsets.only(bottom: 16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: isDark ? AppThemeData.greyDark50 : AppThemeData.grey50,
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
border: Border.all(color: isDark ? AppThemeData.greyDark200 : AppThemeData.grey200),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"${'Booking Date:'.tr} ${controller.formatDate(order.scheduleDateTime!)}".tr,
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
fontSize: 18,
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Icon(Icons.stop_circle_outlined, color: Colors.green),
|
||||
DottedBorder(
|
||||
options: CustomPathDottedBorderOptions(
|
||||
color: Colors.grey.shade400,
|
||||
strokeWidth: 2,
|
||||
dashPattern: [4, 4],
|
||||
customPath: (size) => Path()
|
||||
..moveTo(size.width / 2, 0)
|
||||
..lineTo(size.width / 2, size.height),
|
||||
),
|
||||
child: const SizedBox(width: 20, height: 55),
|
||||
),
|
||||
Icon(Icons.radio_button_checked, color: Colors.red),
|
||||
],
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
// Source Location Name
|
||||
Expanded(
|
||||
child: Text(
|
||||
order.sourceLocationName.toString(),
|
||||
style: AppThemeData.semiBoldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(color: AppThemeData.warning300, width: 1),
|
||||
color: AppThemeData.warning50,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
||||
child: Text(
|
||||
order.status.toString(),
|
||||
style: AppThemeData.boldTextStyle(fontSize: 14, color: AppThemeData.warning500),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
DottedBorder(
|
||||
options: CustomPathDottedBorderOptions(
|
||||
color: Colors.grey.shade400,
|
||||
strokeWidth: 2,
|
||||
dashPattern: [4, 4],
|
||||
customPath: (size) => Path()
|
||||
..moveTo(0, size.height / 2) // start from left center
|
||||
..lineTo(size.width, size.height / 2), // draw to right center
|
||||
),
|
||||
child: const SizedBox(width: 295, height: 3),
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
Text(
|
||||
order.destinationLocationName.toString(),
|
||||
style: AppThemeData.semiBoldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user