From 6a3865a3d1d590e471c5026efa200217796a4f4d Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Fri, 18 Aug 2023 22:59:16 +0300 Subject: [PATCH] 8-18/1 --- lib/constant/links.dart | 9 + lib/controller/auth/login_controller.dart | 1 + lib/controller/auth/register_controller.dart | 3 +- lib/controller/home/map_page_controller.dart | 62 ++++- lib/views/home/home_page.dart | 2 +- lib/views/home/map_page.dart | 28 ++- .../buttom_sheet_map_show.dart | 217 ++++++++++++++---- .../map_widget.dart/cancel_raide_page.dart | 87 +++++++ .../cash_confirm_bottom_page.dart | 123 ++++++++++ .../map_widget.dart/main_bottom_Menu_map.dart | 175 +++++++------- .../map_widget.dart/payment_method.page.dart | 87 +++++++ lib/views/widgets/circle_container.dart | 4 +- 12 files changed, 657 insertions(+), 141 deletions(-) create mode 100644 lib/views/home/map_widget.dart/cancel_raide_page.dart create mode 100644 lib/views/home/map_widget.dart/cash_confirm_bottom_page.dart create mode 100644 lib/views/home/map_widget.dart/payment_method.page.dart diff --git a/lib/constant/links.dart b/lib/constant/links.dart index 92586f8..81aad12 100644 --- a/lib/constant/links.dart +++ b/lib/constant/links.dart @@ -7,6 +7,15 @@ class AppLink { static const String getTokens = "$server/ride/firebase/get.php"; static const String addTokens = "$server/ride/firebase/add.php"; + //=======================ride=================== + static const String ride = '$server/ride/'; + static const String addCancelRide = "$server/ride/addCancelRide.php"; +//-----------------ridessss------------------ + static const String addRides = "$ride/rides/add.php"; + static const String getRides = "$ride/rides/get.php"; + static const String updateRides = "$ride/rides/update.php"; + static const String deleteRides = "$ride/rides/delete.php"; + static const String pathImage = "$server/upload/types/"; static const String uploadImage = "$server/uploadImage.php"; static const String uploadImageType = "$server/uploadImageType.php"; diff --git a/lib/controller/auth/login_controller.dart b/lib/controller/auth/login_controller.dart index 1144149..b317cd5 100644 --- a/lib/controller/auth/login_controller.dart +++ b/lib/controller/auth/login_controller.dart @@ -63,6 +63,7 @@ class LoginController extends GetxController { if (jsonDecoeded['data'][0]['verified'] == 1) { box.write(BoxName.pasengerID, jsonDecoeded['data'][0]['id']); box.write(BoxName.email, jsonDecoeded['data'][0]['email']); + box.write(BoxName.name, jsonDecoeded['data'][0]['first_name']); box.write(BoxName.phone, jsonDecoeded['data'][0]['phone']); saveData(BoxName.passwoerd, passwordController.text); Get.offAll(() => MapPage()); diff --git a/lib/controller/auth/register_controller.dart b/lib/controller/auth/register_controller.dart index cd995fc..331ba65 100644 --- a/lib/controller/auth/register_controller.dart +++ b/lib/controller/auth/register_controller.dart @@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:ride/constant/links.dart'; import 'package:ride/controller/functions/crud.dart'; +import 'package:ride/views/auth/login_page.dart'; import 'package:ride/views/home/map_page.dart'; import '../../views/auth/verify_email_page.dart'; @@ -63,7 +64,7 @@ class RegisterController extends GetxController { }); if (jsonDecode(res)['status'] == 'success') { - Get.offAll(() => const MapPage()); + Get.offAll(() => LoginPage()); } } diff --git a/lib/controller/home/map_page_controller.dart b/lib/controller/home/map_page_controller.dart index 5dc6a9a..8cbb9c4 100644 --- a/lib/controller/home/map_page_controller.dart +++ b/lib/controller/home/map_page_controller.dart @@ -5,11 +5,14 @@ import 'package:get/get.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_polyline_algorithm/google_polyline_algorithm.dart'; import 'package:location/location.dart'; +import 'package:ride/constant/box_name.dart'; import 'package:ride/constant/credential.dart'; import 'package:ride/constant/links.dart'; import 'package:ride/controller/functions/crud.dart'; import 'package:ride/views/home/map_widget.dart/buttom_sheet_map_show.dart'; +import 'package:ride/views/widgets/elevated_btn.dart'; +import '../../main.dart'; import '../../models/model/locations.dart'; import '../firebase/firbase_messge.dart'; @@ -39,15 +42,32 @@ class MapController extends GetxController { bool isPickerShown = false; bool isButtomSheetShown = false; bool mapType = false; + bool isCancelRidePageShown = false; + bool isCashConfirmPageShown = false; + bool isPaymentMethodPageShown = false; bool isMainBottomMenuMap = true; - double heightButtomSheetShown = 240; + double heightButtomSheetShown = 300; + double cashConfirmPageShown = 250; + double paymentPageShown = 380; late final LatLng southwest; late final LatLng northeast; List carLocations = []; // final mainBottomMenuMap = GlobalKey(); void changeButtomSheetShown() { isButtomSheetShown = !isButtomSheetShown; - heightButtomSheetShown = isButtomSheetShown == true ? 240 : 0; + heightButtomSheetShown = isButtomSheetShown == true ? 250 : 0; + update(); + } + + void changeCashConfirmPageShown() { + isCashConfirmPageShown = !isCashConfirmPageShown; + cashConfirmPageShown = isCashConfirmPageShown == true ? 250 : 0; + update(); + } + + void changePaymentMethodPageShown() { + isPaymentMethodPageShown = !isPaymentMethodPageShown; + paymentPageShown = isPaymentMethodPageShown == true ? Get.height * .6 : 0; update(); } @@ -57,6 +77,14 @@ class MapController extends GetxController { update(); } + void changeCancelRidePageShow() { + // rideConfirm == true + // ? + isCancelRidePageShown = !isCancelRidePageShown; + // : cancelRide(); + update(); + } + void getDrawerMenu() { heightMenuBool = !heightMenuBool; heightMenu = heightMenuBool == true ? 100 : 0; @@ -68,6 +96,36 @@ class MapController extends GetxController { update(); } + int selectedReason = -1; + + void selectReason(int index) { + selectedReason = index; + update(); + } + + bool rideConfirm = false; + void cancelRide() async { + if (rideConfirm == false) { + clearPlaces(); + clearpolyline(); + data = []; + changeCancelRidePageShow(); + update(); + } else { + clearPlaces(); + clearpolyline(); + data = []; + changeCancelRidePageShow(); + await CRUD().post(link: AppLink.addCancelRide, payload: { + "driverID": 1, + "passengerID": box.read(BoxName.pasengerID).toString(), + "rideID": 222, + "note": "zxcz" + }); + update(); + } + } + void changePickerShown() { isPickerShown = !isPickerShown; heightPickerContainer = isPickerShown == true ? 150 : 90; diff --git a/lib/views/home/home_page.dart b/lib/views/home/home_page.dart index e044eb5..674e8b4 100644 --- a/lib/views/home/home_page.dart +++ b/lib/views/home/home_page.dart @@ -12,7 +12,7 @@ class HomePage extends StatelessWidget { title: 'Home Page', body: [ Center( - child: CircleContainer( + child: MyCircleContainer( child: const Icon(Icons.clear), ), ), diff --git a/lib/views/home/map_page.dart b/lib/views/home/map_page.dart index fcf0e95..f899b35 100644 --- a/lib/views/home/map_page.dart +++ b/lib/views/home/map_page.dart @@ -3,13 +3,17 @@ import 'package:get/get.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:ride/constant/colors.dart'; import 'package:ride/controller/home/map_page_controller.dart'; +import 'package:ride/views/home/map_widget.dart/cancel_raide_page.dart'; +import 'package:ride/views/widgets/circle_container.dart'; import 'package:ride/views/widgets/mycircular.dart'; import '../../controller/home/menu_controller.dart'; import 'map_widget.dart/buttom_sheet_map_show.dart'; +import 'map_widget.dart/cash_confirm_bottom_page.dart'; import 'map_widget.dart/main_bottom_Menu_map.dart'; import 'map_widget.dart/map_menu_widget.dart'; import 'map_widget.dart/menu_map_page.dart'; +import 'map_widget.dart/payment_method.page.dart'; import 'map_widget.dart/picker_animation_container.dart'; class MapPage extends StatelessWidget { @@ -153,11 +157,29 @@ class MapPage extends StatelessWidget { )), ), const PickerIconOnMap(), - PickerAnimtionContainerFormPlaces(), - // MainBottomMenuMap(), + // PickerAnimtionContainerFormPlaces(), + MainBottomMenuMap(), const MapMenuWidget(), const MenuIconMapPageWidget(), - buttomSheetMapPage() + buttomSheetMapPage(), + cancelRidePage(), + GetBuilder( + builder: (controller) => controller.data.isNotEmpty + ? Positioned( + right: 5, + top: 55, + child: GestureDetector( + onTap: () { + controller.changeCancelRidePageShow(); + }, + child: const Icon( + Icons.clear, + size: 30, + ), + )) + : const SizedBox()), + CashConfirmPageShown(), + PaymentMethodPage() ], ), ); diff --git a/lib/views/home/map_widget.dart/buttom_sheet_map_show.dart b/lib/views/home/map_widget.dart/buttom_sheet_map_show.dart index 328d522..599f1df 100644 --- a/lib/views/home/map_widget.dart/buttom_sheet_map_show.dart +++ b/lib/views/home/map_widget.dart/buttom_sheet_map_show.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:intl/intl.dart'; +import 'package:ride/views/widgets/elevated_btn.dart'; import '../../../constant/colors.dart'; import '../../../constant/style.dart'; @@ -17,7 +18,7 @@ GetBuilder buttomSheetMapPage() { // clipBehavior: Clip.antiAliasWithSaveLayer, curve: Curves.easeInCirc, onEnd: () { - controller.height = 240; + controller.height = 250; }, height: controller.heightButtomSheetShown, duration: const Duration(seconds: 2), @@ -91,55 +92,115 @@ GetBuilder buttomSheetMapPage() { child: controller.data.isEmpty ? const SizedBox() : Center( - child: Column( - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - children: [ - Text( - 'distance is ${controller.data[0]['distance']['text']}', - style: AppStyle.title, + child: Padding( + padding: + const EdgeInsets.symmetric(horizontal: 5), + child: Column( + children: [ + Row( + children: [ + const Icon( + Icons.location_on, + color: AppColor.redColor, + ), + const SizedBox( + width: 10, + ), + Text( + 'From : '.tr, + style: AppStyle.subtitle, + ), + Text( + controller.data[0]['start_address'] + .toString(), + style: AppStyle.subtitle, + ) + ], + ), + Row( + children: [ + const Icon( + Icons.location_searching_rounded), + const SizedBox( + width: 10, + ), + Text( + 'To : '.tr, + style: AppStyle.subtitle, + ), + Text( + controller.data[0]['end_address'], + style: AppStyle.subtitle, + ), + ], + ), + const Divider( + color: AppColor.accentColor, + thickness: 1, + height: 2, + indent: 1, + ), + SizedBox( + height: 40, + child: Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Container( + decoration: BoxDecoration( + color: AppColor.secondaryColor, + borderRadius: + BorderRadius.circular(12), + // border: Border.all(), + ), + child: Row( + children: [ + Icon( + Icons.monetization_on, + color: Colors.green[400], + ), + InkWell( + onTap: () => controller + .changeCashConfirmPageShown(), + child: Text( + 'CASH', + style: AppStyle.title, + ), + ), + ], + ), + ), + const SizedBox( + width: 40, + ), + Container( + decoration: BoxDecoration( + color: AppColor.secondaryColor, + borderRadius: + BorderRadius.circular(12), + ), + child: Row( + children: [ + Icon( + Icons.qr_code_2_rounded, + color: Colors.green[400], + ), + Text( + 'Add Promo'.tr, + style: AppStyle.title, + ), + ], + ), + ), + ], ), - Text( - 'duration is ${controller.data[0]['duration']['text']}', - style: AppStyle.title, - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - children: [ - Text( - 'Cost for .21/km ${controller.cost.toStringAsFixed(2)} ', - style: AppStyle.title, - ), - Text( - 'costDuration ${controller.averageDuration.toStringAsFixed(2)} is ${controller.costDuration.toStringAsFixed(2)} ', - style: AppStyle.title, - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - children: [ - Text( - 'totalDriver ${controller.totalDriver.toStringAsFixed(2)}', - style: AppStyle.title, - ), - Text( - 'totaME ${controller.totaME.toStringAsFixed(2)} ', - style: AppStyle.title, - ), - ], - ), - Text( - 'Cost for passenger ${controller.totalPassenger.toStringAsFixed(2)} ', - style: AppStyle.title, - ), - ], + ), + MyElevatedButton( + title: 'Confirm Selection', + onPressed: () {}, + ) + ], + ), ), ), ), @@ -149,3 +210,61 @@ GetBuilder buttomSheetMapPage() { ) : const SizedBox()); } + +class Details extends StatelessWidget { + const Details({ + super.key, + }); + + @override + Widget build(BuildContext context) { + return GetBuilder( + builder: (controller) => Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Text( + 'distance is ${controller.data[0]['distance']['text']}', + style: AppStyle.title, + ), + Text( + 'duration is ${controller.data[0]['duration']['text']}', + style: AppStyle.title, + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Text( + 'Cost for .21/km ${controller.cost.toStringAsFixed(2)} ', + style: AppStyle.title, + ), + Text( + 'costDuration ${controller.averageDuration.toStringAsFixed(2)} is ${controller.costDuration.toStringAsFixed(2)} ', + style: AppStyle.title, + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Text( + 'totalDriver ${controller.totalDriver.toStringAsFixed(2)}', + style: AppStyle.title, + ), + Text( + 'totaME ${controller.totaME.toStringAsFixed(2)} ', + style: AppStyle.title, + ), + ], + ), + Text( + 'Cost for passenger ${controller.totalPassenger.toStringAsFixed(2)} ', + style: AppStyle.title, + ), + ], + )); + } +} diff --git a/lib/views/home/map_widget.dart/cancel_raide_page.dart b/lib/views/home/map_widget.dart/cancel_raide_page.dart new file mode 100644 index 0000000..9ba275c --- /dev/null +++ b/lib/views/home/map_widget.dart/cancel_raide_page.dart @@ -0,0 +1,87 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:get/get.dart'; +import 'package:ride/constant/colors.dart'; +import 'package:ride/constant/style.dart'; +import 'package:ride/controller/home/map_page_controller.dart'; + +import '../../widgets/elevated_btn.dart'; + +GetBuilder cancelRidePage() { + Get.put(MapController()); + final List reasons = [ + "I don't need a ride anymore".tr, + "I was just trying the application".tr, + "No driver accepted my request".tr, + "I added the wrong pick-up/drop-off location".tr, + "I don't have a reason".tr, + "Other".tr, + ]; + return GetBuilder( + builder: (controller) => controller.isCancelRidePageShown + ? Positioned( + left: 60, + top: 40, + right: 60, + // bottom: 100, + child: Container( + decoration: BoxDecoration( + color: AppColor.secondaryColor, + boxShadow: [ + const BoxShadow( + color: AppColor.accentColor, + offset: Offset(2, 2), + blurRadius: 5), + BoxShadow( + color: AppColor.accentColor.withOpacity(.4), + offset: const Offset(-2, -2), + blurRadius: 5) + ], + borderRadius: const BorderRadius.all(Radius.circular(15)), + ), + height: Get.height * .7, + width: Get.width * .7, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10), + child: Text( + 'Can we know why you want to cancel Ride ?'.tr, + style: AppStyle.title, + textAlign: TextAlign.center, + ), + ), + SizedBox( + height: 380, + width: 300, + child: ListView.builder( + itemCount: reasons.length, + itemBuilder: (context, index) { + return ListTile( + title: Text(reasons[index]), + leading: Radio( + value: index, + groupValue: controller.selectedReason, + onChanged: (int? value) { + print(value); + controller.selectReason(value!); + }, + ), + ); + }, + ), + ), + MyElevatedButton( + title: 'Cancel Ride'.tr, + onPressed: () async { + controller.cancelRide(); + }, + ), + ], + ), + ), + ) + : const SizedBox(), + ); +} diff --git a/lib/views/home/map_widget.dart/cash_confirm_bottom_page.dart b/lib/views/home/map_widget.dart/cash_confirm_bottom_page.dart new file mode 100644 index 0000000..489ad70 --- /dev/null +++ b/lib/views/home/map_widget.dart/cash_confirm_bottom_page.dart @@ -0,0 +1,123 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:ride/constant/style.dart'; +import 'package:ride/views/widgets/elevated_btn.dart'; + +import '../../../constant/colors.dart'; +import '../../../controller/home/map_page_controller.dart'; + +class CashConfirmPageShown extends StatelessWidget { + const CashConfirmPageShown({ + super.key, + }); + + @override + Widget build(BuildContext context) { + return GetBuilder( + builder: (controller) => Positioned( + right: 5, + bottom: 5, + left: 5, + child: AnimatedContainer( + duration: const Duration(milliseconds: 400), + height: controller.cashConfirmPageShown, + decoration: BoxDecoration( + color: AppColor.secondaryColor, + borderRadius: BorderRadius.circular(15)), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 20), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + 'Payment Method'.tr, + style: AppStyle.title.copyWith(fontSize: 22), + ), + IconButton( + onPressed: () => + controller.changeCashConfirmPageShown(), + icon: const Icon(Icons.close), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + const Icon( + Icons.wallet_outlined, + size: 25, + color: AppColor.redColor, + ), + const SizedBox( + width: 20, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Ride Wallet'.tr, + style: AppStyle.title, + ), + Text( + '${'Your Wallet balance is '.tr}JD 0.00', + style: AppStyle.subtitle, + ), + ], + ), + const Spacer(), + Checkbox.adaptive( + value: false, + onChanged: (value) {}, + ) + ], + ), + const Divider( + color: AppColor.accentColor, + thickness: 1, + height: 2, + indent: 1, + ), + Row( + children: [ + Icon( + Icons.monetization_on, + color: Colors.green[400], + ), + const SizedBox( + width: 20, + ), + InkWell( + onTap: () => + controller.changeCashConfirmPageShown(), + child: Text( + 'CASH', + style: AppStyle.title, + ), + ), + const Spacer(), + Checkbox.adaptive( + value: false, + onChanged: (value) {}, + ) + ], + ), + const Divider( + color: AppColor.accentColor, + thickness: 1, + height: 2, + indent: 1, + ), + MyElevatedButton( + title: 'Add Payment Method', + onPressed: () => + controller.changePaymentMethodPageShown(), + ) + ], + ), + ), + ), + )); + } +} diff --git a/lib/views/home/map_widget.dart/main_bottom_Menu_map.dart b/lib/views/home/map_widget.dart/main_bottom_Menu_map.dart index 0b2997f..1160e4b 100644 --- a/lib/views/home/map_widget.dart/main_bottom_Menu_map.dart +++ b/lib/views/home/map_widget.dart/main_bottom_Menu_map.dart @@ -89,7 +89,10 @@ class MainBottomMenuMap extends StatelessWidget { : const SizedBox(), controller.isMainBottomMenuMap ? const SizedBox() - : Text('From : Current Location',style: AppStyle.subtitle,), + : Text( + 'From : Current Location', + style: AppStyle.subtitle, + ), controller.isMainBottomMenuMap ? const SizedBox() : formSearchPlaces() @@ -101,96 +104,102 @@ class MainBottomMenuMap extends StatelessWidget { } class FavioratePlacesDialogu extends StatelessWidget { - FavioratePlacesDialogu({ + const FavioratePlacesDialogu({ super.key, }); - final controller = MapController(); + @override Widget build(BuildContext context) { - return DefaultTextStyle( - style: AppStyle.title, - child: Center( - child: AnimatedTextKit( - animatedTexts: [ - TypewriterAnimatedText('Favorite Places'.tr), - ScaleAnimatedText( - 'Favorite Places'.tr, - ), - TyperAnimatedText( - 'Favorite Places'.tr, - ), - ], - isRepeatingAnimation: true, - onTap: () async { - List favoritePlaces = - await sql.getAllData(TableName.placesFavorite); - print(favoritePlaces); - Get.defaultDialog( - title: 'Favorite Places'.tr, - content: SizedBox( - width: Get.width * .8, - height: 300, - child: favoritePlaces.isEmpty - ? Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Icon( - Icons.hourglass_empty_rounded, - size: 99, - color: AppColor.primaryColor, - ), - Text( - 'You Dont Have Any places yet !'.tr, - style: AppStyle.title, - ), - ], - ), - ) - : ListView.builder( - itemCount: favoritePlaces.length, - itemBuilder: (BuildContext context, int index) { - return Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - TextButton( - onPressed: () async { - await controller.getMap( - '${controller.mylocation.latitude},${controller.mylocation.longitude}', - '${favoritePlaces[index]['latitude']},${favoritePlaces[index]['longitude']}', - ); - controller.changePickerShown(); - controller.changeButtomSheetShown(); - controller.bottomSheet(); - Get.back(); - }, - child: Text( - favoritePlaces[index]['name'], - style: AppStyle.title, + Get.put(MapController()); + return GetBuilder( + builder: (controller) => DefaultTextStyle( + style: AppStyle.title, + child: Center( + child: AnimatedTextKit( + animatedTexts: [ + TypewriterAnimatedText('Favorite Places'.tr), + ScaleAnimatedText( + 'Favorite Places'.tr, + ), + TyperAnimatedText( + 'Favorite Places'.tr, + ), + ], + isRepeatingAnimation: true, + onTap: () async { + List favoritePlaces = + await sql.getAllData(TableName.placesFavorite); + print(favoritePlaces); + Get.defaultDialog( + title: 'Favorite Places'.tr, + content: SizedBox( + width: Get.width * .8, + height: 300, + child: favoritePlaces.isEmpty + ? Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Icon( + Icons.hourglass_empty_rounded, + size: 99, + color: AppColor.primaryColor, + ), + Text( + 'You Dont Have Any places yet !'.tr, + style: AppStyle.title, + ), + ], ), - ), - IconButton( - onPressed: () async { - await sql.deleteData(TableName.placesFavorite, - favoritePlaces[index]['id']); - Get.back(); - Get.snackbar('Deleted ', - 'You are Delete ${favoritePlaces[index]['name']} from your list', - backgroundColor: AppColor.accentColor); + ) + : ListView.builder( + itemCount: favoritePlaces.length, + itemBuilder: (BuildContext context, int index) { + return Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + TextButton( + onPressed: () async { + await controller.getMap( + '${controller.mylocation.latitude},${controller.mylocation.longitude}', + '${favoritePlaces[index]['latitude']},${favoritePlaces[index]['longitude']}', + ); + controller.changePickerShown(); + controller.changeButtomSheetShown(); + controller.bottomSheet(); + Get.back(); + }, + child: Text( + favoritePlaces[index]['name'], + style: AppStyle.title, + ), + ), + IconButton( + onPressed: () async { + await sql.deleteData( + TableName.placesFavorite, + favoritePlaces[index]['id']); + Get.back(); + Get.snackbar('Deleted ', + 'You are Delete ${favoritePlaces[index]['name']} from your list', + backgroundColor: + AppColor.accentColor); + }, + icon: + const Icon(Icons.favorite_outlined), + ), + ], + ); }, - icon: const Icon(Icons.favorite_outlined), ), - ], - ); - }, ), + cancel: MyElevatedButton( + title: 'Back'.tr, onPressed: () => Get.back()), + ); + }, + ), ), - cancel: MyElevatedButton( - title: 'Back'.tr, onPressed: () => Get.back()), - ); - }, - ), - ), - ); + )); } } diff --git a/lib/views/home/map_widget.dart/payment_method.page.dart b/lib/views/home/map_widget.dart/payment_method.page.dart new file mode 100644 index 0000000..490d2a0 --- /dev/null +++ b/lib/views/home/map_widget.dart/payment_method.page.dart @@ -0,0 +1,87 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:ride/views/widgets/elevated_btn.dart'; + +import '../../../constant/colors.dart'; +import '../../../constant/style.dart'; +import '../../../controller/home/map_page_controller.dart'; + +class PaymentMethodPage extends StatelessWidget { + const PaymentMethodPage({ + super.key, + }); + + @override + Widget build(BuildContext context) { + return GetBuilder( + builder: (controller) => Positioned( + right: 5, + bottom: 5, + left: 5, + child: AnimatedContainer( + duration: const Duration(milliseconds: 400), + height: controller.paymentPageShown, + decoration: BoxDecoration( + color: AppColor.secondaryColor, + borderRadius: BorderRadius.circular(15)), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + 'My Cared'.tr, + style: AppStyle.title.copyWith(fontSize: 22), + ), + IconButton( + onPressed: () => + controller.changePaymentMethodPageShown(), + icon: const Icon(Icons.close), + ), + ], + ), + Text( + 'Add Card'.tr, + style: AppStyle.title, + ), + const SizedBox( + height: 10, + ), + Container( + height: Get.height * .3, + decoration: const BoxDecoration( + color: AppColor.secondaryColor, + borderRadius: BorderRadius.all(Radius.circular(15)), + boxShadow: [ + BoxShadow( + spreadRadius: 3, + offset: Offset(3, 3), + blurRadius: 3, + color: AppColor.redColor), + BoxShadow( + offset: Offset(-3, -3), + blurRadius: 3, + spreadRadius: 3, + color: AppColor.redColor) + ]), + ), + const Spacer(), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + MyElevatedButton( + title: 'Add Credit Card', + onPressed: () {}, + ), + ], + ) + ], + ), + ), + ), + )); + } +} diff --git a/lib/views/widgets/circle_container.dart b/lib/views/widgets/circle_container.dart index a968476..52f2143 100644 --- a/lib/views/widgets/circle_container.dart +++ b/lib/views/widgets/circle_container.dart @@ -2,12 +2,12 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:ride/constant/colors.dart'; -class CircleContainer extends StatelessWidget { +class MyCircleContainer extends StatelessWidget { final Widget child; final Color backgroundColor; final Color borderColor; - CircleContainer({ + MyCircleContainer({ Key? key, required this.child, this.backgroundColor = AppColor.secondaryColor,