9/3/1
This commit is contained in:
153
lib/views/home/HomePage/trip_record_page.dart
Normal file
153
lib/views/home/HomePage/trip_record_page.dart
Normal file
@@ -0,0 +1,153 @@
|
||||
import 'package:SEFER/views/widgets/my_scafold.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:share/share.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../constant/style.dart';
|
||||
import '../../../controller/functions/audio_record1.dart';
|
||||
import '../../../controller/functions/tts.dart';
|
||||
import '../../widgets/elevated_btn.dart';
|
||||
|
||||
class TripsRecordedPage extends StatelessWidget {
|
||||
const TripsRecordedPage({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MyScafolld(
|
||||
title: 'Trips recorded'.tr,
|
||||
body: [
|
||||
GetBuilder<AudioRecorderController>(builder: (audio) {
|
||||
return Column(
|
||||
children: [
|
||||
FutureBuilder<List<String>>(
|
||||
future: audio.getRecordedFiles(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const CircularProgressIndicator();
|
||||
} else if (snapshot.hasData) {
|
||||
final recordedFiles = snapshot.data!;
|
||||
return DropdownButton<String>(
|
||||
value: audio.selectedFilePath,
|
||||
onChanged: (value) {
|
||||
audio.selectedFilePath = value;
|
||||
audio.playRecordedFile(value!);
|
||||
audio.update();
|
||||
},
|
||||
items: recordedFiles
|
||||
.map((file) => DropdownMenuItem<String>(
|
||||
value: file,
|
||||
child: Text(path.basename(file)),
|
||||
))
|
||||
.toList(),
|
||||
);
|
||||
} else {
|
||||
return Text('Error: ${snapshot.error}');
|
||||
}
|
||||
},
|
||||
),
|
||||
Slider(
|
||||
value: audio.currentPosition,
|
||||
max: audio.totalDuration,
|
||||
inactiveColor: AppColor.accentColor,
|
||||
label: audio.currentPosition.toString(),
|
||||
onChanged: (value) {
|
||||
audio.currentPosition = value;
|
||||
audio.audioPlayer.seek(Duration(seconds: value.toInt()));
|
||||
},
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
audio.isPlaying ? Icons.pause : Icons.play_arrow),
|
||||
onPressed: () {
|
||||
if (audio.isPlaying) {
|
||||
audio.pausePlayback();
|
||||
} else {
|
||||
audio.resumePlayback();
|
||||
}
|
||||
audio.update();
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.stop),
|
||||
onPressed: () {
|
||||
audio.stopPlayback();
|
||||
audio.update();
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.delete),
|
||||
onPressed: () async {
|
||||
Get.defaultDialog(
|
||||
title: 'Are you sure to delete recorded files'.tr,
|
||||
content: Column(
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
Get.find<TextToSpeechController>().speakText(
|
||||
'this will delete all files from your device'
|
||||
.tr);
|
||||
},
|
||||
icon: const Icon(Icons.headphones),
|
||||
),
|
||||
Text(
|
||||
'this will delete all files from your device'
|
||||
.tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
titleStyle: AppStyle.title,
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Delete'.tr,
|
||||
kolor: AppColor.redColor,
|
||||
onPressed: () async {
|
||||
await audio.deleteAllRecordedFiles();
|
||||
Get.back();
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
color: Colors.grey[200],
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
audio.selectedFilePath != null
|
||||
? '${'Selected file:'.tr} ${path.basename(audio.selectedFilePath!)}'
|
||||
: 'No file selected'.tr,
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
if (audio.selectedFilePath != null)
|
||||
IconButton(
|
||||
icon: const Icon(Icons.share),
|
||||
onPressed: () {
|
||||
Share.shareFiles([audio.selectedFilePath!]);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
],
|
||||
isleading: true);
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,14 @@
|
||||
import 'package:SEFER/controller/functions/tts.dart';
|
||||
import 'package:SEFER/controller/home/home_page_controller.dart';
|
||||
import 'package:SEFER/views/widgets/elevated_btn.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:SEFER/constant/colors.dart';
|
||||
import 'package:SEFER/constant/style.dart';
|
||||
import 'package:SEFER/views/lang/languages.dart';
|
||||
import 'package:SEFER/views/widgets/my_scafold.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:share/share.dart';
|
||||
|
||||
import '../../controller/functions/audio_record1.dart';
|
||||
import 'HomePage/about_page.dart';
|
||||
import 'HomePage/frequentlyQuestionsPage.dart';
|
||||
import 'HomePage/trip_record_page.dart';
|
||||
import 'profile/passenger_profile_page.dart';
|
||||
|
||||
class HomePage extends StatelessWidget {
|
||||
@@ -106,121 +102,7 @@ class HomePage extends StatelessWidget {
|
||||
style: AppStyle.title,
|
||||
),
|
||||
onTap: () async {
|
||||
Get.defaultDialog(
|
||||
title: 'Select recorded trip'.tr,
|
||||
titleStyle: AppStyle.title,
|
||||
content:
|
||||
GetBuilder<AudioRecorderController>(builder: (audio) {
|
||||
return Column(
|
||||
children: [
|
||||
FutureBuilder<List<String>>(
|
||||
future: audio.getRecordedFiles(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState ==
|
||||
ConnectionState.waiting) {
|
||||
return const CircularProgressIndicator();
|
||||
} else if (snapshot.hasData) {
|
||||
final recordedFiles = snapshot.data!;
|
||||
return DropdownButton<String>(
|
||||
value: audio.selectedFilePath,
|
||||
onChanged: (value) {
|
||||
audio.selectedFilePath = value;
|
||||
audio.playRecordedFile(value!);
|
||||
audio.update();
|
||||
},
|
||||
items: recordedFiles
|
||||
.map((file) => DropdownMenuItem<String>(
|
||||
value: file,
|
||||
child: Text(path.basename(file)),
|
||||
))
|
||||
.toList(),
|
||||
);
|
||||
} else {
|
||||
return Text('Error: ${snapshot.error}');
|
||||
}
|
||||
},
|
||||
),
|
||||
Slider(
|
||||
value: audio.currentPosition,
|
||||
max: audio.totalDuration,
|
||||
inactiveColor: AppColor.accentColor,
|
||||
label: audio.currentPosition.toString(),
|
||||
onChanged: (value) {
|
||||
audio.currentPosition = value;
|
||||
// audio.update();
|
||||
audio.audioPlayer
|
||||
.seek(Duration(seconds: value.toInt()));
|
||||
},
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
color: Colors.grey[200],
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
audio.selectedFilePath != null
|
||||
? '${'Selected file:'.tr} ${path.basename(audio.selectedFilePath!)}'
|
||||
: 'No file selected'.tr,
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
if (audio.selectedFilePath != null)
|
||||
IconButton(
|
||||
icon: const Icon(Icons.share),
|
||||
onPressed: () {
|
||||
Share.shareFiles(
|
||||
[audio.selectedFilePath!]);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
Get.defaultDialog(
|
||||
title: 'Are you sure to delete recorded files'
|
||||
.tr,
|
||||
content: Column(
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
Get.find<TextToSpeechController>()
|
||||
.speakText(
|
||||
'this will delete all files from your device'
|
||||
.tr);
|
||||
},
|
||||
icon: const Icon(Icons.headphones),
|
||||
),
|
||||
Text(
|
||||
'this will delete all files from your device'
|
||||
.tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
titleStyle: AppStyle.title,
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Delete'.tr,
|
||||
kolor: AppColor.redColor,
|
||||
onPressed: () async {
|
||||
await audio
|
||||
// .deleteRecordedFile(audio.selectedFilePath!);
|
||||
.deleteAllRecordedFiles();
|
||||
Get.back();
|
||||
Get.back();
|
||||
}));
|
||||
},
|
||||
icon: const Icon(Icons.delete),
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
);
|
||||
Get.to(() => TripsRecordedPage());
|
||||
}),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.account_balance_outlined),
|
||||
|
||||
@@ -34,6 +34,11 @@ List<CarType> carTypes = [
|
||||
carDetail: 'Closest & Cheapest'.tr,
|
||||
image: 'assets/images/carspeed.png',
|
||||
),
|
||||
CarType(
|
||||
carType: 'Balash',
|
||||
carDetail: "Old and affordable, perfect for budget rides.".tr,
|
||||
image: 'assets/images/balash.png',
|
||||
),
|
||||
CarType(
|
||||
carType: 'Lady',
|
||||
carDetail: 'Lady Captain for girls'.tr,
|
||||
@@ -49,11 +54,11 @@ List<CarType> carTypes = [
|
||||
carDetail: 'Mashwari without end point'.tr,
|
||||
image: 'assets/images/freeRide.png',
|
||||
),
|
||||
// CarType(
|
||||
// carType: 'Family',
|
||||
// carDetail: 'Family for 7 passenger'.tr,
|
||||
// image: 'assets/images/Family.png',
|
||||
// ),
|
||||
CarType(
|
||||
carType: 'Rayeh Gai',
|
||||
carDetail: "Best choice for cities".tr,
|
||||
image: 'assets/images/roundtrip.png',
|
||||
),
|
||||
];
|
||||
|
||||
class CarDetailsTypeToChoose extends StatelessWidget {
|
||||
@@ -63,25 +68,6 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<MapPassengerController>(
|
||||
builder: (mapPassengerController) {
|
||||
if (mapPassengerController.distance > 80) {
|
||||
carTypes.add(
|
||||
CarType(
|
||||
carType: 'Rayeh Gai',
|
||||
carDetail: "Best choice for cities".tr,
|
||||
image: 'assets/images/roundtrip.png',
|
||||
),
|
||||
);
|
||||
} // Create a Set to remove duplicates based on the `carType` field
|
||||
Set<CarType> uniqueCarTypes = {};
|
||||
uniqueCarTypes.addAll(carTypes);
|
||||
|
||||
// Convert the Set back to a List
|
||||
carTypes = uniqueCarTypes.toList();
|
||||
|
||||
if (carTypes.length > 6) {
|
||||
carTypes.removeRange(6, carTypes.length);
|
||||
}
|
||||
|
||||
return mapPassengerController.data.isNotEmpty &&
|
||||
mapPassengerController.isBottomSheetShown &&
|
||||
mapPassengerController.rideConfirm == false
|
||||
@@ -152,20 +138,25 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
||||
? mapPassengerController
|
||||
.totalPassengerSpeed
|
||||
.toStringAsFixed(2)
|
||||
: carType.carType == 'Delivery'
|
||||
: carType.carType == 'Balash'
|
||||
? mapPassengerController
|
||||
.totalPassengerMotoDelivery
|
||||
.totalPassengerBalash
|
||||
.toStringAsFixed(2)
|
||||
: carType.carType == 'Lady'
|
||||
: carType.carType == 'Delivery'
|
||||
? mapPassengerController
|
||||
.totalPassengerLady
|
||||
.totalPassengerMotoDelivery
|
||||
.toStringAsFixed(2)
|
||||
: carType.carType ==
|
||||
'Rayeh Gai'
|
||||
: carType.carType == 'Lady'
|
||||
? mapPassengerController
|
||||
.totalPassengerRayehGai
|
||||
.totalPassengerLady
|
||||
.toStringAsFixed(2)
|
||||
: '50',
|
||||
: carType.carType ==
|
||||
'Rayeh Gai'
|
||||
? mapPassengerController
|
||||
.totalPassengerRayehGai
|
||||
.toStringAsFixed(
|
||||
2)
|
||||
: '50',
|
||||
style:
|
||||
AppStyle.title.copyWith(fontSize: 20),
|
||||
),
|
||||
@@ -237,10 +228,10 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
||||
)
|
||||
],
|
||||
)
|
||||
: carType.carType == 'Lady' &&
|
||||
: carType.carType == 'Balash' &&
|
||||
(mapPassengerController
|
||||
.totalPassengerSpeed >
|
||||
20)
|
||||
.totalPassengerBalash >
|
||||
15)
|
||||
? Row(
|
||||
children: [
|
||||
Container(
|
||||
@@ -259,7 +250,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
||||
),
|
||||
Text(
|
||||
mapPassengerController
|
||||
.totalPassengerLadyDiscount
|
||||
.totalPassengerBalashDiscount
|
||||
.toStringAsFixed(
|
||||
2),
|
||||
style: AppStyle.title
|
||||
@@ -273,9 +264,46 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
||||
)
|
||||
],
|
||||
)
|
||||
: const SizedBox(
|
||||
width: 3,
|
||||
),
|
||||
: carType.carType == 'Lady' &&
|
||||
(mapPassengerController
|
||||
.totalPassengerSpeed >
|
||||
20)
|
||||
? Row(
|
||||
children: [
|
||||
Container(
|
||||
decoration: AppStyle
|
||||
.boxDecoration1,
|
||||
child: Text(
|
||||
'-10%',
|
||||
style: AppStyle
|
||||
.subtitle
|
||||
.copyWith(
|
||||
color:
|
||||
AppColor.greenColor),
|
||||
)),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text(
|
||||
mapPassengerController
|
||||
.totalPassengerLadyDiscount
|
||||
.toStringAsFixed(
|
||||
2),
|
||||
style: AppStyle
|
||||
.title
|
||||
.copyWith(
|
||||
color: AppColor
|
||||
.redColor,
|
||||
decoration:
|
||||
TextDecoration
|
||||
.lineThrough, // Strikethrough line
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
: const SizedBox(
|
||||
width: 3,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
@@ -371,7 +399,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
||||
}));
|
||||
} else if (mapPassengerController
|
||||
.selectedIndex ==
|
||||
3) {
|
||||
4) {
|
||||
box.write(BoxName.carType, 'Delivery');
|
||||
mapPassengerController.totalPassenger =
|
||||
mapPassengerController
|
||||
@@ -405,7 +433,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
||||
}));
|
||||
} else if (mapPassengerController
|
||||
.selectedIndex ==
|
||||
4) {
|
||||
5) {
|
||||
box.write(BoxName.carType, 'Mashwari');
|
||||
mapPassengerController.totalPassenger = 50;
|
||||
Get.defaultDialog(
|
||||
@@ -435,6 +463,40 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
||||
} else if (mapPassengerController
|
||||
.selectedIndex ==
|
||||
2) {
|
||||
box.write(BoxName.carType, 'Balash');
|
||||
mapPassengerController.totalPassenger =
|
||||
mapPassengerController
|
||||
.totalPassengerBalash;
|
||||
Get.defaultDialog(
|
||||
title: 'Balash'.tr,
|
||||
titleStyle: AppStyle.title,
|
||||
content: CarDialogue(
|
||||
textToSpeechController:
|
||||
textToSpeechController,
|
||||
image: 'assets/images/balash.png',
|
||||
text:
|
||||
"Old and affordable, perfect for budget rides."
|
||||
.tr),
|
||||
confirm: MyElevatedButton(
|
||||
kolor: AppColor.greenColor,
|
||||
title: 'Next'.tr,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
mapPassengerController
|
||||
.isBottomSheetShown = false;
|
||||
mapPassengerController.update();
|
||||
mapPassengerController
|
||||
.changeCashConfirmPageShown();
|
||||
}),
|
||||
cancel: MyElevatedButton(
|
||||
title: 'Cancel'.tr,
|
||||
kolor: AppColor.redColor,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
}));
|
||||
} else if (mapPassengerController
|
||||
.selectedIndex ==
|
||||
3) {
|
||||
box.write(BoxName.carType, 'Lady');
|
||||
mapPassengerController.totalPassenger =
|
||||
mapPassengerController.totalPassengerLady;
|
||||
@@ -477,7 +539,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
||||
}));
|
||||
} else if (mapPassengerController
|
||||
.selectedIndex ==
|
||||
5) {
|
||||
6) {
|
||||
box.write(BoxName.carType, 'Rayeh Gai');
|
||||
mapPassengerController.totalPassenger =
|
||||
mapPassengerController.totalPassengerLady;
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/main.dart';
|
||||
import 'package:SEFER/views/auth/sms_verfy_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../controller/firebase/firbase_messge.dart';
|
||||
import '../../../controller/functions/audio_record1.dart';
|
||||
import '../../../controller/functions/tts.dart';
|
||||
import '../../../controller/home/map_passenger_controller.dart';
|
||||
|
||||
@@ -119,15 +121,7 @@ GetBuilder<MapPassengerController> leftMainMenuIcons() {
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: IconButton(
|
||||
onPressed: () async {
|
||||
FirebaseMessagesController().sendNotificationToDriverMAP(
|
||||
'message From passenger'.tr,
|
||||
'My location is correct. You can search for me using the navigation app'
|
||||
.tr,
|
||||
'db9hQ9BfT_2U-ocVHbEAej:APA91bG2YiVN8Dw3bNitehENk0sUPKt7A3zoT6GY_NdbxsMVKX8ouZRI6Ix9ScLSGYz31gugsb2Ag087FXmbPbQkD9E7nwOR7USPrai5euFjZXVHNrz2Byacn8gBTGr8HPV-CGHG81lk',
|
||||
[],
|
||||
'ding.wav',
|
||||
);
|
||||
// print(box.read(BoxName.tokenFCM));
|
||||
Get.to(SmsSignupEgypt());
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.chat,
|
||||
|
||||
Reference in New Issue
Block a user