service 2-5-26-2

This commit is contained in:
Hamza-Ayed
2026-05-02 18:36:59 +03:00
parent 255724418c
commit 98846b8158
14 changed files with 912 additions and 534 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -13,6 +13,8 @@ class MyElevatedButton extends StatelessWidget {
final VoidCallback onPressed;
final Color kolor;
final int vibrateDuration;
final bool loading;
final Widget? child;
const MyElevatedButton({
Key? key,
@@ -20,6 +22,8 @@ class MyElevatedButton extends StatelessWidget {
required this.onPressed,
this.kolor = AppColor.primaryColor,
this.vibrateDuration = 100,
this.loading = false,
this.child,
}) : super(key: key);
@override
@@ -33,21 +37,33 @@ class MyElevatedButton extends StatelessWidget {
borderRadius: BorderRadius.circular(12.0),
),
),
onPressed: () async {
if (vibrate == true) {
if (Platform.isIOS) {
HapticFeedback.selectionClick();
} else if (Platform.isAndroid) {
await Vibration.vibrate(duration: vibrateDuration);
} else {}
}
onPressed();
},
child: Text(
title,
textAlign: TextAlign.center,
style: AppStyle.title.copyWith(color: AppColor.secondaryColor),
),
onPressed: loading
? null
: () async {
if (vibrate == true) {
if (Platform.isIOS) {
HapticFeedback.selectionClick();
} else if (Platform.isAndroid) {
await Vibration.vibrate(duration: vibrateDuration);
} else {}
}
onPressed();
},
child: loading
? const SizedBox(
height: 20,
width: 20,
child: CircularProgressIndicator(
color: Colors.white,
strokeWidth: 2,
),
)
: child ??
Text(
title,
textAlign: TextAlign.center,
style: AppStyle.title.copyWith(color: AppColor.secondaryColor),
),
);
}
}

View File

@@ -1,10 +1,8 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../constant/box_name.dart';
import '../../constant/colors.dart';
import '../../constant/style.dart';
import '../../main.dart';
class MyTextForm extends StatelessWidget {
const MyTextForm({
@@ -13,10 +11,12 @@ class MyTextForm extends StatelessWidget {
required this.label,
required this.hint,
required this.type,
this.validator,
});
final TextEditingController controller;
final String label, hint;
final TextInputType type;
final String? Function(String?)? validator;
@override
Widget build(BuildContext context) {
@@ -45,8 +45,8 @@ class MyTextForm extends StatelessWidget {
hintStyle: AppStyle.title,
labelStyle: AppStyle.title,
),
validator: (value) {
if (value!.isEmpty) {
validator: validator ?? (value) {
if (value == null || value.isEmpty) {
return '${'Please enter'.tr} $label.'.tr;
}
@@ -56,7 +56,6 @@ class MyTextForm extends StatelessWidget {
}
} else if (type == TextInputType.phone) {
if (value.length > 14) {
//for this you will return to 10 but now for service egypt
return 'Please enter a valid phone number.'.tr;
}
}