diff --git a/android/app/build.gradle b/android/app/build.gradle index c2b3ad4..8f7ee31 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -54,8 +54,8 @@ android { // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. minSdk = 23 targetSdk = flutter.targetSdkVersion - versionCode = 88 - versionName = '1.5.88`' + versionCode = 90 + versionName = '1.5.90`' multiDexEnabled =true } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 60bcc4c..bdfa54c 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -54,6 +54,7 @@ + 1.0) - SDWebImage/Core (~> 5.17) @@ -484,7 +484,7 @@ SPEC CHECKSUMS: PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 RecaptchaInterop: 7d1a4a01a6b2cb1610a47ef3f85f0c411434cb21 record_darwin: df0a677188e5fed18472550298e675f19ddaffbe - SDWebImage: 066c47b573f408f18caa467d71deace7c0f8280d + SDWebImage: 8a6b7b160b4d710e2a22b6900e25301075c34cb3 SDWebImageWebPCoder: e38c0a70396191361d60c092933e22c20d5b1380 share: 0b2c3e82132f5888bccca3351c504d0003b3b410 sign_in_with_apple: f3bf75217ea4c2c8b91823f225d70230119b8440 diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 0d86ace..0108f81 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -33,7 +33,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 57 + 58 CFBundleSignature ???? CFBundleURLTypes @@ -48,7 +48,7 @@ CFBundleVersion - 4.0.57 + 4.0.58 FirebaseAppDelegateProxyEnabled NO GMSApiKey diff --git a/lib/controller/firebase/local_notification.dart b/lib/controller/firebase/local_notification.dart index 1995e43..f28f0c5 100644 --- a/lib/controller/firebase/local_notification.dart +++ b/lib/controller/firebase/local_notification.dart @@ -174,22 +174,11 @@ class NotificationController extends GetxController { // display a dialog with the notification details, tap ok to go to another page } } -// import 'package:flutter_local_notifications/flutter_local_notifications.dart'; -// import 'package:get/get.dart'; -// import 'package:timezone/data/latest.dart' as tz; -// import 'package:timezone/timezone.dart' as tz; // class NotificationController extends GetxController { // final FlutterLocalNotificationsPlugin _flutterLocalNotificationsPlugin = // FlutterLocalNotificationsPlugin(); -// @override -// void onInit() { -// super.onInit(); -// initNotifications(); -// tz.initializeTimeZones(); -// } - // // Initializes the local notifications plugin // Future initNotifications() async { // const AndroidInitializationSettings android = @@ -212,29 +201,4 @@ class NotificationController extends GetxController { // NotificationDetails details = NotificationDetails(android: android); // await _flutterLocalNotificationsPlugin.show(0, title, message, details); // } - -// // Schedules a notification for a specific time -// Future scheduleNotification( -// String title, String body, DateTime scheduledTime) async { -// await _flutterLocalNotificationsPlugin.zonedSchedule( -// 0, -// title, -// body, -// tz.TZDateTime.from(scheduledTime, tz.local), -// const NotificationDetails( -// android: AndroidNotificationDetails( -// 'your_channel_id', -// 'your_channel_name', -// channelDescription: 'your_channel_description', -// importance: Importance.max, -// priority: Priority.high, -// showWhen: false, -// ), -// ), -// androidAllowWhileIdle: true, -// uiLocalNotificationDateInterpretation: -// UILocalNotificationDateInterpretation.absoluteTime, -// matchDateTimeComponents: DateTimeComponents.time, -// ); -// } // } diff --git a/lib/controller/local/translations.dart b/lib/controller/local/translations.dart index b6d2ee3..b6f6a15 100644 --- a/lib/controller/local/translations.dart +++ b/lib/controller/local/translations.dart @@ -4,6 +4,8 @@ class MyTranslation extends Translations { @override Map> get keys => { "ar": { + 'If you need any help or have questions, this is the right place to do that. You are welcome!': + 'إذا كنت بحاجة إلى أي مساعدة أو لديك أي أسئلة، فهذا هو المكان المناسب لذلك. أهلاً وسهلاً بك!', 'ID Mismatch': "عدم تطابق الرقم التعريفي", "face detect": "كشف الوجه", 'An error occurred while saving driver data': diff --git a/lib/controller/notification/notification_captain_controller.dart b/lib/controller/notification/notification_captain_controller.dart index d29650b..f43c755 100644 --- a/lib/controller/notification/notification_captain_controller.dart +++ b/lib/controller/notification/notification_captain_controller.dart @@ -41,7 +41,7 @@ class NotificationCaptainController extends GetxController { updateNotification(String id) async { await CRUD().post( link: AppLink.updateNotificationCaptain, - payload: {'isShown': true, 'id': id}, + payload: {'isShown': 'true', 'id': id}, ); } diff --git a/lib/controller/notification/ride_available_controller.dart b/lib/controller/notification/ride_available_controller.dart index ae18a51..578d3dd 100644 --- a/lib/controller/notification/ride_available_controller.dart +++ b/lib/controller/notification/ride_available_controller.dart @@ -5,6 +5,7 @@ import 'package:SEFER/views/widgets/elevated_btn.dart'; import 'package:get/get.dart'; import '../../constant/links.dart'; +import '../../views/widgets/mydialoug.dart'; import '../functions/crud.dart'; class RideAvailableController extends GetxController { @@ -18,16 +19,20 @@ class RideAvailableController extends GetxController { isLoading = false; update(); } else { - Get.defaultDialog( - title: "No Rides Available".tr, - middleText: '', - titleStyle: AppStyle.title, - confirm: MyElevatedButton( - title: 'Ok'.tr, - onPressed: () { - Get.back(); - Get.back(); - })); + MyDialog().getDialog("No Rides Available".tr, '', () { + Get.back(); + Get.back(); + }); + // Get.defaultDialog( + // title: "No Rides Available".tr, + // middleText: '', + // titleStyle: AppStyle.title, + // confirm: MyElevatedButton( + // title: 'Ok'.tr, + // onPressed: () { + // Get.back(); + // Get.back(); + // })); } } diff --git a/lib/main.dart b/lib/main.dart index f52411e..f1cc48a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -107,6 +107,8 @@ void main() async { WidgetsFlutterBinding.ensureInitialized(); await WakelockPlus.enable(); + await GetStorage.init(); + Stripe.publishableKey = AK.publishableKeyStripe; // Request location permission // PermissionStatus status = await Permission.location.request(); // if (status.isDenied) { @@ -120,9 +122,6 @@ void main() async { await LocationController().startLocationUpdates(); } - await GetStorage.init(); - Stripe.publishableKey = AK.publishableKeyStripe; - if (Platform.isAndroid || Platform.isIOS) { await Firebase.initializeApp( options: DefaultFirebaseOptions.currentPlatform, diff --git a/lib/views/auth/captin/cards/sms_signup.dart b/lib/views/auth/captin/cards/sms_signup.dart index 0fe84f2..889315a 100644 --- a/lib/views/auth/captin/cards/sms_signup.dart +++ b/lib/views/auth/captin/cards/sms_signup.dart @@ -25,7 +25,7 @@ class SmsSignupEgypt extends StatelessWidget { Padding( padding: const EdgeInsets.only(bottom: 20.0), child: Image.asset( - 'assets/images/logo.png', // Make sure you have a logo image in your assets folder + 'assets/images/logo.gif', // Make sure you have a logo image in your assets folder height: 100, ), ), @@ -91,13 +91,16 @@ class SmsSignupEgypt extends StatelessWidget { // Submit button registerCaptainController.isLoading ? const MyCircularProgressIndicator() - : MyElevatedButton( - onPressed: () async { - !registerCaptainController.isSent - ? await registerCaptainController.sendOtpMessage() - : await registerCaptainController.verifySMSCode(); - }, - title: 'Submit'.tr, + : Padding( + padding: const EdgeInsets.all(16.0), + child: MyElevatedButton( + onPressed: () async { + !registerCaptainController.isSent + ? await registerCaptainController.sendOtpMessage() + : await registerCaptainController.verifySMSCode(); + }, + title: 'Submit'.tr, + ), ), ], ); diff --git a/lib/views/auth/captin/invite_driver_screen.dart b/lib/views/auth/captin/invite_driver_screen.dart index 1ca92be..8775d63 100644 --- a/lib/views/auth/captin/invite_driver_screen.dart +++ b/lib/views/auth/captin/invite_driver_screen.dart @@ -1,169 +1,191 @@ import 'package:SEFER/constant/box_name.dart'; import 'package:SEFER/constant/colors.dart'; -import 'package:SEFER/constant/style.dart'; import 'package:SEFER/main.dart'; -import 'package:SEFER/views/widgets/elevated_btn.dart'; -import 'package:SEFER/views/widgets/my_textField.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_contacts/contact.dart'; import 'package:get/get.dart'; import '../../../controller/auth/captin/invit_controller.dart'; -import '../../../print.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:get/get.dart'; + +import '../../widgets/elevated_btn.dart'; class InviteDriverScreen extends StatelessWidget { final InviteController controller = Get.put(InviteController()); @override Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar(title: Text('Invite a Driver'.tr)), - body: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "Invite another driver and both get a gift after he completes 100 trips!" - .tr, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), - const SizedBox(height: 20), - Row( - children: [ - Expanded( - child: MyTextForm( - controller: controller.invitePhoneController, - label: 'Enter driver\'s phone'.tr, - hint: 'Enter driver\'s phone'.tr, - type: TextInputType.phone, + return CupertinoPageScaffold( + navigationBar: CupertinoNavigationBar( + middle: Text('Invite a Driver'.tr), + leading: CupertinoNavigationBarBackButton( + onPressed: () => Get.back(), + ), + ), + child: SafeArea( + child: SingleChildScrollView( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "Invite another driver and both get a gift after he completes 100 trips!" + .tr, + style: CupertinoTheme.of(context).textTheme.navTitleTextStyle, + ), + const SizedBox(height: 20), + Row( + children: [ + Expanded( + child: CupertinoTextField( + controller: controller.invitePhoneController, + placeholder: 'Enter driver\'s phone'.tr, + keyboardType: TextInputType.phone, + ), ), - ), - IconButton( - icon: const Icon(Icons.contacts), - onPressed: () async { - await controller.pickContacts(); - if (controller.contacts.isNotEmpty) { - if (box.read(BoxName.IsSavedPhones) == null) { - controller.savePhoneToServer(); - box.write(BoxName.IsSavedPhones, true); + CupertinoButton( + child: const Icon(CupertinoIcons.person_2), + onPressed: () async { + await controller.pickContacts(); + if (controller.contacts.isNotEmpty) { + if (box.read(BoxName.IsSavedPhones) == null) { + controller.savePhoneToServer(); + box.write(BoxName.IsSavedPhones, true); + } + _showContactsDialog(context); } - Get.defaultDialog( - title: 'Choose from contact'.tr, - content: Column( - children: [ - SizedBox( - height: 300, - child: ListView.builder( - itemCount: controller.contactMaps.length, - itemBuilder: (context, index) { - final contact = controller.contactMaps[index]; - return InkWell( - onTap: () { - controller.selectPhone( - contact['phones'].toString()); - }, - child: ListTile( - title: Text(contact['name'].toString()), - subtitle: Text( - controller.formatPhoneNumber( - contact['phones'][0].toString())), - ), - ); + }, + ), + ], + ), + const SizedBox(height: 20), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + MyElevatedButton( + title: 'Send Invite'.tr, + onPressed: controller.sendInvite, + ), + MyElevatedButton( + title: 'Show Invitations'.tr, + onPressed: () async { + controller.fetchDriverStats(); + }, + ), + ], + ), + const SizedBox(height: 20), + GetBuilder( + builder: (controller) { + return SizedBox( + height: Get.height * .4, + child: controller.driverInvitationData.isEmpty + ? Center( + child: Text( + "No invitation found yet!".tr, + style: CupertinoTheme.of(context) + .textTheme + .navTitleTextStyle, + ), + ) + : ListView.builder( + itemCount: controller.driverInvitationData.length, + itemBuilder: (context, index) { + int countOfInvitDriver = int.tryParse(controller + .driverInvitationData[index] + ['countOfInvitDriver'] + ?.toString() ?? + '0') ?? + 0; + + double progressValue = countOfInvitDriver / 100.0; + progressValue = progressValue.clamp(0.0, 1.0); + + return GestureDetector( + onTap: () async { + controller.onSelectDriverInvitation(index); }, - ), - ), - ], - ), - ); - } - }, - ), - ], - ), - const SizedBox(height: 20), - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - MyElevatedButton( - title: 'Send Invite'.tr, - onPressed: controller.sendInvite, - ), - MyElevatedButton( - title: 'Show Invitations'.tr, - onPressed: () async { - controller.fetchDriverStats(); - }, - ), - ], - ), - const SizedBox(height: 20), - GetBuilder(builder: (controller) { - return SizedBox( - height: Get.height * .4, - child: controller.driverInvitationData.isEmpty - ? Center( - child: Text( - "No invitation found yet!".tr, - style: AppStyle.title, - ), - ) - : ListView.builder( - itemCount: controller.driverInvitationData.length, - itemBuilder: (context, index) { - int countOfInvitDriver = 0; - if (controller.driverInvitationData[index] - .containsKey('countOfInvitDriver')) { - countOfInvitDriver = int.tryParse(controller - .driverInvitationData[index] - ['countOfInvitDriver'] - .toString()) ?? - 0; - } - - double progressValue = countOfInvitDriver / 100.0; - if (progressValue > 1.0) progressValue = 1.0; - if (progressValue < 0.0) progressValue = 0.0; - - return InkWell( - onTap: () async { - controller.onSelectDriverInvitation(index); - }, - child: Container( - margin: const EdgeInsets.symmetric(vertical: 8.0), - child: Stack( - alignment: AlignmentDirectional.center, - children: [ - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: - AppColor.accentColor.withOpacity(.5), - ), - width: Get.width * .85, - child: ClipRRect( - borderRadius: BorderRadius.circular(12), - child: LinearProgressIndicator( - value: progressValue, - color: AppColor.blueColor, - backgroundColor: AppColor.accentColor - .withOpacity(.3), - minHeight: 35, + child: Container( + margin: + const EdgeInsets.symmetric(vertical: 8.0), + child: Stack( + alignment: AlignmentDirectional.center, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(12), + color: CupertinoColors.systemGrey5, + ), + width: Get.width * .85, + height: 35, + child: ClipRRect( + borderRadius: + BorderRadius.circular(12), + child: LinearProgressIndicator( + value: progressValue, + backgroundColor: + CupertinoColors.systemGrey3, + valueColor: + const AlwaysStoppedAnimation< + Color>( + CupertinoColors.activeBlue), + ), + ), ), - ), + Text( + '${controller.driverInvitationData[index]['invitorName']} ${countOfInvitDriver} / 100 ${'Trip'.tr}', + style: CupertinoTheme.of(context) + .textTheme + .textStyle, + ), + ], ), - Text( - '${controller.driverInvitationData[index]['invitorName']} ${controller.driverInvitationData[index]['countOfInvitDriver']} / 100 ${'Trip'.tr}', - ), - ], - ), - ), - ); - }, - ), - ); - }) - ], + ), + ); + }, + ), + ); + }, + ) + ], + ), + ), + ), + ); + } + + void _showContactsDialog(BuildContext context) { + showCupertinoModalPopup( + context: context, + builder: (BuildContext context) => CupertinoActionSheet( + title: Text('Choose from contact'.tr), + actions: [ + SizedBox( + height: 300, + child: CupertinoScrollbar( + child: ListView.builder( + itemCount: controller.contactMaps.length, + itemBuilder: (context, index) { + final contact = controller.contactMaps[index]; + return CupertinoActionSheetAction( + child: Text( + '${contact['name']} - ${controller.formatPhoneNumber(contact['phones'][0].toString())}'), + onPressed: () { + controller.selectPhone(contact['phones'].toString()); + // Navigator.pop(context); + }, + ); + }, + ), + ), + ), + ], + cancelButton: CupertinoActionSheetAction( + child: Text('Cancel'.tr), + onPressed: () { + Navigator.pop(context); + }, ), ), ); diff --git a/lib/views/home/Captin/history/history_captain.dart b/lib/views/home/Captin/history/history_captain.dart index 07a501a..a426b87 100644 --- a/lib/views/home/Captin/history/history_captain.dart +++ b/lib/views/home/Captin/history/history_captain.dart @@ -1,12 +1,10 @@ +import 'package:SEFER/views/widgets/mydialoug.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; -import '../../../../constant/colors.dart'; -import '../../../../constant/style.dart'; import '../../../../controller/auth/captin/history_captain.dart'; -import '../../../widgets/elevated_btn.dart'; -import '../../../widgets/my_scafold.dart'; -import '../../../widgets/mycircular.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:get/get.dart'; class HistoryCaptain extends StatelessWidget { const HistoryCaptain({super.key}); @@ -14,42 +12,57 @@ class HistoryCaptain extends StatelessWidget { @override Widget build(BuildContext context) { Get.put(HistoryCaptainController()); - return MyScafolld( - title: 'History Page'.tr, - body: [ - GetBuilder( - builder: (historyCaptainController) => historyCaptainController - .isloading - ? const MyCircularProgressIndicator() - : historyCaptainController.historyData['message'].length < 1 - ? Center( - child: Text( - 'No ride Yet.'.tr, - style: AppStyle.headTitle, - ), - ) - : ListView.builder( - itemCount: historyCaptainController - .historyData['message'].length, - itemBuilder: (BuildContext context, int index) { - var list = historyCaptainController - .historyData['message'][index]; - return InkWell( - onTap: () { - list['status'] != 'Cancel' - ? historyCaptainController - .getHistoryDetails(list['order_id']) - : Get.defaultDialog( - title: 'This Trip Cancelled'.tr, - middleText: '', - titleStyle: AppStyle.title, - confirm: MyElevatedButton( - title: 'Ok'.tr, - onPressed: () => Get.back())); - }, - child: Card( - child: Padding( - padding: const EdgeInsets.all(8.0), + return CupertinoPageScaffold( + navigationBar: CupertinoNavigationBar( + middle: Text('History Page'.tr), + leading: CupertinoNavigationBarBackButton( + onPressed: () => Get.back(), + ), + ), + child: SafeArea( + child: GetBuilder( + builder: (historyCaptainController) => historyCaptainController + .isloading + ? const Center(child: CupertinoActivityIndicator()) + : historyCaptainController.historyData['message'].length < 1 + ? Center( + child: Text( + 'No ride Yet.'.tr, + style: CupertinoTheme.of(context) + .textTheme + .navTitleTextStyle, + ), + ) + : ListView.builder( + itemCount: historyCaptainController + .historyData['message'].length, + itemBuilder: (BuildContext context, int index) { + var list = historyCaptainController + .historyData['message'][index]; + return Padding( + padding: const EdgeInsets.all(4.0), + child: Container( + decoration: BoxDecoration( + border: Border.all( + color: CupertinoColors.systemGrey, width: 1), + borderRadius: + const BorderRadius.all(Radius.circular(8.0)), + ), + child: CupertinoButton( + onPressed: () { + if (list['status'] != 'Cancel') { + historyCaptainController + .getHistoryDetails(list['order_id']); + } else { + MyDialog().getDialog( + 'This Trip Cancelled'.tr, + 'This Trip Cancelled'.tr, + () => Get.back(), + ); + } + }, + child: Container( + margin: const EdgeInsets.all(8), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -60,11 +73,15 @@ class HistoryCaptain extends StatelessWidget { children: [ Text( 'OrderId'.tr, - style: AppStyle.title, + style: CupertinoTheme.of(context) + .textTheme + .navTitleTextStyle, ), Text( list['order_id'], - style: AppStyle.subtitle, + style: CupertinoTheme.of(context) + .textTheme + .textStyle, ), ], ), @@ -74,34 +91,51 @@ class HistoryCaptain extends StatelessWidget { children: [ Text( 'created time'.tr, - style: AppStyle.title, + style: CupertinoTheme.of(context) + .textTheme + .navTitleTextStyle, ), Text( list['created_at'], - style: AppStyle.subtitle, + style: CupertinoTheme.of(context) + .textTheme + .textStyle, ), ], ), Text( list['status'], style: list['status'] == 'Apply' - ? AppStyle.title.copyWith( - color: AppColor.greenColor) + ? CupertinoTheme.of(context) + .textTheme + .navTitleTextStyle + .copyWith( + color: CupertinoColors + .systemGreen) : list['status'] == 'Refused' - ? AppStyle.title.copyWith( - color: AppColor.redColor) - : AppStyle.title.copyWith( - color: AppColor.yellowColor), + ? CupertinoTheme.of(context) + .textTheme + .navTitleTextStyle + .copyWith( + color: CupertinoColors + .systemRed) + : CupertinoTheme.of(context) + .textTheme + .navTitleTextStyle + .copyWith( + color: CupertinoColors + .systemYellow), ), ], ), ), ), - ); - }, - )) - ], - isleading: true, + ), + ); + }, + ), + ), + ), ); } } diff --git a/lib/views/home/Captin/history/history_details_page.dart b/lib/views/home/Captin/history/history_details_page.dart index c035baa..38e1ace 100644 --- a/lib/views/home/Captin/history/history_details_page.dart +++ b/lib/views/home/Captin/history/history_details_page.dart @@ -1,204 +1,238 @@ import 'package:SEFER/controller/functions/location_controller.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; -import 'package:SEFER/constant/colors.dart'; -import 'package:SEFER/constant/style.dart'; import 'package:SEFER/controller/auth/captin/history_captain.dart'; import 'package:SEFER/controller/functions/launch.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; -import '../../../widgets/mycircular.dart'; +import 'package:flutter/cupertino.dart'; class HistoryDetailsPage extends StatelessWidget { HistoryDetailsPage({super.key}); HistoryCaptainController historyCaptainController = Get.put(HistoryCaptainController()); + @override Widget build(BuildContext context) { - return MyScafolld( - title: 'Trip Detail'.tr, - body: [ - GetBuilder( - builder: (historyCaptainController) { + return CupertinoPageScaffold( + navigationBar: CupertinoNavigationBar( + middle: Text('Trip Detail'.tr), + leading: CupertinoButton( + padding: EdgeInsets.zero, + child: const Icon(CupertinoIcons.back), + onPressed: () => Navigator.pop(context), + ), + ), + child: GetBuilder( + builder: (historyCaptainController) { var res = historyCaptainController.historyDetailsData['data']; return historyCaptainController.isloading - ? const MyCircularProgressIndicator() - : SingleChildScrollView( - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - width: Get.width * .8, - decoration: BoxDecoration( - border: Border.all( - color: AppColor.blueColor, width: 2)), - child: TextButton( + ? const Center( + child: CupertinoActivityIndicator(), + ) + : CupertinoScrollbar( + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const SizedBox( + height: 20, + ), + CupertinoButton( onPressed: () { String mapUrl = 'https://www.google.com/maps/dir/${res['start_location']}/${res['end_location']}/'; showInBrowser(mapUrl); }, - child: Column( - children: [ - SizedBox( - height: Get.height * .2, - width: Get.width * .75, - child: GoogleMap( - initialCameraPosition: CameraPosition( - target: Get.find() - .myLocation, // Assuming passenger location is available - tilt: 80, zoom: 13, - ), - zoomControlsEnabled: true, - // liteModeEnabled: true, - polylines: { - Polyline( - zIndex: 2, - consumeTapEvents: true, - geodesic: true, - endCap: Cap.buttCap, - startCap: Cap.buttCap, - visible: true, - polylineId: const PolylineId('route'), - points: [ - LatLng( - double.parse(res['start_location'] - .toString() - .split(',')[0]), - double.parse(res['start_location'] - .toString() - .split(',')[1]), - ), - LatLng( - double.parse(res['end_location'] - .toString() - .split(',')[0]), - double.parse(res['end_location'] - .toString() - .split(',')[1]), - ) - ], - color: AppColor.primaryColor, - width: 5, - ), - }, + child: Container( + width: MediaQuery.of(context).size.width * 0.9, + padding: const EdgeInsets.all(12.0), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12.0), + border: Border.all( + color: CupertinoColors.activeBlue, + width: 2), + ), + child: Column( + children: [ + const SizedBox( + height: 20, ), - ), - const SizedBox( - height: 10, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - children: [ - Text( - '${'Order ID'.tr} ${res['id']}', - style: AppStyle.title, + SizedBox( + height: MediaQuery.of(context).size.height * + 0.3, + child: GoogleMap( + initialCameraPosition: CameraPosition( + target: Get.find() + .myLocation, + tilt: 80, + zoom: 13, + ), + zoomControlsEnabled: true, + polylines: { + Polyline( + polylineId: const PolylineId('route'), + points: [ + LatLng( + double.parse(res['start_location'] + .toString() + .split(',')[0]), + double.parse(res['start_location'] + .toString() + .split(',')[1]), + ), + LatLng( + double.parse(res['end_location'] + .toString() + .split(',')[0]), + double.parse(res['end_location'] + .toString() + .split(',')[1]), + ) + ], + color: CupertinoColors.activeGreen, + width: 5, + ), + }, ), - Text( - res['date'].toString(), - style: AppStyle.title, - ), - ], + ), + const SizedBox(height: 10), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + '${'Order ID'.tr} ${res['id']}', + style: CupertinoTheme.of(context) + .textTheme + .navActionTextStyle, + ), + Text( + res['date'].toString(), + style: CupertinoTheme.of(context) + .textTheme + .navActionTextStyle, + ), + ], + ), + ], + ), + ), + ), + const SizedBox(height: 20), + Container( + width: MediaQuery.of(context).size.width * 0.9, + padding: const EdgeInsets.all(12.0), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12.0), + border: Border.all( + color: CupertinoColors.activeGreen, width: 2), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + '${'Price is'.tr} ${res['price_for_driver']}', + style: CupertinoTheme.of(context) + .textTheme + .textStyle, + ), + Text( + '${'Distance is'.tr} ${res['distance']} KM', + style: CupertinoTheme.of(context) + .textTheme + .textStyle, ), ], ), ), - ), - const SizedBox( - height: 10, - ), - Container( - width: Get.width * .8, - decoration: BoxDecoration( - border: Border.all( - color: AppColor.greenColor, width: 2)), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Text( - '${'Price is'.tr} ${res['price_for_driver']}', - style: AppStyle.title, - ), - Text( - '${'Distance is'.tr} ${res['distance']} KM', - style: AppStyle.title, - ), - ], + const SizedBox(height: 20), + Text( + 'Times of Trip'.tr, + style: CupertinoTheme.of(context) + .textTheme + .navTitleTextStyle, ), - ), - const SizedBox( - height: 10, - ), - Text( - 'Times of Trip'.tr, - style: AppStyle.title, - ), - const SizedBox( - height: 10, - ), - Container( - width: Get.width * .8, - decoration: BoxDecoration( + const SizedBox(height: 10), + Container( + width: MediaQuery.of(context).size.width * 0.9, + padding: const EdgeInsets.all(12.0), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12.0), border: Border.all( - color: AppColor.redColor, width: 2)), - child: Column( - children: [ - Text( - '${'Time to Passenger is'.tr} ${res['DriverIsGoingToPassenger']}', - style: AppStyle.title, - ), - Text( - '${'TimeStart is'.tr} ${res['rideTimeStart']}', - style: AppStyle.title, - ), - Text( - '${'Time Finish is'.tr} ${res['rideTimeFinish']}', - style: AppStyle.title, - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - Container( - width: Get.width * .8, - decoration: BoxDecoration( - border: Border.all( - color: AppColor.greenColor, width: 2)), - child: Center( - child: Text( - '${'Passenger Name is'.tr} ${res['first_name']} ${res['last_name']} ', - style: AppStyle.title, + color: CupertinoColors.destructiveRed, + width: 2), + ), + child: Column( + children: [ + Text( + '${'Time to Passenger is'.tr} ${res['DriverIsGoingToPassenger']}', + style: CupertinoTheme.of(context) + .textTheme + .textStyle, + ), + Text( + '${'TimeStart is'.tr} ${res['rideTimeStart']}', + style: CupertinoTheme.of(context) + .textTheme + .textStyle, + ), + Text( + '${'Time Finish is'.tr} ${res['rideTimeFinish']}', + style: CupertinoTheme.of(context) + .textTheme + .textStyle, + ), + ], ), ), - ), - const SizedBox( - height: 10, - ), - Container( - width: Get.width * .8, - decoration: BoxDecoration( + const SizedBox(height: 20), + Container( + width: MediaQuery.of(context).size.width * 0.9, + padding: const EdgeInsets.all(12.0), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12.0), border: Border.all( - color: AppColor.yellowColor, width: 2)), - child: Center( - child: Text( - '${'Status is'.tr} ${res['status']}', - style: AppStyle.title, + color: CupertinoColors.systemGreen, width: 2), + ), + child: Center( + child: Text( + '${'Passenger Name is'.tr} ${res['first_name']} ${res['last_name']}', + style: CupertinoTheme.of(context) + .textTheme + .textStyle, + ), ), ), - ), - ], + const SizedBox(height: 20), + Container( + width: MediaQuery.of(context).size.width * 0.9, + padding: const EdgeInsets.all(12.0), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12.0), + border: Border.all( + color: CupertinoColors.systemYellow, + width: 2), + ), + child: Center( + child: Text( + '${'Status is'.tr} ${res['status']}', + style: CupertinoTheme.of(context) + .textTheme + .textStyle, + ), + ), + ), + ], + ), ), ), ); - }) - ], - isleading: true, + }, + ), ); } } diff --git a/lib/views/home/Captin/home_captain/drawer_captain.dart b/lib/views/home/Captin/home_captain/drawer_captain.dart index 14b8d68..8b5fff8 100644 --- a/lib/views/home/Captin/home_captain/drawer_captain.dart +++ b/lib/views/home/Captin/home_captain/drawer_captain.dart @@ -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().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().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(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( + 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().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().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) {}, + ), + ), + ], + ), + ], + ), ); } } diff --git a/lib/views/home/Captin/home_captain/help_captain.dart b/lib/views/home/Captin/home_captain/help_captain.dart index 246f370..3d7181e 100644 --- a/lib/views/home/Captin/home_captain/help_captain.dart +++ b/lib/views/home/Captin/home_captain/help_captain.dart @@ -1,13 +1,9 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; -import 'package:SEFER/constant/colors.dart'; -import 'package:SEFER/constant/style.dart'; import 'package:SEFER/controller/home/captin/help/help_controller.dart'; import 'package:SEFER/views/home/Captin/home_captain/help_details_replay_page.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; -import '../../../widgets/elevated_btn.dart'; -import '../../../widgets/mycircular.dart'; +import 'package:flutter/cupertino.dart'; class HelpCaptain extends StatelessWidget { HelpCaptain({super.key}); @@ -15,152 +11,159 @@ class HelpCaptain extends StatelessWidget { @override Widget build(BuildContext context) { Get.put(HelpController()); - return MyScafolld( - title: 'Helping Page'.tr, - body: [ - Column( - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - decoration: AppStyle.boxDecoration1, - child: Padding( - padding: const EdgeInsets.all(8.0), + return CupertinoPageScaffold( + navigationBar: CupertinoNavigationBar( + middle: Text('Helping Page'.tr), + leading: CupertinoButton( + padding: EdgeInsets.zero, + child: Icon(CupertinoIcons.back), + onPressed: () => Navigator.pop(context), + ), + ), + child: SafeArea( + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + children: [ + Padding( + padding: const EdgeInsets.symmetric(vertical: 12.0), + child: Container( + padding: const EdgeInsets.all(16.0), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12.0), + border: Border.all( + color: CupertinoColors.systemGrey2, + ), + ), child: Text( - 'If you need any help or have question this is right site to do that and your welcome' + 'If you need any help or have questions, this is the right place to do that. You are welcome!' .tr, - style: AppStyle.title, + style: CupertinoTheme.of(context).textTheme.textStyle, + textAlign: TextAlign.center, ), ), ), - ), - Card( + Card( elevation: 3, - color: AppColor.secondaryColor, + color: CupertinoColors.systemGrey6, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12.0), + ), child: Padding( - padding: const EdgeInsets.all(8.0), + padding: const EdgeInsets.all(16.0), child: GetBuilder( builder: (helpController) => Form( - key: helpController.formKey, - child: Column( - children: [ - SizedBox( - width: Get.width * .8, - child: TextFormField( - controller: - helpController.helpQuestionController, - decoration: InputDecoration( - border: const OutlineInputBorder(), - hintText: 'Enter your Question here'.tr, - labelText: 'Question'.tr, - ), - validator: (value) { - if (value == null || value.isEmpty) { - return 'Please enter your Question.'.tr; - } - return null; - }, + key: helpController.formKey, + child: Column( + children: [ + CupertinoTextField( + controller: helpController.helpQuestionController, + placeholder: 'Enter your Question here'.tr, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + border: Border.all( + color: CupertinoColors.systemGrey, ), ), - const SizedBox(height: 20), - helpController.isLoading - ? const MyCircularProgressIndicator() - : MyElevatedButton( - onPressed: () { - if (helpController.formKey.currentState! - .validate()) { - helpController.addHelpQuestion(); + padding: const EdgeInsets.all(16), + clearButtonMode: OverlayVisibilityMode.editing, + ), + const SizedBox(height: 20), + helpController.isLoading + ? const CupertinoActivityIndicator() + : CupertinoButton.filled( + onPressed: () { + if (helpController.formKey.currentState! + .validate()) { + helpController.addHelpQuestion(); - // Clear the feedback form - helpController.formKey.currentState! - .reset(); - } - }, - title: 'Submit Question'.tr, - ), - ], - )), + // Clear the feedback form + helpController.formKey.currentState! + .reset(); + } + }, + child: Text('Submit Question'.tr), + ), + ], + ), + ), ), - )), - GetBuilder( - builder: (helpController) => Padding( - padding: const EdgeInsets.all(10), - child: Container( - height: Get.height * .45, - decoration: AppStyle.boxDecoration, - child: ListView.builder( - itemCount: - helpController.helpQuestionDate['message'] != null - ? helpController - .helpQuestionDate['message'].length - : 0, - itemBuilder: (BuildContext context, int index) { - // if (helpController.helpQuestionDate['message'] == - // null) { - // return const CircularProgressIndicator(); - // } - var list = helpController - .helpQuestionDate['message'][index]; - return helpController - .helpQuestionDate['message'].length == - 0 - ? SizedBox() - : Padding( - padding: const EdgeInsets.all(3), - child: Container( - decoration: BoxDecoration( - border: Border.all( - color: AppColor.greenColor, - width: 3, - ), - borderRadius: - BorderRadius.circular(11)), - // elevation: 3, - // color: AppColor.greenColor, - child: GestureDetector( - onTap: () { - helpController.getIndex( - list['id'], list['helpQuestion']); - helpController.getHelpRepley( - list['id'].toString()); - Get.to( - () => const HelpDetailsReplayPage(), - ); - }, - child: Padding( - padding: const EdgeInsets.all(2), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - SizedBox( - width: Get.width * .6, - child: Text( - list['helpQuestion'], - style: AppStyle.title, - ), - ), - SizedBox( - width: Get.width * .3, - child: Text( - list['datecreated'], - style: AppStyle.subtitle, - ), - ), - ], - ), - ), + ), + ), + const SizedBox(height: 20), + Expanded( + child: GetBuilder( + builder: (helpController) => Padding( + padding: const EdgeInsets.all(10), + child: Container( + decoration: BoxDecoration( + border: Border.all( + color: CupertinoColors.systemGrey2, + ), + borderRadius: BorderRadius.circular(12.0), + ), + child: ListView.builder( + itemCount: helpController.helpQuestionDate['message'] != + null + ? helpController.helpQuestionDate['message'].length + : 0, + itemBuilder: (BuildContext context, int index) { + var list = + helpController.helpQuestionDate['message'][index]; + return Padding( + padding: const EdgeInsets.all(3), + child: Container( + padding: const EdgeInsets.symmetric( + vertical: 12, horizontal: 16), + decoration: BoxDecoration( + border: Border.all( + color: CupertinoColors.activeGreen, + width: 2, + ), + borderRadius: BorderRadius.circular(12), + ), + child: GestureDetector( + onTap: () { + helpController.getIndex( + list['id'], list['helpQuestion']); + helpController + .getHelpRepley(list['id'].toString()); + Get.to(() => const HelpDetailsReplayPage()); + }, + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Text( + list['helpQuestion'], + style: CupertinoTheme.of(context) + .textTheme + .textStyle, + overflow: TextOverflow.ellipsis, ), ), - ); - }, - ), + Text( + list['datecreated'], + style: CupertinoTheme.of(context) + .textTheme + .tabLabelTextStyle, + ), + ], + ), + ), + ), + ); + }, ), - )), - ], + ), + ), + ), + ), + ], + ), ), - ], - isleading: true, + ), ); } } diff --git a/lib/views/home/Captin/home_captain/home_captin.dart b/lib/views/home/Captin/home_captain/home_captin.dart index fe39a41..1b9cab8 100644 --- a/lib/views/home/Captin/home_captain/home_captin.dart +++ b/lib/views/home/Captin/home_captain/home_captin.dart @@ -67,7 +67,7 @@ class HomeCaptain extends StatelessWidget { // ), ], ), - drawer: DrawerCaptain(), + drawer: CupertinoDrawerCaptain(), body: Stack( children: [ GetBuilder( diff --git a/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart b/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart index 8821893..94c1764 100644 --- a/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart +++ b/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart @@ -1,4 +1,5 @@ import 'package:SEFER/constant/box_name.dart'; +import 'package:SEFER/controller/firebase/local_notification.dart'; import 'package:SEFER/main.dart'; import 'package:SEFER/views/auth/captin/cards/egypt_card_a_i.dart'; import 'package:SEFER/views/auth/captin/cards/sms_signup.dart'; @@ -219,13 +220,14 @@ GetBuilder leftMainMenuCaptainIcons() { // 'Order'.tr, // 'from: ', // // jsonDecode(value)['message'].toString(), - // // 'd3JaCCFAQeu8QTxRnlC1sB:APA91bFuRjbVK32obIFYXFTI4iwsZEPrrgwvPouob2bXivID-W4aXz51J_OIJ2nHpNU2ocOvGLD1Ip65rLViAFx5qHVE-c8FabBwBi5fSQ-lDTQfe36xxKsc9DU-sTyj_FoYrrMnLNVi', - // 'dN7B10MgQKOR13R5wnBqTN:APA91bHAlcfrOhxXdMYB8akJeeJzQ4lxfx7UhOpP0dcjGtRdKXSD9x6jiEoz6ULnQK5Hc030_VRUAV6Q8qGj-RmlbLAm4wppc4gv_Ri4oEbHHwONP5c41-341YkVqsFYTCRaHz7VpUoj', + // 'dUEVBJDPQfKiMuGgDjdyfX:APA91bE3DKYAYs3LIxGmzy55-ojLAZWv0ym4a9Zy9UxdkyRUOgQP8bf1WwU9LJAof0DjfaIxciVYPnue7EdwhujzQe67SImfOF9yI1YgGsKLDH6yo6FsFaAYpsbrSCqlaoRp14lLqymi', // d, // 'order.wav'); - // try {} catch (e) { - // print('Error showing overlay: $e'); - // } + // // NotificationController() + // // .showNotification('VIP Order'.tr, '', 'order', ''); + // // try {} catch (e) { + // // print('Error showing overlay: $e'); + // // } // // final Bubble _bubble = Bubble(showCloseButton: true); // // try { // // await _bubble.startBubbleHead(sendAppToBackground: false); @@ -254,7 +256,7 @@ GetBuilder leftMainMenuCaptainIcons() { // ); // }), // ), - // // AnimatedContainer( + // AnimatedContainer( // duration: const Duration(microseconds: 200), // width: controller.widthMapTypeAndTraffic, // decoration: BoxDecoration( @@ -264,16 +266,16 @@ GetBuilder leftMainMenuCaptainIcons() { // child: Builder(builder: (context) { // return IconButton( // onPressed: () async { - // // FirebaseMessagesController().sendNotificationToAnyWithoutData( - // // 'Order'.tr, - // // 'from: ', - // // // jsonDecode(value)['message'].toString(), - // // 'dEugS-JOT4Ka5riF4s5TEN:APA91bEDL_W7BuEQGbyL-RMaKiMWDlURXhFuaybe5WurTUV8K5eIooSGe22yY22_U2hEZcfPr46ig1v--l00dbOGiivazxvmTyhUyQQW6lJsuIN-wordGtBxtREyeYtEKvxIa1J4ApEu', - // // 'order.wav' + // FirebaseMessagesController().sendNotificationToAnyWithoutData( + // 'Order'.tr, + // 'from: ', + // // jsonDecode(value)['message'].toString(), + // 'dEugS-JOT4Ka5riF4s5TEN:APA91bEDL_W7BuEQGbyL-RMaKiMWDlURXhFuaybe5WurTUV8K5eIooSGe22yY22_U2hEZcfPr46ig1v--l00dbOGiivazxvmTyhUyQQW6lJsuIN-wordGtBxtREyeYtEKvxIa1J4ApEu', + // 'order.wav' - // // // polylineCoordinates.toString() - // // ); - // Get.to(SmsSignupEgypt()); + // // polylineCoordinates.toString() + // ); + // // Get.to(SmsSignupEgypt()); // // print(AppLink.addDriverPaymentPoints); // }, // icon: const Icon( diff --git a/lib/views/notification/available_rides_page.dart b/lib/views/notification/available_rides_page.dart index 8fbe8c2..0bbae68 100644 --- a/lib/views/notification/available_rides_page.dart +++ b/lib/views/notification/available_rides_page.dart @@ -7,6 +7,7 @@ import 'package:SEFER/controller/notification/ride_available_controller.dart'; import 'package:SEFER/views/widgets/elevated_btn.dart'; import 'package:SEFER/views/widgets/my_scafold.dart'; import 'package:SEFER/views/widgets/mycircular.dart'; +import 'package:SEFER/views/widgets/mydialoug.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; @@ -119,20 +120,26 @@ class AvailableRidesPage extends StatelessWidget { // .then((value) { // var json = jsonDecode(res); if (res == "failure") { - Get.defaultDialog( - title: - "This ride is already taken by another driver." - .tr, - middleText: '', - titleStyle: AppStyle.title, - middleTextStyle: AppStyle.title, - confirm: MyElevatedButton( - title: 'Ok'.tr, - onPressed: () { - Get.back(); - // Get.back(); - // Get.back(); - })); + MyDialog().getDialog( + "This ride is already taken by another driver." + .tr, + '', () { + Get.back(); + }); + // Get.defaultDialog( + // title: + // "This ride is already taken by another driver." + // .tr, + // middleText: '', + // titleStyle: AppStyle.title, + // middleTextStyle: AppStyle.title, + // confirm: MyElevatedButton( + // title: 'Ok'.tr, + // onPressed: () { + // Get.back(); + // // Get.back(); + // // Get.back(); + // })); } else if (jsonDecode(res)['status'] == "success") { List bodyToPassenger = [ diff --git a/lib/views/notification/notification_captain.dart b/lib/views/notification/notification_captain.dart index b2aa8e4..6ede68d 100644 --- a/lib/views/notification/notification_captain.dart +++ b/lib/views/notification/notification_captain.dart @@ -1,77 +1,88 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; -import 'package:SEFER/constant/style.dart'; import 'package:SEFER/controller/notification/notification_captain_controller.dart'; -import 'package:SEFER/views/widgets/elevated_btn.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; -import 'package:SEFER/views/widgets/mycircular.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:get/get.dart'; class NotificationCaptain extends StatelessWidget { - const NotificationCaptain({super.key}); + const NotificationCaptain({Key? key}) : super(key: key); + @override Widget build(BuildContext context) { Get.put(NotificationCaptainController()); - return MyScafolld( - title: 'Notifications'.tr, - body: [ - GetBuilder( - builder: (notificationCaptainController) => - notificationCaptainController.isLoading - ? const MyCircularProgressIndicator() - : SafeArea( - child: ListView.builder( - itemCount: notificationCaptainController - .notificationData['message'].length, - itemBuilder: (BuildContext context, int index) { - if (notificationCaptainController - .notificationData['message'] == - "No notification data found") { - Get.defaultDialog(); - } - var res = notificationCaptainController - .notificationData['message'][index]; - return Card( - elevation: 4, - child: ListTile( - onTap: () { - Get.defaultDialog( - title: res['title'], - titleStyle: AppStyle.title.copyWith( - fontWeight: FontWeight.bold), - content: SizedBox( - width: Get.width * .8, - height: Get.height * .4, - child: Text( - res['body'], - style: AppStyle.subtitle, - ), - ), - confirm: MyElevatedButton( - title: 'Ok', - onPressed: () { - //todo sql readen - notificationCaptainController - .updateNotification(res['id']); - })); - }, - leading: - const Icon(Icons.notification_important), - title: Text( - res['title'], - style: AppStyle.title, - ), - subtitle: Text( - res['body'], - style: AppStyle.subtitle, - ), - ), + return CupertinoPageScaffold( + navigationBar: CupertinoNavigationBar( + middle: Text('Notifications'.tr), + leading: CupertinoNavigationBarBackButton( + onPressed: () => Get.back(), + ), + ), + child: SafeArea( + child: GetBuilder( + builder: (notificationCaptainController) => + notificationCaptainController.isLoading + ? const Center(child: CupertinoActivityIndicator()) + : ListView.builder( + itemCount: notificationCaptainController + .notificationData['message'].length, + itemBuilder: (BuildContext context, int index) { + if (notificationCaptainController + .notificationData['message'] == + "No notification data found") { + _showCupertinoDialog(context, 'No Notifications', + 'There are no notifications at this time.'); + return const SizedBox.shrink(); + } + var res = notificationCaptainController + .notificationData['message'][index]; + return CupertinoListTile( + leading: const Icon(CupertinoIcons.bell_fill), + title: Text( + res['title'], + style: + CupertinoTheme.of(context).textTheme.textStyle, + ), + subtitle: Text( + res['body'], + style: CupertinoTheme.of(context) + .textTheme + .tabLabelTextStyle, + ), + onTap: () { + _showCupertinoDialog( + context, + res['title'], + res['body'], + onConfirm: () { + notificationCaptainController + .updateNotification(res['id'].toString()); + Navigator.of(context).pop(); + }, ); }, - ), - )) - ], - isleading: true, + ); + }, + ), + ), + ), + ); + } + + void _showCupertinoDialog(BuildContext context, String title, String content, + {VoidCallback? onConfirm}) { + showCupertinoDialog( + context: context, + builder: (BuildContext context) => CupertinoAlertDialog( + title: Text(title), + content: Text(content), + actions: [ + CupertinoDialogAction( + child: const Text('OK'), + onPressed: onConfirm ?? () => Navigator.of(context).pop(), + ), + ], + ), ); } }