25-7-28-2
This commit is contained in:
149
lib/views/home/Captin/history/history_captain.dart
Executable file
149
lib/views/home/Captin/history/history_captain.dart
Executable file
@@ -0,0 +1,149 @@
|
||||
import 'package:sefer_driver/views/widgets/mydialoug.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../controller/auth/captin/history_captain.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../controller/functions/encrypt_decrypt.dart';
|
||||
|
||||
class HistoryCaptain extends StatelessWidget {
|
||||
const HistoryCaptain({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(HistoryCaptainController());
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
middle: Text('History Page'.tr),
|
||||
leading: CupertinoNavigationBarBackButton(
|
||||
onPressed: () => Get.back(),
|
||||
),
|
||||
),
|
||||
child: SafeArea(
|
||||
child: GetBuilder<HistoryCaptainController>(
|
||||
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,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'OrderId'.tr,
|
||||
style: CupertinoTheme.of(context)
|
||||
.textTheme
|
||||
.navTitleTextStyle,
|
||||
),
|
||||
Text(
|
||||
EncryptionHelper.instance
|
||||
.decryptData(list['order_id']),
|
||||
style: CupertinoTheme.of(context)
|
||||
.textTheme
|
||||
.textStyle,
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'created time'.tr,
|
||||
style: CupertinoTheme.of(context)
|
||||
.textTheme
|
||||
.navTitleTextStyle,
|
||||
),
|
||||
Text(
|
||||
list['created_at'],
|
||||
style: CupertinoTheme.of(context)
|
||||
.textTheme
|
||||
.textStyle,
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
list['status'],
|
||||
style: EncryptionHelper.instance
|
||||
.decryptData(
|
||||
list['status']) ==
|
||||
'Apply'
|
||||
? CupertinoTheme.of(context)
|
||||
.textTheme
|
||||
.navTitleTextStyle
|
||||
.copyWith(
|
||||
color: CupertinoColors
|
||||
.systemGreen)
|
||||
: EncryptionHelper.instance.decryptData(
|
||||
list['status']) ==
|
||||
'Refused'
|
||||
? CupertinoTheme.of(context)
|
||||
.textTheme
|
||||
.navTitleTextStyle
|
||||
.copyWith(
|
||||
color: CupertinoColors
|
||||
.systemRed)
|
||||
: CupertinoTheme.of(context)
|
||||
.textTheme
|
||||
.navTitleTextStyle
|
||||
.copyWith(
|
||||
color: CupertinoColors
|
||||
.systemYellow),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
252
lib/views/home/Captin/history/history_details_page.dart
Executable file
252
lib/views/home/Captin/history/history_details_page.dart
Executable file
@@ -0,0 +1,252 @@
|
||||
import 'package:sefer_driver/controller/functions/location_controller.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:sefer_driver/controller/auth/captin/history_captain.dart';
|
||||
import 'package:sefer_driver/controller/functions/launch.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
import '../../../../controller/functions/encrypt_decrypt.dart';
|
||||
|
||||
class HistoryDetailsPage extends StatelessWidget {
|
||||
HistoryDetailsPage({super.key});
|
||||
HistoryCaptainController historyCaptainController =
|
||||
Get.put(HistoryCaptainController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
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<HistoryCaptainController>(
|
||||
builder: (historyCaptainController) {
|
||||
var res = historyCaptainController.historyDetailsData['data'];
|
||||
return historyCaptainController.isloading
|
||||
? 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/${EncryptionHelper.instance.decryptData(res['start_location'])}/${EncryptionHelper.instance.decryptData(res['end_location'])}/';
|
||||
showInBrowser(mapUrl);
|
||||
},
|
||||
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,
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height *
|
||||
0.3,
|
||||
child: GoogleMap(
|
||||
initialCameraPosition: CameraPosition(
|
||||
target: Get.find<LocationController>()
|
||||
.myLocation,
|
||||
tilt: 80,
|
||||
zoom: 13,
|
||||
),
|
||||
zoomControlsEnabled: true,
|
||||
polylines: {
|
||||
Polyline(
|
||||
polylineId: const PolylineId('route'),
|
||||
points: [
|
||||
LatLng(
|
||||
double.parse(EncryptionHelper
|
||||
.instance
|
||||
.decryptData(
|
||||
res['start_location'])
|
||||
.toString()
|
||||
.split(',')[0]),
|
||||
double.parse(EncryptionHelper
|
||||
.instance
|
||||
.decryptData(
|
||||
res['start_location'])
|
||||
.toString()
|
||||
.split(',')[1]),
|
||||
),
|
||||
LatLng(
|
||||
double.parse(EncryptionHelper
|
||||
.instance
|
||||
.decryptData(
|
||||
res['end_location'])
|
||||
.toString()
|
||||
.split(',')[0]),
|
||||
double.parse(EncryptionHelper
|
||||
.instance
|
||||
.decryptData(
|
||||
res['end_location'])
|
||||
.toString()
|
||||
.split(',')[1]),
|
||||
)
|
||||
],
|
||||
color: CupertinoColors.activeGreen,
|
||||
width: 5,
|
||||
),
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'${'Order ID'.tr} ${EncryptionHelper.instance.decryptData(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} ${EncryptionHelper.instance.decryptData(res['price_for_driver'])}',
|
||||
style: CupertinoTheme.of(context)
|
||||
.textTheme
|
||||
.textStyle,
|
||||
),
|
||||
Text(
|
||||
'${'Distance is'.tr} ${EncryptionHelper.instance.decryptData(res['distance'])} KM',
|
||||
style: CupertinoTheme.of(context)
|
||||
.textTheme
|
||||
.textStyle,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
'Times of Trip'.tr,
|
||||
style: CupertinoTheme.of(context)
|
||||
.textTheme
|
||||
.navTitleTextStyle,
|
||||
),
|
||||
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: 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: 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.systemGreen, width: 2),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'${'Passenger Name is'.tr} ${EncryptionHelper.instance.decryptData(res['first_name'])} ${EncryptionHelper.instance.decryptData(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} ${EncryptionHelper.instance.decryptData(res['status'])}',
|
||||
style: CupertinoTheme.of(context)
|
||||
.textTheme
|
||||
.textStyle,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user