2/22/1
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:SEFER/constant/colors.dart';
|
||||
import 'package:SEFER/constant/credential.dart';
|
||||
|
||||
class BottomBarController extends GetxController {
|
||||
var currentIndex = 0.obs;
|
||||
@@ -20,49 +19,49 @@ class HomeScreen extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Bottom Bar Example'),
|
||||
title: Text('Bottom Bar Example'.tr),
|
||||
),
|
||||
body: Obx(() => IndexedStack(
|
||||
index: controller.currentIndex.value,
|
||||
children: [
|
||||
children: const [
|
||||
HomeView(),
|
||||
const ProfileView(),
|
||||
const StatisticsView(),
|
||||
const WalletView(),
|
||||
ProfileView(),
|
||||
StatisticsView(),
|
||||
WalletView(),
|
||||
],
|
||||
)),
|
||||
bottomNavigationBar: Obx(() => BottomNavigationBar(
|
||||
backgroundColor: Colors.greenAccent,
|
||||
currentIndex: controller.currentIndex.value,
|
||||
onTap: controller.changePage,
|
||||
items: const [
|
||||
items: [
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(
|
||||
icon: const Icon(
|
||||
Icons.home,
|
||||
color: AppColor.primaryColor,
|
||||
),
|
||||
label: 'Home',
|
||||
label: 'Home'.tr,
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(
|
||||
icon: const Icon(
|
||||
Icons.person,
|
||||
color: AppColor.primaryColor,
|
||||
),
|
||||
label: 'Profile',
|
||||
label: 'Profile'.tr,
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(
|
||||
icon: const Icon(
|
||||
Icons.bar_chart,
|
||||
color: AppColor.primaryColor,
|
||||
),
|
||||
label: 'Statistics',
|
||||
label: 'Statistics'.tr,
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(
|
||||
icon: const Icon(
|
||||
Icons.account_balance_wallet,
|
||||
color: AppColor.primaryColor,
|
||||
),
|
||||
label: 'Wallet',
|
||||
label: 'Wallet'.tr,
|
||||
),
|
||||
],
|
||||
)),
|
||||
@@ -76,7 +75,7 @@ class HomeView extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Map<String, dynamic> data;
|
||||
return Center(
|
||||
return const Center(
|
||||
child: Column(
|
||||
children: [
|
||||
Text('Home View'),
|
||||
|
||||
@@ -154,7 +154,7 @@ class CameraWidgetCardId extends StatelessWidget {
|
||||
width: Get.width,
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Camera not initilaized yet',
|
||||
'Camera not initilaized yet'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:SEFER/views/widgets/my_scafold.dart';
|
||||
import '../../../controller/functions/location_controller.dart';
|
||||
import 'mapDriverWidgets/driver_end_ride_bar.dart';
|
||||
import 'mapDriverWidgets/google_driver_map_page.dart';
|
||||
import 'mapDriverWidgets/google_map_app.dart';
|
||||
import 'mapDriverWidgets/passenger_info_window.dart';
|
||||
import 'mapDriverWidgets/sos_connect.dart';
|
||||
|
||||
@@ -17,12 +18,13 @@ class PassengerLocationMapPage extends StatelessWidget {
|
||||
Get.put(MapDriverController());
|
||||
|
||||
return MyScafolld(
|
||||
title: 'Map'.tr,
|
||||
title: 'Map Passenger'.tr,
|
||||
body: [
|
||||
GoogleDriverMap(locationController: locationController),
|
||||
const PassengerInfoWindow(),
|
||||
driverEndRideBar(),
|
||||
const SosConnect(),
|
||||
const GoogleMapApp(),
|
||||
],
|
||||
isleading: true);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class HistoryCaptain extends StatelessWidget {
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'OrderID',
|
||||
'OrderId'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
@@ -66,7 +66,7 @@ class HistoryCaptain extends StatelessWidget {
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'created_at',
|
||||
'created time'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
|
||||
@@ -51,7 +51,7 @@ class HistoryDetailsPage extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text(
|
||||
'Order ID ${res['id']}',
|
||||
'${'Order ID'.tr} ${res['id']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
@@ -72,11 +72,11 @@ class HistoryDetailsPage extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text(
|
||||
'Price is ${res['price_for_driver']}',
|
||||
'${'Price is'.tr} ${res['price_for_driver']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
'Distance is ${res['distance']} KM',
|
||||
'${'Distance is'.tr} ${res['distance']} KM',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
@@ -100,15 +100,15 @@ class HistoryDetailsPage extends StatelessWidget {
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'To Passenger is ${res['DriverIsGoingToPassenger']}',
|
||||
'${'Time to Passenger is'.tr} ${res['DriverIsGoingToPassenger']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
'TimeStart is ${res['rideTimeStart']}',
|
||||
'${'TimeStart is'.tr} ${res['rideTimeStart']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
'Time Finish is ${res['rideTimeFinish']}',
|
||||
'${'Time Finish is'.tr} ${res['rideTimeFinish']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
@@ -124,7 +124,7 @@ class HistoryDetailsPage extends StatelessWidget {
|
||||
color: AppColor.greenColor, width: 2)),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Passenger Name is ${res['first_name']} ${res['last_name']} ',
|
||||
'${'Passenger Name is'.tr} ${res['first_name']} ${res['last_name']} ',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
@@ -139,7 +139,7 @@ class HistoryDetailsPage extends StatelessWidget {
|
||||
color: AppColor.yellowColor, width: 2)),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Status is ${res['status']}',
|
||||
'${'Status is'.tr} ${res['status']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -5,17 +5,16 @@ import 'package:get/get.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
import '../../../../constant/box_name.dart';
|
||||
import '../../../../controller/firebase/firbase_messge.dart';
|
||||
import '../../../../controller/home/captin/map_driver_controller.dart';
|
||||
import '../../../../main.dart';
|
||||
|
||||
class CallController extends GetxController {
|
||||
String channelName =
|
||||
'sefer300'; //Get.find<MapDriverController>().passengerId;
|
||||
String token =
|
||||
"00612994c6e707543e68d5638894d04f989IAA9fx7yHezOOXPq1l4MwrNgPVOxWj7VnirB9Ks6X37jS6MLiA8AAAAAEABXi+nQ7GjSZQEAAQAAAAAA";
|
||||
|
||||
String channelName = ''; // Get.find<MapDriverController>().rideId;
|
||||
String token = '';
|
||||
// int uid = int.parse(box.read(BoxName.phoneDriver)); // uid of the local user
|
||||
int uid = 0;
|
||||
int? _remoteUid; // uid of the remote user
|
||||
int? remoteUid; // uid of the remote user
|
||||
bool _isJoined = false; // Indicates if the local user has joined the channel
|
||||
String status = '';
|
||||
late RtcEngine agoraEngine; // Agora engine instance
|
||||
@@ -23,21 +22,31 @@ class CallController extends GetxController {
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
channelName = Get.find<MapDriverController>().rideId; // 'sefer300'; //
|
||||
remoteUid = int.parse(Get.find<MapDriverController>().phone);
|
||||
uid = int.parse(box.read(BoxName.phoneDriver));
|
||||
// initAgoraFull();
|
||||
}
|
||||
|
||||
initAgoraFull() async {
|
||||
_remoteUid = box.read(BoxName.phone) != null
|
||||
? int.parse(box.read(BoxName.phone))
|
||||
: int.parse(box.read(BoxName.phoneDriver));
|
||||
uid = box.read(BoxName.phoneDriver) != null
|
||||
? int.parse(box.read(BoxName.phoneDriver))
|
||||
: int.parse(box.read(BoxName.phone));
|
||||
print('remoteid is $_remoteUid');
|
||||
print('remoteid is $remoteUid');
|
||||
print('uid is $uid');
|
||||
// await fetchToken();
|
||||
await fetchToken();
|
||||
// Set up an instance of Agora engine
|
||||
setupVoiceSDKEngine();
|
||||
join();
|
||||
FirebaseMessagesController().sendNotificationToPassengerToken(
|
||||
'Call Income'.tr,
|
||||
'${'You have call from driver'.tr} ${box.read(BoxName.nameDriver)}',
|
||||
Get.find<MapDriverController>().tokenPassenger,
|
||||
[
|
||||
token,
|
||||
channelName,
|
||||
uid.toString(),
|
||||
remoteUid.toString(),
|
||||
],
|
||||
);
|
||||
join();
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -59,25 +68,26 @@ class CallController extends GetxController {
|
||||
agoraEngine.registerEventHandler(
|
||||
RtcEngineEventHandler(
|
||||
onJoinChannelSuccess: (RtcConnection connection, int elapsed) {
|
||||
Get.snackbar(
|
||||
"Local user uid:${connection.localUid} joined the channel", '');
|
||||
// Get.snackbar(
|
||||
// "Local user uid:${connection.localUid} joined the channel", '');
|
||||
status = 'joined'.tr;
|
||||
_isJoined = true;
|
||||
update();
|
||||
},
|
||||
onUserJoined: (RtcConnection connection, int remoteUid, int elapsed) {
|
||||
Get.snackbar("Remote user uid:$remoteUid joined the channel", '');
|
||||
status = '${box.read(BoxName.nameDriver) ?? box.read(BoxName.name)}'
|
||||
// Get.snackbar("Remote user uid:$remoteUid joined the channel", '');
|
||||
status = '${Get.find<MapDriverController>().name}'
|
||||
' joined'
|
||||
.tr
|
||||
.tr;
|
||||
_remoteUid = remoteUid;
|
||||
remoteUid = remoteUid;
|
||||
update();
|
||||
},
|
||||
onUserOffline: (RtcConnection connection, int remoteUid,
|
||||
onUserOffline: (RtcConnection connection, int? remoteUid,
|
||||
UserOfflineReasonType reason) {
|
||||
Get.snackbar("Remote user uid:$remoteUid left the channel", '');
|
||||
// Get.snackbar("Remote user uid:$remoteUid left the channel", '');
|
||||
status = 'Call left'.tr;
|
||||
_remoteUid = null;
|
||||
remoteUid = null;
|
||||
update();
|
||||
},
|
||||
),
|
||||
@@ -101,7 +111,7 @@ class CallController extends GetxController {
|
||||
|
||||
void leave() {
|
||||
_isJoined = false;
|
||||
_remoteUid = null;
|
||||
remoteUid = null;
|
||||
update();
|
||||
agoraEngine.leaveChannel();
|
||||
}
|
||||
@@ -114,13 +124,9 @@ class CallController extends GetxController {
|
||||
}
|
||||
|
||||
fetchToken() async {
|
||||
var res = await CRUD().getAgora(
|
||||
channelName: 'sefer22'); //Get.find<MapDriverController>().rideId);
|
||||
|
||||
print('hhhhhhhhhhhhhhhhhhhhhhh');
|
||||
print(res);
|
||||
channelName = 'sefer22';
|
||||
token = res['token'];
|
||||
var res = await CRUD()
|
||||
.getAgoraToken(channelName: channelName, uid: uid.toString());
|
||||
token = res;
|
||||
print('token is $token');
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class DrawerCaptain extends StatelessWidget {
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.account_balance_wallet),
|
||||
title: const Text('Wallet'),
|
||||
title: Text('Wallet'.tr),
|
||||
onTap: () {
|
||||
// Handle wallet item tap
|
||||
Get.to(() => WaletCaptain(), transition: Transition.native);
|
||||
@@ -46,7 +46,7 @@ class DrawerCaptain extends StatelessWidget {
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.person),
|
||||
title: const Text('Profile'),
|
||||
title: Text('Profile'.tr),
|
||||
onTap: () {
|
||||
// Handle profile item tap
|
||||
Get.to(() => const ProfileCaptain(),
|
||||
@@ -55,7 +55,7 @@ class DrawerCaptain extends StatelessWidget {
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.history),
|
||||
title: const Text('History of Trip'),
|
||||
title: Text('History of Trip'.tr),
|
||||
onTap: () {
|
||||
Get.to(() => const HistoryCaptain(),
|
||||
transition: Transition.downToUp);
|
||||
@@ -64,7 +64,7 @@ class DrawerCaptain extends StatelessWidget {
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.notifications),
|
||||
title: const Text('Notifications'),
|
||||
title: Text('Notifications'.tr),
|
||||
onTap: () {
|
||||
// Handle notifications item tap
|
||||
Get.to(() => const NotificationCaptain(),
|
||||
@@ -73,7 +73,7 @@ class DrawerCaptain extends StatelessWidget {
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.help),
|
||||
title: const Text('Helping Center'),
|
||||
title: Text('Helping Center'.tr),
|
||||
onTap: () {
|
||||
// Handle helping center item tap
|
||||
Get.to(() => HelpCaptain(), transition: Transition.size);
|
||||
@@ -81,7 +81,7 @@ class DrawerCaptain extends StatelessWidget {
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.settings),
|
||||
title: const Text('Settings'),
|
||||
title: Text('Settings'.tr),
|
||||
onTap: () {
|
||||
// Handle settings item tap
|
||||
Get.to(() => const SettingsCaptain(),
|
||||
@@ -90,7 +90,7 @@ class DrawerCaptain extends StatelessWidget {
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.exit_to_app),
|
||||
title: const Text('Sign Out'),
|
||||
title: Text('Sign Out'.tr),
|
||||
onTap: () {
|
||||
// Handle sign out item tap
|
||||
Get.to(() => const LogoutCaptain(),
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
import 'dart:async';
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/main.dart';
|
||||
import 'package:SEFER/views/widgets/my_scafold.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
import 'package:agora_rtc_engine/agora_rtc_engine.dart';
|
||||
|
||||
import '../../../../constant/api_key.dart';
|
||||
import '../../../../controller/functions/crud.dart';
|
||||
|
||||
const String appId = AK.agoraAppId;
|
||||
|
||||
@@ -18,9 +21,9 @@ class DriverCallPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _DriverCallPageState extends State<DriverCallPage> {
|
||||
String channelName = 'sefer300';
|
||||
String token =
|
||||
"00612994c6e707543e68d5638894d04f989IAACchY2SBwRcuw2mt+BocxbF+fmFKvjOS/hekkirRWfuqMLiA8AAAAAEADs3TvfbjrSZQEAAQAAAAAA";
|
||||
String channelName = '';
|
||||
String token = '';
|
||||
// "00612994c6e707543e68d5638894d04f989IAAlydoFEC3ZeZkeUwl0dSswZTX8n+xyZR8PBWdwXFV6t6MLiA8AAAAAEACCHD/gn3TUZQEAAQAAAAAA";
|
||||
|
||||
// int uid = int.parse(box.read(BoxName.phoneDriver)); // uid of the local user
|
||||
int uid = 0;
|
||||
@@ -37,6 +40,20 @@ class _DriverCallPageState extends State<DriverCallPage> {
|
||||
));
|
||||
}
|
||||
|
||||
initAgora() async {
|
||||
await fetchToken();
|
||||
await setupVoiceSDKEngine();
|
||||
}
|
||||
|
||||
fetchToken() async {
|
||||
var res = await CRUD()
|
||||
.getAgoraToken(channelName: channelName, uid: uid.toString());
|
||||
setState(() {
|
||||
token = res;
|
||||
print('token is $token');
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -49,7 +66,7 @@ class _DriverCallPageState extends State<DriverCallPage> {
|
||||
print('remoteid is $_remoteUid');
|
||||
print('uid is $uid');
|
||||
// Set up an instance of Agora engine
|
||||
setupVoiceSDKEngine();
|
||||
initAgora();
|
||||
}
|
||||
|
||||
Future<void> setupVoiceSDKEngine() async {
|
||||
@@ -124,35 +141,39 @@ class _DriverCallPageState extends State<DriverCallPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
scaffoldMessengerKey: scaffoldMessengerKey,
|
||||
home: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Get started with Voice Calling'),
|
||||
),
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||
children: [
|
||||
// Status text
|
||||
Container(height: 40, child: Center(child: _status())),
|
||||
// Button Row
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
child: const Text("Join"),
|
||||
onPressed: () => {join()},
|
||||
home: MyScafolld(
|
||||
// appBar: AppBar(
|
||||
// title: const Text('Get started with Voice Calling'),
|
||||
// ),
|
||||
title: 'Voice Calling'.tr,
|
||||
isleading: true,
|
||||
body: [
|
||||
ListView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||
children: [
|
||||
// Status text
|
||||
Container(height: 40, child: Center(child: _status())),
|
||||
// Button Row
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
child: const Text("Join"),
|
||||
onPressed: () => {join()},
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
child: const Text("Leave"),
|
||||
onPressed: () => {leave()},
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
child: const Text("Leave"),
|
||||
onPressed: () => {leave()},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,14 +46,14 @@ class HelpCaptain extends StatelessWidget {
|
||||
child: TextFormField(
|
||||
controller:
|
||||
helpController.helpQuestionController,
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
hintText: 'Enter your Question here',
|
||||
labelText: 'Question',
|
||||
decoration: InputDecoration(
|
||||
border: const OutlineInputBorder(),
|
||||
hintText: 'Enter your Question here'.tr,
|
||||
labelText: 'Question'.tr,
|
||||
),
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Please enter your Question.';
|
||||
return 'Please enter your Question.'.tr;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
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/widgets/mycircular.dart';
|
||||
|
||||
|
||||
@@ -184,41 +184,41 @@ class HomeCaptain extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
bottom: Get.height * .17,
|
||||
right: Get.width * .01,
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: Get.width * .12,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
border: Border.all(),
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
Get.to(
|
||||
() => const DriverCallPage(),
|
||||
);
|
||||
},
|
||||
icon: const Icon(Fontisto.phone),
|
||||
),
|
||||
),
|
||||
),
|
||||
// Positioned(
|
||||
// bottom: Get.height * .17,
|
||||
// right: Get.width * .01,
|
||||
// child: AnimatedContainer(
|
||||
// duration: const Duration(microseconds: 200),
|
||||
// width: Get.width * .12,
|
||||
// decoration: BoxDecoration(
|
||||
// color: AppColor.secondaryColor,
|
||||
// border: Border.all(),
|
||||
// borderRadius: BorderRadius.circular(15)),
|
||||
// child: IconButton(
|
||||
// onPressed: () {
|
||||
// Get.to(
|
||||
// () => const DriverCallPage(),
|
||||
// );
|
||||
// },
|
||||
// icon: const Icon(Fontisto.phone),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
leftMainMenuCaptainIcons(),
|
||||
// callPage(),
|
||||
|
||||
Positioned(
|
||||
top: Get.height * .2,
|
||||
// left: 20,
|
||||
// right: 20,
|
||||
bottom: Get.height * .4,
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
Get.to(() => const CallPage());
|
||||
},
|
||||
icon: const Icon(Icons.call),
|
||||
),
|
||||
),
|
||||
// Positioned(
|
||||
// top: Get.height * .2,
|
||||
// // left: 20,
|
||||
// // right: 20,
|
||||
// bottom: Get.height * .4,
|
||||
// child: IconButton(
|
||||
// onPressed: () {
|
||||
// Get.to(() => const CallPage());
|
||||
// },
|
||||
// icon: const Icon(Icons.call),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -38,8 +38,8 @@ GetBuilder<MapDriverController> driverEndRideBar() {
|
||||
const Icon(Icons.timelapse),
|
||||
Text(
|
||||
mapDriverController.hours > 1
|
||||
? '${'Your Ride Duration is '.tr}${mapDriverController.hours} H and ${mapDriverController.minutes} m'
|
||||
: '${'Your Ride Duration is '.tr} ${mapDriverController.minutes} m',
|
||||
? '${'${'Your Ride Duration is '.tr}${mapDriverController.hours}${' H and'.tr}'} ${mapDriverController.minutes} m'
|
||||
: '${'Your Ride Duration is '.tr} ${mapDriverController.minutes} ${'m'.tr}',
|
||||
style: AppStyle.title),
|
||||
],
|
||||
),
|
||||
|
||||
51
lib/views/home/Captin/mapDriverWidgets/google_map_app.dart
Normal file
51
lib/views/home/Captin/mapDriverWidgets/google_map_app.dart
Normal file
@@ -0,0 +1,51 @@
|
||||
import 'package:SEFER/constant/style.dart';
|
||||
import 'package:SEFER/controller/home/captin/map_driver_controller.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class GoogleMapApp extends StatelessWidget {
|
||||
const GoogleMapApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<MapDriverController>(
|
||||
builder: (mapDriverController) => mapDriverController.isRideStarted
|
||||
? Positioned(
|
||||
left: 125,
|
||||
bottom: 20,
|
||||
child: Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
child: IconButton(
|
||||
onPressed: () async {
|
||||
var startLat = Get.find<MapDriverController>()
|
||||
.latLngpassengerLocation
|
||||
.latitude;
|
||||
var startLng = Get.find<MapDriverController>()
|
||||
.latLngpassengerLocation
|
||||
.longitude;
|
||||
|
||||
var endLat = Get.find<MapDriverController>()
|
||||
.latLngPassengerDestination
|
||||
.latitude;
|
||||
var endLng = Get.find<MapDriverController>()
|
||||
.latLngPassengerDestination
|
||||
.longitude;
|
||||
|
||||
String url =
|
||||
'https://www.google.com/maps/dir/$startLat,$startLng/$endLat,$endLng/&directionsmode=driving';
|
||||
if (await canLaunchUrl(Uri.parse(url))) {
|
||||
await launchUrl(Uri.parse(url));
|
||||
} else {
|
||||
throw 'Could not launch google maps';
|
||||
}
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.map,
|
||||
size: 45,
|
||||
),
|
||||
)),
|
||||
)
|
||||
: const SizedBox());
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
import 'package:animated_text_kit/animated_text_kit.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_font_icons/flutter_font_icons.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/constant/colors.dart';
|
||||
@@ -12,6 +10,7 @@ import 'package:SEFER/views/widgets/elevated_btn.dart';
|
||||
|
||||
import '../../../../constant/style.dart';
|
||||
import '../../../../controller/functions/launch.dart';
|
||||
import '../../../../controller/home/captin/widget/call_page.dart';
|
||||
|
||||
class PassengerInfoWindow extends StatelessWidget {
|
||||
const PassengerInfoWindow({
|
||||
@@ -102,51 +101,51 @@ class PassengerInfoWindow extends StatelessWidget {
|
||||
controller.isSocialPressed = true;
|
||||
await controller
|
||||
.driverCallPassenger();
|
||||
|
||||
launchCommunication('phone',
|
||||
controller.phone.toString(), '');
|
||||
Get.to(() => const CallPage());
|
||||
// launchCommunication('phone',
|
||||
// controller.phone.toString(), '');
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.phone,
|
||||
color: AppColor.blueColor,
|
||||
)),
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
controller.isSocialPressed = true;
|
||||
await controller
|
||||
.driverCallPassenger();
|
||||
// IconButton(
|
||||
// onPressed: () async {
|
||||
// controller.isSocialPressed = true;
|
||||
// await controller
|
||||
// .driverCallPassenger();
|
||||
|
||||
launchCommunication(
|
||||
'whatsapp',
|
||||
controller.phone.toString(),
|
||||
'${'Hello this is Driver'.tr} ${box.read(BoxName.nameDriver)}');
|
||||
},
|
||||
icon: const Icon(
|
||||
FontAwesome.whatsapp,
|
||||
color: AppColor.greenColor,
|
||||
)),
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
controller.isSocialPressed = true;
|
||||
await controller
|
||||
.driverCallPassenger();
|
||||
// launchCommunication(
|
||||
// 'whatsapp',
|
||||
// controller.phone.toString(),
|
||||
// '${'Hello this is Driver'.tr} ${box.read(BoxName.nameDriver)}');
|
||||
// },
|
||||
// icon: const Icon(
|
||||
// FontAwesome.whatsapp,
|
||||
// color: AppColor.greenColor,
|
||||
// )),
|
||||
// IconButton(
|
||||
// onPressed: () async {
|
||||
// controller.isSocialPressed = true;
|
||||
// await controller
|
||||
// .driverCallPassenger();
|
||||
|
||||
launchCommunication(
|
||||
'sms',
|
||||
controller.phone.toString(),
|
||||
'${'Hello this is Driver'.tr} ${box.read(BoxName.nameDriver)}');
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.sms_rounded,
|
||||
color: AppColor.blueColor,
|
||||
)),
|
||||
// launchCommunication(
|
||||
// 'sms',
|
||||
// controller.phone.toString(),
|
||||
// '${'Hello this is Driver'.tr} ${box.read(BoxName.nameDriver)}');
|
||||
// },
|
||||
// icon: const Icon(
|
||||
// Icons.sms_rounded,
|
||||
// color: AppColor.blueColor,
|
||||
// )),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
controller.isSocialPressed = true;
|
||||
launchCommunication(
|
||||
'email',
|
||||
controller.phone.toString(),
|
||||
'${'Hello this is Captain'.tr} ${box.read(BoxName.nameDriver)}');
|
||||
'${'Hello this is Driver'.tr} ${box.read(BoxName.nameDriver)}');
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.email,
|
||||
@@ -222,8 +221,7 @@ class PassengerInfoWindow extends StatelessWidget {
|
||||
40) {
|
||||
FirebaseMessagesController()
|
||||
.sendNotificationToPassengerToken(
|
||||
'Hi ,I Arrive your site'
|
||||
.tr,
|
||||
'Hi ,I Arrive your site',
|
||||
'I Arrive your site'
|
||||
.tr,
|
||||
controller
|
||||
@@ -300,6 +298,7 @@ class PassengerInfoWindow extends StatelessWidget {
|
||||
title:
|
||||
'Are you sure to cancel?'
|
||||
.tr,
|
||||
middleText: '',
|
||||
confirm:
|
||||
MyElevatedButton(
|
||||
title:
|
||||
@@ -307,8 +306,7 @@ class PassengerInfoWindow extends StatelessWidget {
|
||||
onPressed:
|
||||
() async {
|
||||
FirebaseMessagesController().sendNotificationToPassengerToken(
|
||||
'Driver Cancel Your Trip'
|
||||
.tr,
|
||||
'Driver Cancel Your Trip',
|
||||
'You will be pay the cost to driver or we will get it from you on next trip'
|
||||
.tr,
|
||||
controller
|
||||
|
||||
@@ -28,7 +28,7 @@ class SosConnect extends StatelessWidget {
|
||||
child: Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
height: 60,
|
||||
width: 100,
|
||||
width: 110,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
@@ -65,6 +65,7 @@ class SosConnect extends StatelessWidget {
|
||||
},
|
||||
child: const Icon(
|
||||
Icons.sos_sharp,
|
||||
size: 45,
|
||||
color: AppColor.redColor,
|
||||
),
|
||||
),
|
||||
@@ -95,15 +96,17 @@ class SosConnect extends StatelessWidget {
|
||||
.text);
|
||||
}
|
||||
}));
|
||||
} else {
|
||||
launchCommunication(
|
||||
'whatsapp',
|
||||
'+962${box.read(BoxName.sosPhoneDriver)}', //todo add number from driver
|
||||
"${"Hello this is Driver".tr} ${box.read(BoxName.nameDriver)}.${" My current location is:".tr} https://www.google.com/maps/place/${Get.find<LocationController>().myLocation.latitude},${Get.find<LocationController>().myLocation.longitude}${" \nand I have a trip on".tr} ${AppInformation.appName} ${"App \nwith Passenger ".tr}${mapDriverController.name}");
|
||||
}
|
||||
launchCommunication(
|
||||
'whatsapp',
|
||||
'+962${box.read(BoxName.sosPhoneDriver)}', //todo add number from driver
|
||||
"Hello this is Driver ${box.read(BoxName.nameDriver)}. My current location is: https://www.google.com/maps/place/${Get.find<LocationController>().myLocation.latitude},${Get.find<LocationController>().myLocation.longitude} \nand I have a trip on ${AppInformation.appName} App \nwith Passenger ${mapDriverController.name}");
|
||||
},
|
||||
child: const Icon(
|
||||
FontAwesome.whatsapp,
|
||||
color: AppColor.greenColor,
|
||||
size: 45,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -171,7 +171,7 @@ class OrderRequestPage extends StatelessWidget {
|
||||
children: [
|
||||
TextSpan(
|
||||
text: hours > 1
|
||||
? '${'Your Ride Duration is '.tr}$hours H and $minutes m'
|
||||
? '${'Your Ride Duration is '.tr}$hours${' H and'.tr} $minutes m'
|
||||
: '${'Your Ride Duration is '.tr} $minutes m',
|
||||
style: AppStyle.title),
|
||||
TextSpan(text: ' Minutes'.tr, style: AppStyle.title),
|
||||
@@ -185,7 +185,7 @@ class OrderRequestPage extends StatelessWidget {
|
||||
children: [
|
||||
MyElevatedButton(
|
||||
kolor: AppColor.greenColor,
|
||||
title: 'Apply Order'.tr,
|
||||
title: 'Accept Order'.tr,
|
||||
onPressed: () async {
|
||||
box.write(BoxName.statusDriverLocation, 'on');
|
||||
|
||||
@@ -246,6 +246,7 @@ class OrderRequestPage extends StatelessWidget {
|
||||
'step3': myList[24].toString(),
|
||||
'step4': myList[25].toString(),
|
||||
'passengerWalletBurc': myList[26].toString(),
|
||||
'timeOfOrder': DateTime.now().toString(),
|
||||
});
|
||||
},
|
||||
),
|
||||
@@ -282,7 +283,7 @@ class OrderRequestPage extends StatelessWidget {
|
||||
FirebaseMessagesController()
|
||||
.sendNotificationToPassengerToken(
|
||||
'Refused Ride',
|
||||
'${box.read(BoxName.nameDriver)} rejct your order.',
|
||||
'${box.read(BoxName.nameDriver)} ${'rejct your order.'.tr}',
|
||||
arguments['DriverList'][9].toString(),
|
||||
// box.read(BoxName.tokenDriver).toString(),
|
||||
bodyToPassenger,
|
||||
|
||||
@@ -17,7 +17,7 @@ class SettingsCaptain extends StatelessWidget {
|
||||
ListTile(
|
||||
leading: const Icon(Icons.language),
|
||||
title: Text(
|
||||
'Language',
|
||||
'Language'.tr,
|
||||
style: AppStyle.headTitle2,
|
||||
),
|
||||
onTap: () => Get.to(const Language()),
|
||||
|
||||
Reference in New Issue
Block a user