2/22/1
This commit is contained in:
@@ -500,11 +500,11 @@ class Details extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Text(
|
||||
'${'distance is'.tr} ${controller.data[0]['distance']['text']}',
|
||||
'${'Distance is'.tr} ${controller.data[0]['distance']['text']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
'${'duration is'.tr} ${controller.data[0]['duration']['text']}',
|
||||
'${'Duration is'.tr} ${controller.data[0]['duration']['text']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
@@ -517,7 +517,7 @@ class Details extends StatelessWidget {
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
'costDuration ${controller.averageDuration.toStringAsFixed(2)} is ${controller.costDuration.toStringAsFixed(2)} ',
|
||||
'${'Cost Duration'.tr} ${controller.averageDuration.toStringAsFixed(2)} is ${controller.costDuration.toStringAsFixed(2)} ',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
@@ -526,7 +526,7 @@ class Details extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Text(
|
||||
'totalDriver ${controller.totalDriver.toStringAsFixed(2)}',
|
||||
'Total Driver ${controller.totalDriver.toStringAsFixed(2)}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
|
||||
180
lib/views/home/map_widget.dart/call_passenger_page.dart
Normal file
180
lib/views/home/map_widget.dart/call_passenger_page.dart
Normal file
@@ -0,0 +1,180 @@
|
||||
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';
|
||||
|
||||
const String appId = AK.agoraAppId;
|
||||
|
||||
class PassengerCallPage extends StatefulWidget {
|
||||
const PassengerCallPage({
|
||||
super.key,
|
||||
required this.channelName,
|
||||
required this.token,
|
||||
required this.remoteID,
|
||||
});
|
||||
final String channelName, token, remoteID;
|
||||
@override
|
||||
State<PassengerCallPage> createState() => _PassengerCallPageState();
|
||||
}
|
||||
|
||||
class _PassengerCallPageState extends State<PassengerCallPage> {
|
||||
int uid = 0;
|
||||
int? _remoteUid = 0; // uid of the remote user
|
||||
bool _isJoined = false; // Indicates if the local user has joined the channel
|
||||
late RtcEngine agoraEngine; // Agora engine instance
|
||||
|
||||
final GlobalKey<ScaffoldMessengerState> scaffoldMessengerKey =
|
||||
GlobalKey<ScaffoldMessengerState>(); // Global key to access the scaffold
|
||||
|
||||
showMessage(String message) {
|
||||
scaffoldMessengerKey.currentState?.showSnackBar(SnackBar(
|
||||
content: Text(message),
|
||||
));
|
||||
}
|
||||
|
||||
initAgora() async {
|
||||
await setupVoiceSDKEngine();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_remoteUid = int.parse(widget.remoteID);
|
||||
uid = int.parse(box.read(BoxName.phone));
|
||||
print('remoteid is ${widget.remoteID}');
|
||||
print('token is ${widget.token}');
|
||||
print('channelName is ${widget.channelName}');
|
||||
// Set up an instance of Agora engine
|
||||
initAgora();
|
||||
}
|
||||
|
||||
Future<void> setupVoiceSDKEngine() async {
|
||||
// retrieve or request microphone permission
|
||||
await [Permission.microphone].request();
|
||||
|
||||
//create an instance of the Agora engine
|
||||
agoraEngine = createAgoraRtcEngine();
|
||||
await agoraEngine.initialize(const RtcEngineContext(appId: AK.agoraAppId));
|
||||
print('eeeeeeeeeeeeeeeeeeee');
|
||||
print(agoraEngine);
|
||||
// Register the event handler
|
||||
agoraEngine.registerEventHandler(
|
||||
RtcEngineEventHandler(
|
||||
onJoinChannelSuccess: (RtcConnection connection, int elapsed) {
|
||||
showMessage(
|
||||
"Local user uid:${connection.localUid} joined the channel");
|
||||
setState(() {
|
||||
_isJoined = true;
|
||||
});
|
||||
},
|
||||
onUserJoined: (RtcConnection connection, int remoteUid, int elapsed) {
|
||||
showMessage("Remote user uid:$remoteUid joined the channel");
|
||||
setState(() {
|
||||
_remoteUid = remoteUid;
|
||||
});
|
||||
},
|
||||
onUserOffline: (RtcConnection connection, int? remoteUid,
|
||||
UserOfflineReasonType reason) {
|
||||
showMessage("Remote user uid:$remoteUid left the channel");
|
||||
setState(() {
|
||||
_remoteUid = null;
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void join() async {
|
||||
// Set channel options including the client role and channel profile
|
||||
ChannelMediaOptions options = const ChannelMediaOptions(
|
||||
clientRoleType: ClientRoleType.clientRoleBroadcaster,
|
||||
channelProfile: ChannelProfileType.channelProfileCommunication,
|
||||
);
|
||||
|
||||
await agoraEngine.joinChannel(
|
||||
token: widget.token,
|
||||
channelId: widget.channelName,
|
||||
options: options,
|
||||
uid: uid,
|
||||
);
|
||||
}
|
||||
//https://console.agora.io/invite?sign=5e9e22d06f22caeeada9954c9e908572%253A5ba8aed978a35eab5a5113742502ded2a41478b2a81cb19c71a30776e125b58a
|
||||
|
||||
void leave() {
|
||||
setState(() {
|
||||
_isJoined = false;
|
||||
_remoteUid = null;
|
||||
});
|
||||
agoraEngine.leaveChannel();
|
||||
}
|
||||
|
||||
// Clean up the resources when you leave
|
||||
@override
|
||||
void dispose() async {
|
||||
await agoraEngine.leaveChannel();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
// Build UI
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
scaffoldMessengerKey: scaffoldMessengerKey,
|
||||
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: Text("Join".tr),
|
||||
onPressed: () => {join()},
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
child: Text("Leave".tr),
|
||||
onPressed: () => {leave()},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _status() {
|
||||
String statusText;
|
||||
|
||||
if (!_isJoined)
|
||||
statusText = 'Join a channel';
|
||||
else if (_remoteUid == null)
|
||||
statusText = 'Waiting for a remote user to join...';
|
||||
else
|
||||
statusText = 'Connected to remote user, uid:$_remoteUid';
|
||||
|
||||
return Text(
|
||||
statusText,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:SEFER/constant/info.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
@@ -64,12 +65,12 @@ class CashConfirmPageShown extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Ride Wallet'.tr,
|
||||
'${AppInformation.appName} Wallet'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
// '${'Your Wallet balance is '.tr}JD ',
|
||||
'${'Your Wallet balance is '.tr} ${box.read(BoxName.passengerWalletTotal).toString()} \$',
|
||||
'${'Your Wallet balance is '.tr} ${box.read(BoxName.passengerWalletTotal).toString()}${' \$'.tr}',
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
],
|
||||
|
||||
@@ -52,14 +52,7 @@ GetBuilder<MapPassengerController> hexagonClipper() {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text(
|
||||
controller.dataCarsLocationByPassenger['message']
|
||||
[controller.carsOrder]['first_name']
|
||||
.toString() +
|
||||
' ' +
|
||||
controller
|
||||
.dataCarsLocationByPassenger['message']
|
||||
[controller.carsOrder]['last_name']
|
||||
.toString(),
|
||||
'${controller.dataCarsLocationByPassenger['message'][controller.carsOrder]['first_name']} ${controller.dataCarsLocationByPassenger['message'][controller.carsOrder]['last_name']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
|
||||
@@ -82,8 +82,7 @@ GetBuilder<MapPassengerController> formSearchPlacesDestenation() {
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
List recentLocations = await sql.getCustomQuery(
|
||||
'''
|
||||
List recentLocations = await sql.getCustomQuery('''
|
||||
SELECT * FROM ${TableName.recentLocations}
|
||||
ORDER BY id DESC
|
||||
LIMIT 4
|
||||
@@ -143,7 +142,7 @@ GetBuilder<MapPassengerController> formSearchPlacesDestenation() {
|
||||
// ignore: use_build_context_synchronously
|
||||
Toast.show(
|
||||
context,
|
||||
'${'You are Delete'.tr} ${recentLocations[index]['name']} from your list',
|
||||
'${'You are Delete'.tr} ${recentLocations[index]['name']} ${'from your list'.tr}',
|
||||
AppColor.redColor);
|
||||
// Get.snackbar('Deleted'.tr,
|
||||
// '${'You are Delete'.tr} ${favoritePlaces[index]['name']} from your list',
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:SEFER/constant/table_names.dart';
|
||||
import 'package:SEFER/views/widgets/my_textField.dart';
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../constant/style.dart';
|
||||
|
||||
@@ -66,7 +66,7 @@ GetBuilder<MapPassengerController> formSearchPlaces(int index) {
|
||||
controller.changePickerShown();
|
||||
},
|
||||
child: Text(
|
||||
'Choose from Map $index'.tr,
|
||||
'Choose from Map'.tr + ' $index'.tr,
|
||||
style:
|
||||
AppStyle.title.copyWith(color: AppColor.blueColor),
|
||||
),
|
||||
|
||||
@@ -48,7 +48,7 @@ class GoogleMapPassengerWidget extends StatelessWidget {
|
||||
Get.snackbar(
|
||||
'We Are Sorry That we dont have cars in your Location!'
|
||||
.tr,
|
||||
'message',
|
||||
'',
|
||||
colorText: AppColor.redColor,
|
||||
duration: const Duration(seconds: 11),
|
||||
instantInit: true,
|
||||
|
||||
@@ -7,7 +7,6 @@ import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/main.dart';
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../controller/firebase/local_notification.dart';
|
||||
import '../../../controller/functions/tts.dart';
|
||||
import '../../../controller/home/map_passenger_controller.dart';
|
||||
import '../Captin/home_captain/driver_call_page.dart';
|
||||
@@ -113,7 +112,12 @@ GetBuilder<MapPassengerController> leftMainMenuIcons() {
|
||||
// NotificationController()
|
||||
// .showNotification('Order', 'hi this is', 'tone1');
|
||||
Get.to(() => DriverCallPage());
|
||||
// Get.to(() => CallPage(callID: controller.rideId));
|
||||
// PassengerCallPage(
|
||||
// channelName: '',
|
||||
// token: '',
|
||||
// remoteID: '',
|
||||
// )
|
||||
// Get.to(() => const CallPage());
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.call,
|
||||
|
||||
@@ -168,8 +168,7 @@ class MainBottomMenuMap extends StatelessWidget {
|
||||
icon:
|
||||
controller.isMainBottomMenuMap
|
||||
? const Icon(
|
||||
Icons
|
||||
.arrow_circle_up_rounded,
|
||||
Icons.ads_click,
|
||||
size: 35,
|
||||
)
|
||||
: const Icon(
|
||||
@@ -262,7 +261,8 @@ class MainBottomMenuMap extends StatelessWidget {
|
||||
controller.getCurrentLocationFormString();
|
||||
},
|
||||
child: Text(
|
||||
'From : ${controller.currentLocationString}'.tr,
|
||||
'From :'.tr +
|
||||
' ${controller.currentLocationString}'.tr,
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -113,21 +113,21 @@ class MapMenuWidget extends StatelessWidget {
|
||||
onTap: () {
|
||||
Get.to(() => const PassengerWallet());
|
||||
},
|
||||
title: 'My Wallet',
|
||||
title: 'My Wallet'.tr,
|
||||
icon: Icons.wallet,
|
||||
),
|
||||
IconMainPageMap(
|
||||
onTap: () async {
|
||||
Get.to(() => const OrderHistory());
|
||||
},
|
||||
title: 'Order History',
|
||||
title: 'Order History'.tr,
|
||||
icon: Icons.history,
|
||||
),
|
||||
IconMainPageMap(
|
||||
onTap: () {
|
||||
Get.to(() => const TaarifPage());
|
||||
},
|
||||
title: 'Tariff',
|
||||
title: 'Tariff'.tr,
|
||||
icon: Icons.money,
|
||||
),
|
||||
],
|
||||
@@ -164,21 +164,21 @@ class MapMenuWidget extends StatelessWidget {
|
||||
onTap: () {
|
||||
Get.to(const RegisterCaptin());
|
||||
},
|
||||
title: 'Captain',
|
||||
title: 'Driver'.tr,
|
||||
icon: WeatherIcons.wi_moon_14,
|
||||
),
|
||||
IconMainPageMap(
|
||||
onTap: () {
|
||||
Get.to(() => FeedBackPage());
|
||||
},
|
||||
title: 'Feed Back',
|
||||
title: 'Feed Back'.tr,
|
||||
icon: Icons.feedback,
|
||||
),
|
||||
IconMainPageMap(
|
||||
onTap: () {
|
||||
Get.to(() => const PromosPassengerPage());
|
||||
},
|
||||
title: 'Promos',
|
||||
title: 'Promos'.tr,
|
||||
icon: Icons.monetization_on,
|
||||
),
|
||||
],
|
||||
|
||||
86
lib/views/home/map_widget.dart/new_main_bottom_sheet.dart
Normal file
86
lib/views/home/map_widget.dart/new_main_bottom_sheet.dart
Normal file
@@ -0,0 +1,86 @@
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/constant/colors.dart';
|
||||
import 'package:SEFER/constant/style.dart';
|
||||
import 'package:SEFER/main.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class NewMainBottomSheet extends StatelessWidget {
|
||||
const NewMainBottomSheet({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Positioned(
|
||||
bottom: 0,
|
||||
left: 5,
|
||||
right: 5,
|
||||
child: Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
width: Get.width,
|
||||
height: Get.height * .15,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(),
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Text('Home'.tr),
|
||||
const Icon(Icons.home),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(),
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Text('Work'.tr),
|
||||
const Icon(Icons.work_outline),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(),
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
color: AppColor.blueColor.withOpacity(.5),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Icon(Icons.search),
|
||||
Text(
|
||||
"${"Where you want go ".tr}${box.read(BoxName.name)} ?",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ class PaymentMethodPage extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'My Cared'.tr,
|
||||
'My Card'.tr,
|
||||
style: AppStyle.title.copyWith(fontSize: 22),
|
||||
),
|
||||
IconButton(
|
||||
@@ -170,7 +170,7 @@ class MyCreditCardWidget extends StatelessWidget {
|
||||
SizedBox(
|
||||
width: Get.width * .25,
|
||||
child: Text(
|
||||
'Card Number',
|
||||
'Card Number'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -43,7 +43,7 @@ class PickerAnimtionContainerFormPlaces extends StatelessWidget {
|
||||
controller.isPickerShown
|
||||
? const SizedBox()
|
||||
: Text(
|
||||
'Hi, Where to ',
|
||||
'Hi, Where to '.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Column(
|
||||
|
||||
Reference in New Issue
Block a user