97 lines
3.7 KiB
Dart
97 lines
3.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:ride/constant/links.dart';
|
|
import 'package:ride/views/widgets/elevated_btn.dart';
|
|
|
|
import '../../../constant/box_name.dart';
|
|
import '../../../constant/colors.dart';
|
|
import '../../../constant/style.dart';
|
|
import '../../../controller/firebase/firbase_messge.dart';
|
|
import '../../../controller/functions/crud.dart';
|
|
import '../../../controller/home/map_passenger_controller.dart';
|
|
import '../../../main.dart';
|
|
|
|
class RideBeginPassenger extends StatelessWidget {
|
|
const RideBeginPassenger({
|
|
super.key,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GetBuilder<MapPassengerController>(builder: (controller) {
|
|
if (controller.rideTimerBegin) {
|
|
return Positioned(
|
|
left: 10,
|
|
right: 10,
|
|
bottom: 4,
|
|
child: Container(
|
|
decoration: AppStyle.boxDecoration,
|
|
height: 200,
|
|
// width: 100,
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Column(
|
|
children: [
|
|
Text(
|
|
'You will arrive to your destination after '.tr,
|
|
style: AppStyle.title,
|
|
),
|
|
Stack(
|
|
children: [
|
|
LinearProgressIndicator(
|
|
backgroundColor: AppColor.accentColor,
|
|
color: controller.remainingTimeTimerRideBegin < 60
|
|
? AppColor.redColor
|
|
: AppColor.greenColor,
|
|
minHeight: 50,
|
|
borderRadius: BorderRadius.circular(15),
|
|
value: controller.progressTimerRideBegin.toDouble(),
|
|
),
|
|
Center(
|
|
child: Text(
|
|
controller.stringRemainingTimeRideBegin,
|
|
style: AppStyle.title,
|
|
),
|
|
)
|
|
],
|
|
),
|
|
controller.remainingTimeTimerRideBegin < 5
|
|
? MyElevatedButton(
|
|
title:
|
|
'If you in destination Now. Press finish The Ride',
|
|
onPressed: () async {
|
|
//todo finish the trip and rest all counter ,start new counter of the trip time
|
|
|
|
// await CRUD()
|
|
// .post(link: AppLink.updateRides, payload: {
|
|
// 'id': controller.rideId,
|
|
// 'rideTimeStart': DateTime.now().toString(),
|
|
// 'status': 'Applied'
|
|
// });
|
|
// controller.driverArrivePassenger();
|
|
// // Send notification to driver to alert him that trip is begin
|
|
// FirebaseMessagesController()
|
|
// .sendNotificationToAnyWithoutData(
|
|
// 'BeginTrip',
|
|
// box.read(BoxName.name).toString(),
|
|
// controller.driverToken.toString(),
|
|
// );
|
|
// print(controller.driverToken.toString());
|
|
// Get.defaultDialog(
|
|
// title: 'The Ride is Begin'.tr,
|
|
// backgroundColor: AppColor.greenColor,
|
|
// );
|
|
})
|
|
: const SizedBox()
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
} else {
|
|
return const SizedBox();
|
|
}
|
|
});
|
|
}
|
|
}
|