6/25/1
This commit is contained in:
@@ -55,8 +55,8 @@ android {
|
||||
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
||||
minSdkVersion 23
|
||||
targetSdkVersion flutter.targetSdkVersion
|
||||
versionCode 35
|
||||
versionName '1.5.35'
|
||||
versionCode 37
|
||||
versionName '1.5.37'
|
||||
// manifestPlaceholders = [mapsApiKey: 'android/app/src/main/AndroidManifest.xml']
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.2 MiB After Width: | Height: | Size: 23 MiB |
@@ -63,6 +63,7 @@ class BoxName {
|
||||
static const String transactionCloude = 'transactionCloude';
|
||||
static const String visionApi = 'visionApi';
|
||||
static const String vin = "vin";
|
||||
static const String isvibrate = "isvibrate";
|
||||
static const String make = "make";
|
||||
static const String model = "model";
|
||||
static const String year = "year";
|
||||
|
||||
@@ -2,11 +2,15 @@ import 'package:flutter/material.dart';
|
||||
|
||||
class AppColor {
|
||||
static const Color primaryColor = Color(0xFF1DA1F2);
|
||||
static const Color writeColor = Color(0xFF333333);
|
||||
static const Color writeColor = Color(0xff222359);
|
||||
|
||||
static const Color bronze = Color(0xFFCD7F32);
|
||||
static const Color goldenBronze = Color(0xFFB87333); // Golden bronze color
|
||||
static const Color gold = Color(0xFFD4AF37);
|
||||
static const Color secondaryColor = Colors.white;
|
||||
static const Color accentColor = Colors.grey;
|
||||
static const Color twitterColor = Color(0xFF1DA1F2); // Twitter blue
|
||||
|
||||
static const Color greyColor = Colors.grey;
|
||||
static const Color redColor = Color(0xFFEA4335); // Google Red
|
||||
static const Color greenColor = Color(0xFF34A853); // Google Green
|
||||
static const Color blueColor = Color(0xFF1DA1F2); // Google Blue
|
||||
|
||||
@@ -2,7 +2,6 @@ import 'dart:convert';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:SEFER/controller/firebase/firbase_messge.dart';
|
||||
import 'package:SEFER/views/auth/register_page.dart';
|
||||
import 'package:SEFER/views/auth/sms_verfy_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
@@ -84,6 +83,7 @@ class LoginController extends GetxController {
|
||||
'token': box.read(BoxName.tokenFCM),
|
||||
'passengerID': box.read(BoxName.passengerID).toString()
|
||||
});
|
||||
Get.offAll(() => const MapPagePassenger());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -840,7 +840,8 @@ class MapPassengerController extends GetxController {
|
||||
update();
|
||||
}
|
||||
|
||||
void getDialog(String title, midTitle, VoidCallback onPressed) {
|
||||
void getDialog(String title, String? midTitle, VoidCallback onPressed) {
|
||||
final textToSpeechController = Get.find<TextToSpeechController>();
|
||||
Get.defaultDialog(
|
||||
title: title,
|
||||
titleStyle: AppStyle.title,
|
||||
@@ -849,13 +850,11 @@ class MapPassengerController extends GetxController {
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
final textToSpeechController =
|
||||
Get.find<TextToSpeechController>();
|
||||
await textToSpeechController.speakText(midTitle);
|
||||
await textToSpeechController.speakText(title ?? midTitle!);
|
||||
},
|
||||
icon: const Icon(Icons.headphones)),
|
||||
Text(
|
||||
midTitle,
|
||||
midTitle!,
|
||||
style: AppStyle.title,
|
||||
)
|
||||
],
|
||||
@@ -867,6 +866,7 @@ class MapPassengerController extends GetxController {
|
||||
),
|
||||
cancel: MyElevatedButton(
|
||||
title: 'Cancel',
|
||||
kolor: AppColor.redColor,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
}));
|
||||
|
||||
@@ -4,6 +4,11 @@ class MyTranslation extends Translations {
|
||||
@override
|
||||
Map<String, Map<String, String>> get keys => {
|
||||
"ar": {
|
||||
"Click here point": "انقر هنا", // Click here (literal translation)
|
||||
"Pick or Tap to confirm":
|
||||
"اختر أو اضغط للتأكيد", // Choose or Tap to confirm
|
||||
"Are you want to change": "هل تريد التغيير؟",
|
||||
'by': 'ب',
|
||||
"Enter your complaint here": "أدخل شكواك هنا",
|
||||
"Complaint": "شكوى",
|
||||
"Please enter your complaint.": "الرجاء إدخال شكواك.",
|
||||
|
||||
@@ -82,7 +82,7 @@ class PaymentController extends GetxController {
|
||||
}
|
||||
|
||||
Future addSeferWallet(String paymentMethod, point) async {
|
||||
var seferToken = await generateTokenDriver(point);
|
||||
var seferToken = await generateTokenPassenger(point);
|
||||
await CRUD().post(link: AppLink.addSeferWallet, payload: {
|
||||
'amount': point.toString(),
|
||||
'paymentMethod': paymentMethod,
|
||||
|
||||
@@ -45,7 +45,7 @@ class SplashScreen extends StatelessWidget {
|
||||
TypewriterAnimatedText(
|
||||
'Welcome to ${AppInformation.appName}',
|
||||
textStyle:
|
||||
AppStyle.headTitle2.copyWith(color: AppColor.greenColor),
|
||||
AppStyle.headTitle2.copyWith(color: AppColor.writeColor),
|
||||
speed: const Duration(milliseconds: 200),
|
||||
),
|
||||
], isRepeatingAnimation: true),
|
||||
|
||||
@@ -22,6 +22,7 @@ import '../../controller/auth/google_sign.dart';
|
||||
import '../../controller/auth/login_controller.dart';
|
||||
import '../../controller/firebase/firbase_messge.dart';
|
||||
import '../../controller/functions/crud.dart';
|
||||
import '../../controller/functions/toast.dart';
|
||||
import '../home/profile/passenger_profile_page.dart';
|
||||
import '../widgets/mycircular.dart';
|
||||
import 'register_page.dart';
|
||||
@@ -52,143 +53,6 @@ class LoginPage extends StatelessWidget {
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.all(25),
|
||||
// child: Container(
|
||||
// decoration: const BoxDecoration(
|
||||
// boxShadow: [
|
||||
// BoxShadow(
|
||||
// offset: Offset(3, 3),
|
||||
// color: AppColor.accentColor,
|
||||
// blurRadius: 3)
|
||||
// ],
|
||||
// color: AppColor.secondaryColor,
|
||||
// ),
|
||||
// child: Form(
|
||||
// key: controller.formKey,
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.all(16.0),
|
||||
// child: SingleChildScrollView(
|
||||
// child: Column(
|
||||
// children: [
|
||||
// TextFormField(
|
||||
// keyboardType: TextInputType.emailAddress,
|
||||
// controller: controller.emailController,
|
||||
// decoration: InputDecoration(
|
||||
// focusedBorder: OutlineInputBorder(
|
||||
// borderSide: const BorderSide(
|
||||
// color: AppColor.primaryColor,
|
||||
// width: 2.0,
|
||||
// ),
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
// fillColor: AppColor.accentColor,
|
||||
// hoverColor: AppColor.accentColor,
|
||||
// focusColor: AppColor.accentColor,
|
||||
// border: const OutlineInputBorder(
|
||||
// borderRadius: BorderRadius.all(
|
||||
// Radius.circular(12))),
|
||||
// labelText: 'Email'.tr,
|
||||
// hintText: 'Enter your email address'.tr,
|
||||
// ),
|
||||
// validator: (value) {
|
||||
// if (value!.isEmpty ||
|
||||
// (!value.contains('@') ||
|
||||
// !value.contains('.'))) {
|
||||
// return 'Please enter Your Email.'.tr;
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
// ),
|
||||
// const SizedBox(
|
||||
// height: 30,
|
||||
// ),
|
||||
// TextFormField(
|
||||
// keyboardType: TextInputType.phone,
|
||||
// cursorColor: AppColor.accentColor,
|
||||
// controller: controller.phoneController,
|
||||
// decoration: InputDecoration(
|
||||
// focusedBorder: OutlineInputBorder(
|
||||
// borderSide: const BorderSide(
|
||||
// color: AppColor.primaryColor,
|
||||
// width: 2.0,
|
||||
// ),
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
// focusColor: AppColor.accentColor,
|
||||
// fillColor: AppColor.accentColor,
|
||||
// border: const OutlineInputBorder(
|
||||
// borderRadius: BorderRadius.all(
|
||||
// Radius.circular(12))),
|
||||
// labelText: 'Phone'.tr,
|
||||
// hintText: 'Enter your phone number'.tr,
|
||||
// ),
|
||||
// validator: (value) {
|
||||
// if (value!.isEmpty ||
|
||||
// value.length != 10) {
|
||||
// return 'Please enter your phone number.'
|
||||
// .tr;
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
// ),
|
||||
// const SizedBox(
|
||||
// height: 15,
|
||||
// ),
|
||||
// TextFormField(
|
||||
// obscureText: true,
|
||||
// keyboardType: TextInputType.emailAddress,
|
||||
// controller: controller.passwordController,
|
||||
// decoration: InputDecoration(
|
||||
// focusedBorder: OutlineInputBorder(
|
||||
// borderSide: const BorderSide(
|
||||
// color: AppColor.primaryColor,
|
||||
// width: 2.0,
|
||||
// ),
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
// fillColor: AppColor.accentColor,
|
||||
// hoverColor: AppColor.accentColor,
|
||||
// focusColor: AppColor.accentColor,
|
||||
// border: const OutlineInputBorder(
|
||||
// borderRadius: BorderRadius.all(
|
||||
// Radius.circular(12))),
|
||||
// labelText: 'Password'.tr,
|
||||
// hintText:
|
||||
// 'Please enter your phone number.'.tr,
|
||||
// ),
|
||||
// validator: (value) {
|
||||
// if (value!.isEmpty) {
|
||||
// return 'Please enter Your Password.'.tr;
|
||||
// }
|
||||
// if (value.length < 6) {
|
||||
// return 'Password must br at least 6 character.'
|
||||
// .tr;
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
// ),
|
||||
// GetBuilder<LoginController>(
|
||||
// builder: (controller) => controller
|
||||
// .isloading
|
||||
// ? const MyCircularProgressIndicator()
|
||||
// : MyElevatedButton(
|
||||
// onPressed: () {
|
||||
// if (controller
|
||||
// .formKey.currentState!
|
||||
// .validate()) {
|
||||
// controller.login();
|
||||
// }
|
||||
// },
|
||||
// title: 'Submit'.tr,
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// )),
|
||||
Center(
|
||||
child: Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
@@ -224,21 +88,53 @@ class LoginPage extends StatelessWidget {
|
||||
kolor: AppColor.blueColor,
|
||||
),
|
||||
!Platform.isAndroid
|
||||
? MyElevatedButton(
|
||||
title: 'Sign In by Apple'.tr,
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.apple,
|
||||
size: 30,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 8), // Adjust spacing as needed
|
||||
MyElevatedButton(
|
||||
title: 'Sign in with Apple'.tr,
|
||||
onPressed: () async {
|
||||
User? user =
|
||||
await authController.signInWithApple();
|
||||
try {
|
||||
User? user = await authController
|
||||
.signInWithApple();
|
||||
if (user != null) {
|
||||
box.write(BoxName.driverID, user.uid);
|
||||
box.write(
|
||||
BoxName.emailDriver, user.email);
|
||||
BoxName.driverID, user.uid);
|
||||
box.write(BoxName.emailDriver,
|
||||
user.email);
|
||||
|
||||
// Provide user feedback
|
||||
await GoogleSignInHelper
|
||||
.signInFromLogin();
|
||||
// Navigate to another screen or perform other actions
|
||||
} else {}
|
||||
Navigator.of(context)
|
||||
.pushReplacementNamed('/home');
|
||||
Toast.show(
|
||||
context,
|
||||
'Signed in successfully',
|
||||
AppColor.greenColor);
|
||||
} else {
|
||||
Toast.show(
|
||||
context,
|
||||
'Sign in failed. Please try again.',
|
||||
AppColor.yellowColor);
|
||||
}
|
||||
} catch (error) {
|
||||
print('Sign in error: $error');
|
||||
Toast.show(
|
||||
context,
|
||||
'An error occurred. Please check your connection and try again.',
|
||||
AppColor.redColor);
|
||||
}
|
||||
},
|
||||
kolor: AppColor.primaryColor,
|
||||
kolor: Colors.black,
|
||||
),
|
||||
],
|
||||
)
|
||||
: const SizedBox(),
|
||||
],
|
||||
@@ -392,7 +288,7 @@ class LoginPage extends StatelessWidget {
|
||||
style: AppStyle.title,
|
||||
),
|
||||
MyElevatedButton(
|
||||
title: 'Grant Location'.tr,
|
||||
title: 'Next'.tr,
|
||||
onPressed: () async {
|
||||
await controller.getLocationPermission();
|
||||
},
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/constant/info.dart';
|
||||
import 'package:SEFER/controller/payment/payment_controller.dart';
|
||||
import 'package:SEFER/main.dart';
|
||||
import 'package:SEFER/views/widgets/elevated_btn.dart';
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../constant/style.dart';
|
||||
import '../../../controller/home/map_passenger_controller.dart';
|
||||
|
||||
|
||||
@@ -582,7 +582,9 @@ class HeaderDestination extends StatelessWidget {
|
||||
right: 5,
|
||||
child: Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
height: Get.height * .2,
|
||||
height: box.read(BoxName.countryCode) == 'Egypt'
|
||||
? Get.height * .2
|
||||
: Get.height * .14,
|
||||
width: Get.width * .8,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
@@ -598,27 +600,49 @@ class HeaderDestination extends StatelessWidget {
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: SizedBox(
|
||||
height: Get.height * .12,
|
||||
height: box.read(BoxName.countryCode) == 'Egypt'
|
||||
? Get.height * .14
|
||||
: Get.height * .06,
|
||||
child: ListView(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
//
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'🟢 ${mapPassengerController.startNameAddress}',
|
||||
'🟢 ',
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
Text(
|
||||
'🔴 ${mapPassengerController.endNameAddress}',
|
||||
mapPassengerController.startNameAddress,
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'🔴 ',
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
Text(
|
||||
mapPassengerController.endNameAddress,
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
'📍 ${mapPassengerController.distance} ${'KM'.tr} ⌛ ${mapPassengerController.hours > 0 ? '${'Your Ride Duration is '.tr}${mapPassengerController.hours} ${'H and'.tr} ${mapPassengerController.minutes} ${'m'.tr}' : '${'Your Ride Duration is '.tr} ${mapPassengerController.minutes} m'}',
|
||||
'📍 ${mapPassengerController.distance} ${'KM'.tr} ⌛ ${mapPassengerController.hours > 0 ? '${'Your Ride Duration is '.tr}${mapPassengerController.hours} ${'H and'.tr} ${mapPassengerController.minutes} ${'m'.tr}' : '${'Your Ride Duration is '.tr} ${mapPassengerController.minutes} ${'m'.tr}'}',
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
],
|
||||
|
||||
@@ -102,26 +102,26 @@ GetBuilder<MapPassengerController> leftMainMenuIcons() {
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTraffic,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
border: Border.all(),
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: IconButton(
|
||||
onPressed: () async {
|
||||
var phone = box.read(BoxName.countryCode) == 'Egypt'
|
||||
? '+2${box.read(BoxName.sosPhonePassenger)}'
|
||||
: '+962${box.read(BoxName.sosPhonePassenger)}';
|
||||
controller.sendWhatsapp(phone);
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.chat,
|
||||
size: 29,
|
||||
),
|
||||
),
|
||||
),
|
||||
// AnimatedContainer(
|
||||
// duration: const Duration(microseconds: 200),
|
||||
// width: controller.widthMapTypeAndTraffic,
|
||||
// decoration: BoxDecoration(
|
||||
// color: AppColor.secondaryColor,
|
||||
// border: Border.all(),
|
||||
// borderRadius: BorderRadius.circular(15)),
|
||||
// child: IconButton(
|
||||
// onPressed: () async {
|
||||
// var phone = box.read(BoxName.countryCode) == 'Egypt'
|
||||
// ? '+2${box.read(BoxName.sosPhonePassenger)}'
|
||||
// : '+962${box.read(BoxName.sosPhonePassenger)}';
|
||||
// controller.sendWhatsapp(phone);
|
||||
// },
|
||||
// icon: const Icon(
|
||||
// Icons.chat,
|
||||
// size: 29,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// AnimatedContainer(
|
||||
// duration: const Duration(microseconds: 200),
|
||||
// width: controller.widthMapTypeAndTraffic,
|
||||
|
||||
@@ -25,12 +25,6 @@ class MainBottomMenuMap extends StatelessWidget {
|
||||
left: 5,
|
||||
right: 5,
|
||||
child: GestureDetector(
|
||||
onVerticalDragUpdate: (DragUpdateDetails details) {
|
||||
// Update the size of the GestureDetector based on the user's finger position.
|
||||
|
||||
// _height = details.globalPosition.dy;
|
||||
controller.changeMainBottomMenuMap();
|
||||
},
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 500),
|
||||
height: controller.mainBottomMenuMapHeight,
|
||||
|
||||
@@ -175,8 +175,8 @@ class MapMenuWidget extends StatelessWidget {
|
||||
return;
|
||||
}
|
||||
|
||||
if (await canLaunch(driverAppUrl)) {
|
||||
await launch(driverAppUrl);
|
||||
if (await canLaunchUrl(Uri.parse(driverAppUrl))) {
|
||||
await launchUrl(Uri.parse(driverAppUrl));
|
||||
} else {
|
||||
throw 'Could not launch app store URL';
|
||||
}
|
||||
|
||||
@@ -35,16 +35,26 @@ class PointsCaptain extends StatelessWidget {
|
||||
height: Get.width * .29,
|
||||
margin: const EdgeInsets.all(4),
|
||||
decoration: BoxDecoration(
|
||||
color: kolor,
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
kolor.withOpacity(0.3),
|
||||
kolor,
|
||||
kolor.withOpacity(0.7),
|
||||
kolor,
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
border: Border.all(color: AppColor.accentColor),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
shape: BoxShape.rectangle,
|
||||
),
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Text(
|
||||
'$countPoint ${'Point'.tr}',
|
||||
'$countPoint ${'LE'.tr}',
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
Text(
|
||||
|
||||
@@ -47,7 +47,7 @@ class PromosPassengerPage extends StatelessWidget {
|
||||
scrollDirection: Axis.horizontal,
|
||||
children: [
|
||||
PointsCaptain(
|
||||
kolor: AppColor.blueColor,
|
||||
kolor: AppColor.greyColor,
|
||||
pricePoint:
|
||||
box.read(BoxName.countryCode) ==
|
||||
'Jordan'
|
||||
@@ -60,7 +60,7 @@ class PromosPassengerPage extends StatelessWidget {
|
||||
: '100',
|
||||
),
|
||||
PointsCaptain(
|
||||
kolor: Colors.green,
|
||||
kolor: AppColor.bronze,
|
||||
pricePoint:
|
||||
box.read(BoxName.countryCode) ==
|
||||
'Jordan'
|
||||
@@ -73,7 +73,7 @@ class PromosPassengerPage extends StatelessWidget {
|
||||
: '210',
|
||||
),
|
||||
PointsCaptain(
|
||||
kolor: Colors.amberAccent,
|
||||
kolor: AppColor.goldenBronze,
|
||||
pricePoint:
|
||||
box.read(BoxName.countryCode) ==
|
||||
'Jordan'
|
||||
@@ -86,7 +86,7 @@ class PromosPassengerPage extends StatelessWidget {
|
||||
: '450',
|
||||
),
|
||||
PointsCaptain(
|
||||
kolor: AppColor.yellowColor,
|
||||
kolor: AppColor.gold,
|
||||
pricePoint:
|
||||
box.read(BoxName.countryCode) ==
|
||||
'Jordan'
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/main.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:SEFER/constant/style.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -22,18 +24,26 @@ class MyElevatedButton extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
bool vibrate = box.read(BoxName.isvibrate) ?? true;
|
||||
return ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateProperty.all(kolor),
|
||||
shape: MaterialStateProperty.all(RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
)),
|
||||
// padding:
|
||||
// MaterialStateProperty.all(const EdgeInsets.symmetric(vertical: 15)),
|
||||
),
|
||||
onPressed: () async {
|
||||
// Handle haptic feedback for both iOS and Android
|
||||
if (vibrate) {
|
||||
if (Platform.isIOS) {
|
||||
HapticFeedback.selectionClick();
|
||||
} else {
|
||||
Vibration.vibrate(duration: 100);
|
||||
// Vibrate.vibrateWithPauses(pauses);
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure the onPressed callback is called after haptic feedback
|
||||
onPressed();
|
||||
|
||||
Reference in New Issue
Block a user