9/13/1
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
@@ -11,10 +13,13 @@ 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/driver_card_from_passenger.dart';
|
||||
import 'map_widget.dart/left_main_menu_icons.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/timer_for_cancell_trip_from_passenger.dart';
|
||||
|
||||
class MapPage extends StatelessWidget {
|
||||
const MapPage({super.key});
|
||||
@@ -266,104 +271,19 @@ class MapPage extends StatelessWidget {
|
||||
// liteModeEnabled: true,
|
||||
),
|
||||
),
|
||||
GetBuilder<MapController>(
|
||||
builder: (controller) => Positioned(
|
||||
top: 85,
|
||||
left: 6,
|
||||
child: Column(
|
||||
children: [
|
||||
AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTrafic,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(),
|
||||
color: AppColor.secondaryColor,
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
controller.changeMapType();
|
||||
// Toast.show(context, 'This is a toast message!');
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.satellite_alt,
|
||||
size: 29,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTrafic,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
border: Border.all(),
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
controller.changeMapTraffic();
|
||||
// Toast.show(context, 'This is a toast message!');
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.streetview_sharp,
|
||||
size: 29,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
),
|
||||
leftMainMenuIcons(),
|
||||
const PickerIconOnMap(),
|
||||
// PickerAnimtionContainerFormPlaces(),
|
||||
const MainBottomMenuMap(),
|
||||
const MapMenuWidget(),
|
||||
const MenuIconMapPageWidget(),
|
||||
buttomSheetMapPage(),
|
||||
GetBuilder<MapController>(
|
||||
builder: ((controller) => controller.rideConfirm
|
||||
? Positioned(
|
||||
top: Get.height * .2,
|
||||
left: Get.width * .2,
|
||||
right: Get.width * .2,
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(microseconds: 300),
|
||||
height: 350,
|
||||
width: 200,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(),
|
||||
color: AppColor.secondaryColor,
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'Waiting for Captin ...'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox())),
|
||||
hexagonClipper(),
|
||||
cancelRidePage(),
|
||||
GetBuilder<MapController>(
|
||||
builder: (controller) => controller.data.isNotEmpty
|
||||
? Positioned(
|
||||
right: 5,
|
||||
top: 55,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
controller.changeCancelRidePageShow();
|
||||
},
|
||||
child: const Icon(
|
||||
Icons.clear,
|
||||
size: 30,
|
||||
),
|
||||
))
|
||||
: const SizedBox()),
|
||||
const CancelRidePageShow(),
|
||||
const CashConfirmPageShown(),
|
||||
const PaymentMethodPage()
|
||||
const PaymentMethodPage(),
|
||||
timerForCancellTripFromPassenger(),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -371,6 +291,31 @@ class MapPage extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class CancelRidePageShow extends StatelessWidget {
|
||||
const CancelRidePageShow({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<MapController>(
|
||||
builder: (controller) => controller.data.isNotEmpty
|
||||
? Positioned(
|
||||
right: 5,
|
||||
top: 55,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
controller.changeCancelRidePageShow();
|
||||
},
|
||||
child: const Icon(
|
||||
Icons.clear,
|
||||
size: 30,
|
||||
),
|
||||
))
|
||||
: const SizedBox());
|
||||
}
|
||||
}
|
||||
|
||||
class PickerIconOnMap extends StatelessWidget {
|
||||
const PickerIconOnMap({
|
||||
super.key,
|
||||
|
||||
131
lib/views/home/map_widget.dart/driver_card_from_passenger.dart
Normal file
131
lib/views/home/map_widget.dart/driver_card_from_passenger.dart
Normal file
@@ -0,0 +1,131 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../constant/style.dart';
|
||||
import '../../../controller/home/map_page_controller.dart';
|
||||
import 'hexegone_clipper.dart';
|
||||
|
||||
GetBuilder<MapController> hexagonClipper() {
|
||||
return GetBuilder<MapController>(
|
||||
builder: ((controller) => controller.rideConfirm
|
||||
? Positioned(
|
||||
top: Get.height * .2,
|
||||
left: Get.width * .2,
|
||||
right: Get.width * .2,
|
||||
child: ClipPath(
|
||||
clipper:
|
||||
HexagonClipper(), // CustomClipper to create a hexagon shape
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(microseconds: 300),
|
||||
height: 250,
|
||||
width: 250,
|
||||
decoration: BoxDecoration(
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColor.primaryColor.withOpacity(0.25),
|
||||
blurRadius: 4,
|
||||
spreadRadius: 2,
|
||||
offset: const Offset(0, 4),
|
||||
),
|
||||
BoxShadow(
|
||||
color: AppColor.accentColor.withOpacity(0.5),
|
||||
offset: const Offset(-5, -5),
|
||||
blurRadius: 5,
|
||||
spreadRadius: 2,
|
||||
),
|
||||
BoxShadow(
|
||||
color: AppColor.secondaryColor.withOpacity(0.2),
|
||||
offset: const Offset(5, 5),
|
||||
blurRadius: 5,
|
||||
spreadRadius: 2,
|
||||
),
|
||||
],
|
||||
gradient: const LinearGradient(
|
||||
colors: [AppColor.greenColor, AppColor.secondaryColor],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomCenter,
|
||||
),
|
||||
border: Border.all(),
|
||||
color: AppColor.secondaryColor,
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'Waiting for Captin ...'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
// IconButton(
|
||||
// onPressed: () {
|
||||
// print(controller.dataCarsLocationByPassenger);
|
||||
// },
|
||||
// icon: const Icon(Icons.add),
|
||||
// ),
|
||||
Text(
|
||||
controller.dataCarsLocationByPassenger['message'][0]
|
||||
['phone']
|
||||
.toString(),
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text(
|
||||
controller.dataCarsLocationByPassenger['message'][0]
|
||||
['first_name']
|
||||
.toString() +
|
||||
' ' +
|
||||
controller
|
||||
.dataCarsLocationByPassenger['message'][0]
|
||||
['last_name']
|
||||
.toString(),
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
'Age is '.tr +
|
||||
controller
|
||||
.dataCarsLocationByPassenger['message'][0]
|
||||
['age']
|
||||
.toString(),
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text(
|
||||
controller.dataCarsLocationByPassenger['message'][0]
|
||||
['make']
|
||||
.toString(),
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
controller.dataCarsLocationByPassenger['message'][0]
|
||||
['model']
|
||||
.toString(),
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
controller.dataCarsLocationByPassenger['message'][0]
|
||||
['seats']
|
||||
.toString(),
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
controller.dataCarsLocationByPassenger['message'][0]
|
||||
['model']
|
||||
.toString(),
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox()));
|
||||
}
|
||||
36
lib/views/home/map_widget.dart/hexegone_clipper.dart
Normal file
36
lib/views/home/map_widget.dart/hexegone_clipper.dart
Normal file
@@ -0,0 +1,36 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class HexagonClipper extends CustomClipper<Path> {
|
||||
@override
|
||||
Path getClip(Size size) {
|
||||
final path = Path();
|
||||
final height = size.height;
|
||||
final width = size.width;
|
||||
final centerX = width / 2;
|
||||
final centerY = height / 2;
|
||||
final radius = width / 2;
|
||||
|
||||
const angle = 2 * pi / 10; // Angle between each side of the hexagon
|
||||
|
||||
// Start at the top right vertex of the hexagon
|
||||
final startX = centerX + radius * cos(0);
|
||||
final startY = centerY + radius * sin(0);
|
||||
path.moveTo(startX, startY);
|
||||
|
||||
// Draw the remaining sides of the hexagon
|
||||
for (int i = 1; i < 10; i++) {
|
||||
final x = centerX + radius * cos(angle * i);
|
||||
final y = centerY + radius * sin(angle * i);
|
||||
path.lineTo(x, y);
|
||||
}
|
||||
|
||||
path.close();
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldReclip(HexagonClipper oldClipper) => false;
|
||||
}
|
||||
56
lib/views/home/map_widget.dart/left_main_menu_icons.dart
Normal file
56
lib/views/home/map_widget.dart/left_main_menu_icons.dart
Normal file
@@ -0,0 +1,56 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../controller/home/map_page_controller.dart';
|
||||
|
||||
GetBuilder<MapController> leftMainMenuIcons() {
|
||||
return GetBuilder<MapController>(
|
||||
builder: (controller) => Positioned(
|
||||
top: 85,
|
||||
left: 6,
|
||||
child: Column(
|
||||
children: [
|
||||
AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTrafic,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(),
|
||||
color: AppColor.secondaryColor,
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
controller.changeMapType();
|
||||
// Toast.show(context, 'This is a toast message!');
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.satellite_alt,
|
||||
size: 29,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTrafic,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
border: Border.all(),
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
controller.changeMapTraffic();
|
||||
// Toast.show(context, 'This is a toast message!');
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.streetview_sharp,
|
||||
size: 29,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../constant/style.dart';
|
||||
import '../../../controller/home/map_page_controller.dart';
|
||||
|
||||
GetBuilder<MapController> timerForCancellTripFromPassenger() {
|
||||
return GetBuilder<MapController>(
|
||||
builder: (controller) {
|
||||
final isNearEnd =
|
||||
controller.remainingTime <= 5; // Define a threshold for "near end"
|
||||
|
||||
return controller.shouldFetch == false
|
||||
? Positioned(
|
||||
bottom: Get.height * .3,
|
||||
left: Get.width * .05,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
CircularProgressIndicator(
|
||||
value: controller.progress,
|
||||
// Set the color based on the "isNearEnd" condition
|
||||
color: isNearEnd ? Colors.red : Colors.blue,
|
||||
),
|
||||
Text(
|
||||
'${controller.remainingTime}',
|
||||
style: AppStyle.number,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: const SizedBox();
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user