This commit is contained in:
Hamza-Ayed
2024-02-09 02:56:37 +03:00
parent d4d4592944
commit 8c61a79de3
15 changed files with 397 additions and 71 deletions

View File

@@ -1,6 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter_font_icons/flutter_font_icons.dart';
import 'package:get/get.dart';
import 'package:ride/constant/info.dart';
import 'package:ride/controller/functions/location_controller.dart';
import 'package:ride/views/widgets/elevated_btn.dart';
import 'package:ride/views/widgets/my_textField.dart';
import '../../../../constant/box_name.dart';
import '../../../../constant/colors.dart';
@@ -20,17 +24,44 @@ class SosConnect extends StatelessWidget {
builder: (mapDriverController) => mapDriverController.isRideStarted
? Positioned(
left: 5,
top: Get.height * .3,
bottom: 20,
child: Container(
decoration: AppStyle.boxDecoration,
height: 100,
width: 70,
child: Column(
height: 60,
width: 100,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
InkWell(
onTap: () {
launchCommunication('phone', '911', '');
if (box.read(BoxName.sosPhoneDriver) == null) {
Get.defaultDialog(
title: 'Insert Emergincy Number'.tr,
content: Form(
key: mapDriverController.formKey1,
child: MyTextForm(
controller: mapDriverController
.sosEmergincyNumberCotroller,
label: 'Insert Emergincy Number'.tr,
hint: 'Insert Emergincy Number'.tr,
type: TextInputType.phone),
),
confirm: MyElevatedButton(
title: 'Insert'.tr,
onPressed: () {
if (mapDriverController
.formKey1.currentState!
.validate()) {
box.write(
BoxName.sosPhoneDriver,
mapDriverController
.sosEmergincyNumberCotroller
.text);
}
}));
}
launchCommunication(
'phone', box.read(BoxName.sosPhoneDriver), '');
},
child: const Icon(
Icons.sos_sharp,
@@ -39,10 +70,36 @@ class SosConnect extends StatelessWidget {
),
InkWell(
onTap: () {
if (box.read(BoxName.sosPhoneDriver) == null) {
Get.defaultDialog(
title: 'Insert Emergincy Number'.tr,
content: Form(
key: mapDriverController.formKey1,
child: MyTextForm(
controller: mapDriverController
.sosEmergincyNumberCotroller,
label: 'Insert Emergincy Number'.tr,
hint: 'Insert Emergincy Number'.tr,
type: TextInputType.phone),
),
confirm: MyElevatedButton(
title: 'Insert'.tr,
onPressed: () {
if (mapDriverController
.formKey1.currentState!
.validate()) {
box.write(
BoxName.sosPhoneDriver,
mapDriverController
.sosEmergincyNumberCotroller
.text);
}
}));
}
launchCommunication(
'whatsapp',
'+962${box.read(BoxName.phoneDriver)}', //todo add number from driver
'${'Hello this is Captain'.tr} ${box.read(BoxName.nameDriver)}');
'+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,