This commit is contained in:
Hamza-Ayed
2024-07-01 12:06:34 +03:00
parent d423cc0831
commit 475ba12cde
11 changed files with 444 additions and 58 deletions

View File

@@ -55,8 +55,8 @@ android {
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 23
targetSdkVersion 33
versionCode 43
versionName '1.5.43'
versionCode 44
versionName '1.5.44'
// manifestPlaceholders = [mapsApiKey: 'android/app/src/main/AndroidManifest.xml']
}

View File

@@ -21,7 +21,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>40</string>
<string>41</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
@@ -36,7 +36,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>4.0.40</string>
<string>4.0.41</string>
<key>FirebaseAppDelegateProxyEnabled</key>
<string>NO</string>
<key>GMSApiKey</key>

View File

@@ -17,6 +17,7 @@ import 'package:SEFER/views/auth/captin/verify_email_captain.dart';
import 'package:SEFER/views/home/Captin/home_captain/home_captin.dart';
import 'package:location/location.dart';
import '../../../views/auth/captin/cards/egypt_card_a_i.dart';
import '../../firebase/firbase_messge.dart';
class LoginDriverController extends GetxController {
@@ -58,7 +59,12 @@ class LoginDriverController extends GetxController {
});
if (res == 'Failure') {
//Failure
Get.offAll(() => SmsSignupEgypt());
if (box.read(BoxName.phoneVerified) == '1') {
Get.offAll(() => EgyptCardAI());
} else {
Get.offAll(() => SmsSignupEgypt());
}
isloading = false;
update();
// Get.snackbar('Failure', '', backgroundColor: Colors.red);

View File

@@ -223,7 +223,7 @@ class CRUD {
);
print(response.request);
print(response.body);
print(response.statusCode);
// print(response.statusCode);
var jsonData = jsonDecode(response.body);
if (response.statusCode == 200) {
if (jsonData['status'] == 'success') {

View File

@@ -511,7 +511,7 @@ class AI extends GetxController {
},
body: requestBody,
);
print(response.body);
if (response.statusCode == 200) {
var responseData = jsonDecode(utf8.decode(response.bodyBytes));
// Process the responseData as needed

View File

@@ -113,7 +113,7 @@ class CaptainWalletController extends GetxController {
if (res != 'failure') {
walletDate = jsonDecode(res);
totalAmount = walletDate['message'][0]['total_amount'] ?? '0';
update();
var res1 = await CRUD().get(
link: AppLink.getAllPaymentVisa,
payload: {'driverID': box.read(BoxName.driverID)});
@@ -269,9 +269,7 @@ class CaptainWalletController extends GetxController {
await Get.find<HomeCaptainController>().getKazanPercent();
kazan = Get.find<HomeCaptainController>().kazan;
getCaptainWalletFromRide();
getCaptainWalletFromBuyPoints();
// checkAccountCaptainBank();
await refreshCaptainWallet();
super.onInit();
}
}

View File

@@ -4,6 +4,14 @@ class MyTranslation extends Translations {
@override
Map<String, Map<String, String>> get keys => {
"ar": {
"Morning Promo": "عرض الصباح",
"this is count of your all trips in the morning promo today from 7:00am-10:00am":
"هذا عدد جميع رحلاتك في عرض الصباح اليوم من الساعة 7:00 صباحًا حتى 10:00 صباحًا",
"Morning Promo Rides": "رحلات عرض الصباح",
"Afternoon Promo": "عرض بعد الظهر",
"this is count of your all trips in the Afternoon promo today from 3:00pm-6:00 pm":
"هذا عدد جميع رحلاتك في عرض بعد الظهر اليوم من الساعة 3:00 مساءً حتى 6:00 مساءً",
"Afternoon Promo Rides": "رحلات عرض بعد الظهر",
"Heading your way now. Please be ready.":
"في طريقي إليك الآن. يرجى الاستعداد.",
"Approaching your area. Should be there in 3 minutes.":

View File

@@ -222,10 +222,29 @@ class EgyptCardAI extends StatelessWidget {
Text('Driver\'s License'.tr, style: AppStyle.headTitle2),
IconButton(
onPressed: () async {
await ai.allMethodForAI(
'''Write a JSON object from the following information extracted from the provided Arabic text:license_type,national_number,name_arabic,name_english,firstName,lastName,address,issue_date,expiry_date,employmentType,license_categories.and (date formate year-month-day in latin numbers) ''',
AppLink.uploadEgypt,
'driver_license'); //egypt
await ai.allMethodForAI("""
Write a JSON object from the following information extracted from the provided Arabic text:
{
"license_type": "",
"national_number": "",
"name_arabic": "",
"name_english": "",
"firstName": "",
"lastName": "",
"address": "",
"issue_date": "", // Format: YYYY-MM-DD using Latin numerals (0-9)
"expiry_date": "", // Format: YYYY-MM-DD using Latin numerals (0-9)
"employmentType": "",
"license_categories": []
}
Important notes:
1. Ensure all dates are in the format YYYY-MM-DD using Latin (Western) numerals (0-9), not Arabic numerals.
2. The 'license_categories' should be an array, even if there's only one category.
3. Fill in all fields based on the information provided in the Arabic text.
4. If any information is missing, leave the field as an empty string or empty array as appropriate.
""", AppLink.uploadEgypt, 'driver_license'); //egypt
},
icon: const Icon(Icons.refresh),
),
@@ -284,10 +303,29 @@ class EgyptCardAI extends StatelessWidget {
return Card(
child: InkWell(
onTap: () async {
await ai.allMethodForAI(
'''Write a JSON object from the following information extracted from the provided Arabic text:license_type,national_number,name_arabic,name_english,firstName,lastName,address,issue_date,expiry_date,employmentType,license_categories.and (date formate year-month-day in latin numbers) ''',
AppLink.uploadEgypt,
'driver_license'); //egypt
await ai.allMethodForAI("""
Write a JSON object from the following information extracted from the provided Arabic text:
{
"license_type": "",
"national_number": "",
"name_arabic": "",
"name_english": "",
"firstName": "",
"lastName": "",
"address": "",
"issue_date": "", // Format: YYYY-MM-DD using Latin numerals (0-9)
"expiry_date": "", // Format: YYYY-MM-DD using Latin numerals (0-9)
"employmentType": "",
"license_categories": []
}
Important notes:
1. Ensure all dates are in the format YYYY-MM-DD using Latin (Western) numerals (0-9), not Arabic numerals.
2. The 'license_categories' should be an array, even if there's only one category.
3. Fill in all fields based on the information provided in the Arabic text.
4. If any information is missing, leave the field as an empty string or empty array as appropriate.
""", AppLink.uploadEgypt, 'driver_license'); //egypt
},
child: Column(
children: [
@@ -339,10 +377,19 @@ class EgyptCardAI extends StatelessWidget {
Text('ID Documents Back'.tr, style: AppStyle.headTitle2),
IconButton(
onPressed: () async {
await ai.allMethodForAI(
'''Write a JSON from the following information extracted from the provided Arabic text:nationalID,issueDate,occupation,gender,religion,maritalStatus,fullNameMaritial if(أعزب)=none ,expirationDate.and (date formate year-month-day in latin numbers) ''',
AppLink.uploadEgypt,
'id_back'); //egypt
await ai.allMethodForAI("""
Write a JSON from the following information extracted from the provided Arabic text:
- nationalID(in Latin numerals)
- issueDate (in format YYYY-MM-DD using Latin numerals)
- occupation
- gender
- religion
- maritalStatus
- fullNameMarital (if maritalStatus is "أعزب", set this to "none")
- expirationDate (in format YYYY-MM-DD using Latin numerals)
Please ensure all date fields use Latin (Western) numerals (0-9) instead of Arabic numerals. For example, use "2023-04-03" instead of "٢٠٢٣-٠٤-٠٣".
""", AppLink.uploadEgypt, 'id_back'); //egypt
},
icon: const Icon(Icons.refresh),
),
@@ -410,10 +457,26 @@ class EgyptCardAI extends StatelessWidget {
return Card(
child: InkWell(
onTap: () async {
await ai.allMethodForAI(
'''Write a JSON from the following information extracted from the provided Arabic text:nationalID,issueDate,occupation,gender,religion,maritalStatus,fullNameMaritial if(أعزب)=none ,expirationDate.and (date formate year-month-day in latin numbers) ''',
AppLink.uploadEgypt,
'id_back'); //egypt
await ai.allMethodForAI('''
Write a JSON object from the following information extracted from the provided Arabic text:
{
"nationalID": "",//(in Latin numerals)
"issueDate": "", // Format: YYYY-MM-DD using Latin numerals (0-9)
"occupation": "",
"gender": "",
"religion": "",
"maritalStatus": "",
"fullNameMaritial": "", // Set to "none" if maritalStatus is "أعزب"
"expirationDate": "" // Format: YYYY-MM-DD using Latin numerals (0-9)
}
Important notes:
1. Ensure all dates (issueDate and expirationDate) are in the format YYYY-MM-DD using Latin (Western) numerals (0-9), not Arabic numerals.
2. If maritalStatus is "أعزب" (single), set fullNameMaritial to "none".
3. Fill in all fields based on the information provided in the Arabic text.
4. If any information is missing, leave the field as an empty string.
''', AppLink.uploadEgypt, 'id_back'); //egypt
},
child: Column(
children: [
@@ -455,10 +518,27 @@ class EgyptCardAI extends StatelessWidget {
Text('ID Documents Front'.tr, style: AppStyle.headTitle2),
IconButton(
onPressed: () async {
await ai.allMethodForAI(
'''Write a JSON object from the following information extracted from the provided Arabic text:first_name: The word next to "بطاقة تحقيق الشخصية" (National Identification Card).full_name: The full name on the next line after the first name.address: The complete address spanning the next two lines.national_number: The Arabic numeral representing the National ID number before the last line.card_id: The card ID in English on the last line and dob for date in year note month just year of born in latin char ''',
AppLink.uploadEgypt,
'id_front'); //egypt
await ai.allMethodForAI('''
Write a JSON object from the following information extracted from the provided Arabic text:
{
"first_name": "", // The word next to "بطاقة تحقيق الشخصية" (National Identification Card)
"full_name": "", // The full name on the next line after the first name
"address": "", // The complete address spanning the next two lines
"national_number": "", // The National ID number before the last line (convert Arabic numerals to Latin)
"card_id": "", // The card ID in English on the last line
"dob": "" // Year of birth only, in Latin numerals (YYYY format)
}
Important notes:
1. For 'first_name', extract the word immediately following "بطاقة تحقيق الشخصية".
2. 'full_name' should be the complete name found on the line after the first name.
3. 'address' should combine information from two consecutive lines.
4. Convert the 'national_number' from Arabic numerals to Latin numerals (0-9).
5. 'card_id' should be extracted as-is from the last line (it's already in English).
6. For 'dob', include only the year of birth in YYYY format using Latin numerals.
7. If any information is missing, leave the field as an empty string.
''', AppLink.uploadEgypt, 'id_front'); //egypt
},
icon: const Icon(Icons.refresh),
),
@@ -511,10 +591,27 @@ class EgyptCardAI extends StatelessWidget {
return Card(
child: InkWell(
onTap: () async {
await ai.allMethodForAI(
'''Write a JSON object from the following information extracted from the provided Arabic text:first_name: The word next to "بطاقة تحقيق الشخصية" (National Identification Card).full_name: The full name on the next line after the first name.address: The complete address spanning the next two lines.national_number: The Arabic numeral representing the National ID number before the last line.card_id: The card ID in English on the last line and dob for date in year note month just year of born in latin char ''',
AppLink.uploadEgypt,
'id_front'); //egypt
await ai.allMethodForAI(""""
Write a JSON object from the following information extracted from the provided Arabic text:
{
"first_name": "", // The word next to "بطاقة تحقيق الشخصية" (National Identification Card)
"full_name": "", // The full name on the next line after the first name
"address": "", // The complete address spanning the next two lines
"national_number": "", // The National ID number before the last line (convert Arabic numerals to Latin)
"card_id": "", // The card ID in English on the last line
"dob": "" // Year of birth only, in Latin numerals (YYYY format)
}
Important notes:
1. For 'first_name', extract the word immediately following "بطاقة تحقيق الشخصية".
2. 'full_name' should be the complete name found on the line after the first name.
3. 'address' should combine information from two consecutive lines.
4. Convert the 'national_number' from Arabic numerals to Latin numerals (0-9).
5. 'card_id' should be extracted as-is from the last line (it's already in English).
6. For 'dob', include only the year of birth in YYYY format using Latin numerals.
7. If any information is missing, leave the field as an empty string.
""", AppLink.uploadEgypt, 'id_front'); //egypt
},
child: Column(
children: [
@@ -564,10 +661,24 @@ class EgyptCardAI extends StatelessWidget {
style: AppStyle.headTitle2),
IconButton(
onPressed: () async {
ai.allMethodForAI(
'extract all fields as json for keys[LicenseExpirationDate,car_plate,owner,address] replace | by space,and date formate year-month-day',
AppLink.uploadEgypt,
'car_front');
ai.allMethodForAI("""
Extract the following fields from the provided text and create a JSON object with these keys:
{
"LicenseExpirationDate": "", // Format: YYYY-MM-DD
"car_plate": "",
"owner": "",
"address": ""
}
Important notes:
1. For the LicenseExpirationDate, ensure the date is in YYYY-MM-DD format using Latin numerals (0-9).
2. Replace all occurrences of '|' (pipe character) with a space in all fields.
3. If any information is missing, leave the corresponding field as an empty string.
4. Ensure all text is properly formatted and spaces are used correctly.
Please fill in the JSON object with the extracted information, following these guidelines.
""", AppLink.uploadEgypt, 'car_front');
},
icon: const Icon(Icons.refresh),
),
@@ -611,10 +722,24 @@ class EgyptCardAI extends StatelessWidget {
return Card(
child: InkWell(
onTap: () async {
ai.allMethodForAI(
'extract all fields as json for keys[LicenseExpirationDate,car_plate,owner,address] replace | by space,and date formate year-month-day',
AppLink.uploadEgypt,
'car_front');
ai.allMethodForAI("""
Extract the following fields from the provided text and create a JSON object with these keys:
{
"LicenseExpirationDate": "", // Format: YYYY-MM-DD
"car_plate": "",
"owner": "",
"address": ""
}
Important notes:
1. For the LicenseExpirationDate, ensure the date is in YYYY-MM-DD format using Latin numerals (0-9).
2. Replace all occurrences of '|' (pipe character) with a space in all fields.
3. If any information is missing, leave the corresponding field as an empty string.
4. Ensure all text is properly formatted and spaces are used correctly.
Please fill in the JSON object with the extracted information, following these guidelines.
""", AppLink.uploadEgypt, 'car_front');
},
child: Column(
children: [
@@ -646,7 +771,8 @@ class EgyptCardAI extends StatelessWidget {
// Get the inspection date from the response
final inspectionDate =
ai.responseIdCardDriverEgyptBack['inspection_date'];
final year = int.parse(inspectionDate.split('-')[0]);
final inspectionDateTime = DateTime(year, 1, 1);
// Check if the tax expiry date is before today
final today = DateTime.now();
@@ -656,8 +782,8 @@ class EgyptCardAI extends StatelessWidget {
taxExpiryDateTime != null && taxExpiryDateTime.isBefore(today);
// Check if the inspection date is before today
final inspectionDateTime =
DateTime(int.parse(inspectionDate ?? ''), 1, 1);
// final inspectionDateTime =
// DateTime(int.parse(year ?? ''), 1, 1);
final isInspectionExpired = inspectionDateTime.isBefore(today);
return Card(
@@ -677,10 +803,34 @@ class EgyptCardAI extends StatelessWidget {
style: AppStyle.headTitle2),
IconButton(
onPressed: () async {
ai.allMethodForAI(
'for this this extracted car license analyze it to get Json just without any text for keys[make, year, chassis, model, engine, displacement, cylinders, fuel, color,and color_hex (for color) inspection_date,assurnceNumber, tax_expiry,make date format year-month-day get hex color form color name provided',
AppLink.uploadEgypt,
'car_back');
ai.allMethodForAI("""
Analyze the extracted car license information and create a JSON object with the following keys:
{
"make": "",
"year": "",
"chassis": "",
"model": "",
"engine": "",
"displacement": "",
"cylinders": "",
"fuel": "",
"color": "",
"color_hex": "",
"inspection_date": "",
"assuranceNumber": "",
"tax_expiry": ""
}
Important notes:
1. For dates (inspection_date and tax_expiry), use the format YYYY-MM-DD with Latin numerals (0-9).
2. Convert the color name to its corresponding hex color code for the 'color_hex' field.
3. Ensure all numeric values (year, displacement, cylinders) are in Latin numerals.
4. If any information is missing, leave the corresponding field as an empty string.
5. Do not include any explanatory text in the JSON fields, only the extracted values.
Please fill in the JSON object with the extracted information, following these guidelines.
""", AppLink.uploadEgypt, 'car_back');
},
icon: const Icon(Icons.refresh),
),
@@ -750,10 +900,34 @@ class EgyptCardAI extends StatelessWidget {
return Card(
child: InkWell(
onTap: () async {
ai.allMethodForAI(
'this extracted car license analyze it to get Json just without any text for keys[make, year, chassis, model, engine, displacement, cylinders, fuel, color,and color_hex from color inspection_date,assurnceNumber, tax_expiry,make date format year-month-day',
AppLink.uploadEgypt,
'car_back');
ai.allMethodForAI("""
Analyze the extracted car license information and create a JSON object with the following keys:
{
"make": "",
"year": "",
"chassis": "",
"model": "",
"engine": "",
"displacement": "",
"cylinders": "",
"fuel": "",
"color": "",
"color_hex": "",
"inspection_date": "",
"assuranceNumber": "",
"tax_expiry": ""
}
Important notes:
1. For dates (inspection_date and tax_expiry), use the format YYYY-MM-DD with Latin numerals (0-9).
2. Convert the color name to its corresponding hex color code for the 'color_hex' field.
3. Ensure all numeric values (year, displacement, cylinders) are in Latin numerals.
4. If any information is missing, leave the corresponding field as an empty string.
5. Do not include any explanatory text in the JSON fields, only the extracted values.
Please fill in the JSON object with the extracted information, following these guidelines.
""", AppLink.uploadEgypt, 'car_back');
},
child: Column(
children: [
@@ -796,7 +970,25 @@ class EgyptCardAI extends StatelessWidget {
IconButton(
onPressed: () async {
await ai.allMethodForAI(
'Write a JSON object from the following information extracted from the provided Arabic text:["InspectionResult": ,"NationalID","FullName","IssueDate"]make date format year-month-day ,and add spaces in text',
"""
Write a JSON object from the following information extracted from the provided Arabic text:
{
"InspectionResult": "",
"NationalID": "",
"FullName": "",
"IssueDate": "" // Format: YYYY-MM-DD
}
Important notes:
1. For the IssueDate, ensure the date is in YYYY-MM-DD format using Latin numerals (0-9).
2. Add appropriate spaces in all text fields to ensure readability.
3. If any information is missing, leave the corresponding field as an empty string.
4. Ensure all text is properly formatted and spaces are used correctly.
5. Convert any Arabic numerals to Latin numerals (0-9) where applicable.
Please fill in the JSON object with the extracted information, following these guidelines.
""",
AppLink.uploadEgypt,
'criminalRecord',
);
@@ -834,7 +1026,25 @@ class EgyptCardAI extends StatelessWidget {
child: InkWell(
onTap: () async {
await ai.allMethodForAI(
'Write a JSON object from the following information extracted from the provided Arabic text:["InspectionResult": ,"NationalID","FullName","IssueDate"]make date format year-month-day ,and add spaces in text',
"""
Write a JSON object from the following information extracted from the provided Arabic text:
{
"InspectionResult": "",
"NationalID": "",
"FullName": "",
"IssueDate": "" // Format: YYYY-MM-DD
}
Important notes:
1. For the IssueDate, ensure the date is in YYYY-MM-DD format using Latin numerals (0-9).
2. Add appropriate spaces in all text fields to ensure readability.
3. If any information is missing, leave the corresponding field as an empty string.
4. Ensure all text is properly formatted and spaces are used correctly.
5. Convert any Arabic numerals to Latin numerals (0-9) where applicable.
Please fill in the JSON object with the extracted information, following these guidelines.
""",
AppLink.uploadEgypt,
'criminalRecord',
);

View File

@@ -100,7 +100,7 @@ class SmsSignupEgypt extends StatelessWidget {
);
}),
],
isleading: true,
isleading: false,
);
}
}

View File

@@ -4,6 +4,7 @@ import 'package:SEFER/controller/functions/tts.dart';
import 'package:SEFER/controller/home/payment/paymob_payout.dart';
import 'package:SEFER/views/home/my_wallet/bank_account_egypt.dart';
import 'package:SEFER/views/home/my_wallet/payment_history_driver_page.dart';
import 'package:SEFER/views/widgets/mydialoug.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:SEFER/constant/box_name.dart';
@@ -28,9 +29,11 @@ class WalletCaptain extends StatelessWidget {
WalletCaptain({super.key});
CaptainWalletController captainWalletController =
Get.put(CaptainWalletController());
@override
Widget build(BuildContext context) {
// Get.put(MapDriverController()).totalPricePassenger = '0';
captainWalletController.refreshCaptainWallet();
return MyScafolld(
title: 'Driver Wallet'.tr,
body: [
@@ -41,7 +44,6 @@ class WalletCaptain extends StatelessWidget {
: Padding(
padding: const EdgeInsets.all(10),
child: ListView(
// crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(),
Container(
@@ -389,6 +391,125 @@ class WalletCaptain extends StatelessWidget {
height: 30,
),
GetBuilder<CaptainWalletController>(
builder: (captainWalletController) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
SizedBox(
width: Get.width * .95,
// height: Get.height * .1,
// decoration: AppStyle.boxDecoration,
child: Stack(
children: [
InkWell(
onTap: () {
MyDialog().getDialog(
'Morning Promo'.tr,
"this is count of your all trips in the morning promo today from 7:00am-10:00am"
.tr, () {
Get.back();
});
},
child: LinearProgressIndicator(
minHeight: 35,
color: AppColor.blueColor,
borderRadius:
BorderRadius.circular(12),
backgroundColor: AppColor.accentColor,
value: double.parse(
captainWalletController
.walletDate['message'][0]
['morning_count']
.toString()) /
5,
),
),
Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
Text(
'Morning Promo Rides'.tr,
style: AppStyle.title,
),
const SizedBox(
width: 20,
),
Text(
'${captainWalletController.walletDate['message'][0]['morning_count']} / 5',
style: AppStyle.title,
),
],
),
],
),
)
],
),
);
}),
GetBuilder<CaptainWalletController>(
builder: (captainWalletController) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
SizedBox(
width: Get.width * .95,
// height: Get.height * .1,
// decoration: AppStyle.boxDecoration,
child: Stack(
children: [
InkWell(
onTap: () {
MyDialog().getDialog(
'Afternoon Promo'.tr,
"this is count of your all trips in the Afternoon promo today from 3:00pm-6:00 pm"
.tr, () {
Get.back();
});
},
child: LinearProgressIndicator(
minHeight: 35,
color: AppColor.blueColor,
borderRadius:
BorderRadius.circular(12),
backgroundColor: AppColor.accentColor,
value: double.parse(
captainWalletController
.walletDate['message'][0]
['afternoon_count']
.toString()) /
5,
),
),
Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
Text(
'Afternoon Promo Rides'.tr,
style: AppStyle.title,
),
const SizedBox(
width: 20,
),
Text(
'${captainWalletController.walletDate['message'][0]['afternoon_count']} / 5',
style: AppStyle.title,
),
],
),
],
),
)
],
),
);
}),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Row(

View File

@@ -0,0 +1,43 @@
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../constant/colors.dart';
import '../../constant/style.dart';
import '../../controller/functions/tts.dart';
import 'elevated_btn.dart';
class MyDialog extends GetxController {
void getDialog(String title, String? midTitle, VoidCallback onPressed) {
final textToSpeechController = Get.put(TextToSpeechController());
Get.defaultDialog(
title: title,
titleStyle: AppStyle.title,
middleTextStyle: AppStyle.title,
content: Column(
children: [
IconButton(
onPressed: () async {
await textToSpeechController.speakText(title ?? midTitle!);
},
icon: const Icon(Icons.headphones)),
Text(
midTitle!,
style: AppStyle.title,
)
],
),
confirm: MyElevatedButton(
title: 'Ok'.tr,
onPressed: onPressed,
kolor: AppColor.greenColor,
),
cancel: MyElevatedButton(
title: 'Cancel',
kolor: AppColor.redColor,
onPressed: () {
Get.back();
}));
}
}