237 lines
11 KiB
Dart
237 lines
11 KiB
Dart
import 'package:animated_text_kit/animated_text_kit.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:ride/constant/box_name.dart';
|
|
import 'package:ride/constant/colors.dart';
|
|
import 'package:ride/controller/firebase/firbase_messge.dart';
|
|
import 'package:ride/controller/home/captin/map_driver_controller.dart';
|
|
import 'package:ride/main.dart';
|
|
import 'package:ride/views/widgets/elevated_btn.dart';
|
|
|
|
import '../../../../constant/style.dart';
|
|
import '../../../../controller/functions/launch.dart';
|
|
|
|
class PassengerInfoWindow extends StatelessWidget {
|
|
const PassengerInfoWindow({
|
|
super.key,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Get.put(MapDriverController());
|
|
return GetBuilder<MapDriverController>(
|
|
builder: (controller) => controller.isPassengerInfoWindow == true
|
|
? Stack(
|
|
children: [
|
|
Positioned(
|
|
bottom: 50,
|
|
left: 8,
|
|
child: AnimatedContainer(
|
|
duration: const Duration(milliseconds: 300),
|
|
height: controller.passengerInfoWindow,
|
|
width: Get.width * .8,
|
|
decoration: AppStyle.boxDecoration,
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
DefaultTextStyle(
|
|
style: AppStyle.title,
|
|
child: Text(
|
|
'Go to passenger Location now'.tr,
|
|
style: AppStyle.title
|
|
.copyWith(color: AppColor.greenColor),
|
|
)
|
|
// AnimatedTextKit(
|
|
// animatedTexts: [
|
|
// ScaleAnimatedText(
|
|
// 'Go to passenger Location now'.tr,
|
|
// ),
|
|
// WavyAnimatedText(
|
|
// 'Go to passenger Location now'.tr),
|
|
// FlickerAnimatedText(
|
|
// 'Go to passenger Location now'.tr),
|
|
// WavyAnimatedText(
|
|
// 'Go to passenger Location now'.tr),
|
|
// ],
|
|
// isRepeatingAnimation: true,
|
|
// onTap: () {
|
|
// // print("Tap Event");
|
|
// },
|
|
// ),
|
|
),
|
|
Row(
|
|
children: [
|
|
Text('Duration of the Ride is '.tr,
|
|
style: AppStyle.title),
|
|
Text('${controller.duration} ${'Minute'.tr}',
|
|
style: AppStyle.title),
|
|
],
|
|
),
|
|
Row(
|
|
children: [
|
|
Text('Distance of the Ride is '.tr,
|
|
style: AppStyle.title),
|
|
Text(
|
|
'${controller.distance} ${'KM'.tr}',
|
|
style: AppStyle.title,
|
|
),
|
|
],
|
|
),
|
|
Row(
|
|
children: [
|
|
Text('Name of the Passenger is '.tr,
|
|
style: AppStyle.title),
|
|
Text(
|
|
controller.name.toString(),
|
|
style: AppStyle.title,
|
|
),
|
|
],
|
|
),
|
|
controller.isRideBegin
|
|
? const SizedBox()
|
|
: Row(
|
|
mainAxisAlignment:
|
|
MainAxisAlignment.spaceAround,
|
|
children: [
|
|
IconButton(
|
|
onPressed: () {
|
|
launchCommunication('phone',
|
|
controller.phone.toString(), '');
|
|
},
|
|
icon: const Icon(
|
|
Icons.phone,
|
|
color: AppColor.blueColor,
|
|
)),
|
|
IconButton(
|
|
onPressed: () {
|
|
launchCommunication(
|
|
'whatsapp',
|
|
controller.phone.toString(),
|
|
'${'Hello this is Captain'.tr} ${box.read(BoxName.nameDriver)}');
|
|
},
|
|
icon: const Icon(
|
|
Icons.whatshot,
|
|
color: AppColor.greenColor,
|
|
)),
|
|
IconButton(
|
|
onPressed: () {
|
|
launchCommunication(
|
|
'sms',
|
|
controller.phone.toString(),
|
|
'${'Hello this is Captain'.tr} ${box.read(BoxName.nameDriver)}');
|
|
},
|
|
icon: const Icon(
|
|
Icons.sms_rounded,
|
|
color: AppColor.blueColor,
|
|
)),
|
|
IconButton(
|
|
onPressed: () {
|
|
launchCommunication(
|
|
'email',
|
|
controller.phone.toString(),
|
|
'${'Hello this is Captain'.tr} ${box.read(BoxName.nameDriver)}');
|
|
},
|
|
icon: const Icon(
|
|
Icons.email,
|
|
color: AppColor.redColor,
|
|
)),
|
|
IconButton(
|
|
onPressed: () =>
|
|
FirebaseMessagesController()
|
|
.sendNotificationToPassengerToken(
|
|
'Hi',
|
|
'body',
|
|
controller.tokenPassenger,
|
|
[]),
|
|
icon:
|
|
const Icon(Icons.notification_add))
|
|
],
|
|
),
|
|
controller.remainingTimeToPassenger != 0
|
|
? Stack(
|
|
children: [
|
|
LinearProgressIndicator(
|
|
backgroundColor: AppColor.accentColor,
|
|
color:
|
|
controller.remainingTimeToPassenger <
|
|
60
|
|
? AppColor.redColor
|
|
: AppColor.greenColor,
|
|
minHeight: 50,
|
|
borderRadius: BorderRadius.circular(15),
|
|
value: controller.progressToPassenger
|
|
.toDouble(),
|
|
),
|
|
Center(
|
|
child: Text(
|
|
controller
|
|
.stringRemainingTimeToPassenger,
|
|
style: AppStyle.title,
|
|
),
|
|
)
|
|
],
|
|
)
|
|
: controller.isRideBegin
|
|
? const SizedBox()
|
|
: MyElevatedButton(
|
|
title: 'Start the Ride'.tr,
|
|
kolor: AppColor.greenColor,
|
|
onPressed: () {
|
|
controller.startRideFromDriver();
|
|
}),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
)
|
|
: controller.remainingTimeToShowPassengerInfoWindowFromDriver > 0 //
|
|
? Positioned(
|
|
bottom: Get.height * .3,
|
|
left: 15,
|
|
child: Container(
|
|
decoration: AppStyle.boxDecoration,
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Row(
|
|
children: [
|
|
Stack(
|
|
alignment: Alignment.center,
|
|
children: [
|
|
const CircularProgressIndicator(
|
|
backgroundColor: AppColor.redColor,
|
|
strokeWidth: 10,
|
|
color: AppColor.redColor,
|
|
value: 1,
|
|
),
|
|
CircularProgressIndicator(
|
|
value: controller.progress,
|
|
// Set the color based on the "isNearEnd" condition
|
|
color: AppColor.yellowColor,
|
|
),
|
|
Text(
|
|
'${controller.remainingTimeToShowPassengerInfoWindowFromDriver}',
|
|
style: AppStyle.number,
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(
|
|
width: 10,
|
|
),
|
|
Text(
|
|
'Please Wait If passenger want To Cancel!'.tr,
|
|
style: AppStyle.title,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
)
|
|
: const SizedBox(),
|
|
);
|
|
}
|
|
}
|