login using sms done

merge-update-with-lab-changes
Aamir Muhammad 6 months ago committed by haroon amjad
parent 7ff7f88e24
commit 6578baaf34

@ -0,0 +1,5 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path opacity="0.4" d="M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z" fill="#DADADA"/>
<path d="M9.03033 7.96967C8.73744 7.67678 8.26256 7.67678 7.96967 7.96967C7.67678 8.26256 7.67678 8.73744 7.96967 9.03033L10.9393 12L7.96967 14.9697C7.67678 15.2626 7.67678 15.7374 7.96967 16.0303C8.26256 16.3232 8.73744 16.3232 9.03033 16.0303L12 13.0607L14.9697 16.0303C15.2626 16.3232 15.7374 16.3232 16.0303 16.0303C16.3232 15.7374 16.3232 15.2626 16.0303 14.9697L13.0607 12L16.0303 9.03033C16.3232 8.73744 16.3232 8.26256 16.0303 7.96967C15.7374 7.67678 15.2626 7.67678 14.9697 7.96967L12 10.9393L9.03033 7.96967Z" fill="#2B353E"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 1.25C6.06294 1.25 1.25 6.06294 1.25 12C1.25 17.9371 6.06294 22.75 12 22.75C17.9371 22.75 22.75 17.9371 22.75 12C22.75 6.06294 17.9371 1.25 12 1.25ZM2.75 12C2.75 6.89137 6.89137 2.75 12 2.75C17.1086 2.75 21.25 6.89137 21.25 12C21.25 17.1086 17.1086 21.25 12 21.25C6.89137 21.25 2.75 17.1086 2.75 12Z" fill="#2B353E"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -0,0 +1,5 @@
<svg width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M9 15.25C8.58579 15.25 8.25 14.9142 8.25 14.5C8.25 14.0858 8.58579 13.75 9 13.75L16 13.75C16.4142 13.75 16.75 14.0858 16.75 14.5C16.75 14.9142 16.4142 15.25 16 15.25L9 15.25Z" fill="white"/>
<path d="M9 10.25C8.58579 10.25 8.25 9.91421 8.25 9.5C8.25 9.08579 8.58579 8.75 9 8.75L12.5 8.75C12.9142 8.75 13.25 9.08579 13.25 9.5C13.25 9.91421 12.9142 10.25 12.5 10.25H9Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.7204 1.82273C13.2601 1.72566 11.7369 1.72586 10.2797 1.82273C5.713 2.12629 2.08972 5.81258 1.7918 10.4224C1.73607 11.2848 1.73607 12.1768 1.7918 13.0392C1.90272 14.7556 2.65148 16.304 3.48381 17.5604C3.73314 18.0419 3.60323 18.7641 3.1369 19.6478L3.11542 19.6885C2.95874 19.9852 2.80536 20.2757 2.71688 20.5234C2.62313 20.7858 2.52623 21.2025 2.76791 21.6145C2.98996 21.9931 3.34475 22.1318 3.63152 22.1873C3.86961 22.2334 4.16155 22.2403 4.43544 22.2469L4.48117 22.248C5.90092 22.2825 6.90136 21.8726 7.6938 21.2883C7.85108 21.1723 7.95909 21.0929 8.04041 21.037C8.15868 21.0804 8.3203 21.1467 8.55839 21.2448C9.09978 21.4677 9.71472 21.6013 10.2797 21.6389C11.7369 21.7357 13.2601 21.7359 14.7204 21.6389C19.287 21.3353 22.9103 17.649 23.2082 13.0392C23.2639 12.1768 23.2639 11.2848 23.2082 10.4224C22.9103 5.81258 19.287 2.12629 14.7204 1.82273ZM10.3791 3.31942C11.7702 3.22695 13.2269 3.22676 14.6209 3.31942C18.4202 3.57198 21.4609 6.64417 21.7113 10.5191C21.7629 11.3171 21.7629 12.1445 21.7113 12.9425C21.4609 16.8174 18.4202 19.8896 14.6209 20.1422C13.2269 20.2348 11.7702 20.2346 10.3791 20.1422C9.96321 20.1145 9.50903 20.0141 9.12962 19.8578L9.11025 19.8498C8.87077 19.7512 8.6633 19.6657 8.5002 19.6084C8.3727 19.5636 8.11726 19.474 7.8539 19.5064C7.60242 19.5373 7.39552 19.6664 7.28243 19.7396C7.15222 19.8239 6.99489 19.9399 6.82122 20.068L6.80355 20.081C6.264 20.4789 5.58642 20.7744 4.51768 20.7484C4.41937 20.746 4.3344 20.7439 4.25892 20.7413C4.31456 20.6302 4.38175 20.5028 4.46352 20.3479C4.9627 19.4019 5.45276 18.022 4.78442 16.812C4.7744 16.7939 4.76364 16.7761 4.75215 16.7589C3.98344 15.6046 3.37658 14.3027 3.28868 12.9425C3.23711 12.1445 3.23711 11.3171 3.28868 10.5191C3.5391 6.64418 6.57977 3.57198 10.3791 3.31942Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

@ -0,0 +1,7 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.49907 7.75C7.11836 7.75 5.99907 8.86929 5.99907 10.25C5.99907 11.6307 7.11836 12.75 8.49907 12.75C9.87978 12.75 10.9991 11.6307 10.9991 10.25C10.9991 8.86929 9.87978 7.75 8.49907 7.75ZM7.49907 10.25C7.49907 9.69772 7.94678 9.25 8.49907 9.25C9.05135 9.25 9.49907 9.69772 9.49907 10.25C9.49907 10.8023 9.05135 11.25 8.49907 11.25C7.94678 11.25 7.49907 10.8023 7.49907 10.25Z" fill="#8F9AA3"/>
<path d="M5.59928 15.9509C6.23877 15.1012 7.339 14.6156 8.49415 14.6031C9.64524 14.5906 10.7415 15.0482 11.3944 15.9422C11.6386 16.2767 12.1079 16.3498 12.4424 16.1056C12.7769 15.8613 12.85 15.3921 12.6057 15.0576C11.6125 13.6975 10.0131 13.0865 8.47786 13.1032C6.94669 13.1198 5.36997 13.7612 4.4008 15.0489C4.15172 15.3798 4.21808 15.85 4.54903 16.0991C4.87998 16.3482 5.3502 16.2818 5.59928 15.9509Z" fill="#8F9AA3"/>
<path d="M14.25 9.5C14.25 9.08579 14.5858 8.75 15 8.75H19C19.4142 8.75 19.75 9.08579 19.75 9.5C19.75 9.91421 19.4142 10.25 19 10.25H15C14.5858 10.25 14.25 9.91421 14.25 9.5Z" fill="#8F9AA3"/>
<path d="M15 12.75C14.5858 12.75 14.25 13.0858 14.25 13.5C14.25 13.9142 14.5858 14.25 15 14.25H17C17.4142 14.25 17.75 13.9142 17.75 13.5C17.75 13.0858 17.4142 12.75 17 12.75H15Z" fill="#8F9AA3"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M22.75 12.0537V11.9463C22.75 9.98841 22.75 8.44682 22.5976 7.24244C22.4417 6.0099 22.1147 5.01711 21.3746 4.23077C20.6284 3.43801 19.6762 3.08185 18.4951 2.91314C17.3529 2.74997 15.8946 2.74998 14.0595 2.75L9.9405 2.75C8.10538 2.74998 6.64711 2.74997 5.50485 2.91314C4.32381 3.08185 3.37155 3.43801 2.62542 4.23077C1.88535 5.01711 1.55834 6.0099 1.40238 7.24244C1.24998 8.44685 1.24999 9.98836 1.25 11.9463V12.0537C1.24999 14.0116 1.24998 15.5532 1.40238 16.7576C1.55834 17.9901 1.88534 18.9829 2.62542 19.7692C3.37155 20.562 4.32381 20.9182 5.50485 21.0869C6.6471 21.25 8.10537 21.25 9.94047 21.25H14.0595C15.8946 21.25 17.3529 21.25 18.4951 21.0869C19.6762 20.9182 20.6284 20.562 21.3746 19.7692C22.1147 18.9829 22.4417 17.9901 22.5976 16.7576C22.75 15.5532 22.75 14.0116 22.75 12.0537ZM20.2823 5.25882C20.7138 5.71728 20.9726 6.34862 21.1095 7.43075C21.2486 8.53002 21.25 9.97655 21.25 12C21.25 14.0235 21.2486 15.47 21.1095 16.5693C20.9726 17.6514 20.7138 18.2827 20.2823 18.7412C19.8568 19.1932 19.2805 19.4594 18.283 19.6019C17.2591 19.7482 15.9081 19.75 14 19.75H10C8.09189 19.75 6.74091 19.7482 5.71697 19.6019C4.71951 19.4594 4.14317 19.1932 3.71772 18.7412C3.28623 18.2827 3.02744 17.6514 2.89051 16.5693C2.75141 15.47 2.75 14.0235 2.75 12C2.75 9.97655 2.75141 8.53002 2.89051 7.43075C3.02744 6.34862 3.28623 5.71728 3.71772 5.25882C4.14317 4.80678 4.71951 4.54055 5.71697 4.39806C6.74091 4.25179 8.09189 4.25 10 4.25L14 4.25C15.9081 4.25 17.2591 4.25179 18.283 4.39806C19.2805 4.54055 19.8568 4.80679 20.2823 5.25882Z" fill="#8F9AA3"/>
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

@ -0,0 +1,12 @@
<svg width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.5 23.25C18.299 23.25 23 18.549 23 12.75C23 6.95101 18.299 2.25 12.5 2.25C6.70101 2.25 2 6.95101 2 12.75C2 14.6332 2.49575 16.4005 3.36386 17.9287L2 23.25L7.48615 21.9778C8.97603 22.7891 10.6842 23.25 12.5 23.25ZM12.5 21.6346C17.4068 21.6346 21.3846 17.6568 21.3846 12.75C21.3846 7.84316 17.4068 3.86538 12.5 3.86538C7.59316 3.86538 3.61538 7.84316 3.61538 12.75C3.61538 14.6445 4.20838 16.4006 5.21888 17.8427L4.42308 20.8269L7.45995 20.0677C8.89202 21.0559 10.6284 21.6346 12.5 21.6346Z" fill="#BFC8D0"/>
<path d="M21.5 12C21.5 16.9706 17.4706 21 12.5 21C10.6041 21 8.84516 20.4138 7.39449 19.4127L4.31818 20.1818L5.12432 17.1588C4.10069 15.698 3.5 13.9192 3.5 12C3.5 7.02944 7.52944 3 12.5 3C17.4706 3 21.5 7.02944 21.5 12Z" fill="url(#paint0_linear_6394_2727)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.5 22.5C18.299 22.5 23 17.799 23 12C23 6.20101 18.299 1.5 12.5 1.5C6.70101 1.5 2 6.20101 2 12C2 13.8832 2.49575 15.6505 3.36386 17.1787L2 22.5L7.48615 21.2278C8.97603 22.0391 10.6842 22.5 12.5 22.5ZM12.5 20.8846C17.4068 20.8846 21.3846 16.9068 21.3846 12C21.3846 7.09316 17.4068 3.11538 12.5 3.11538C7.59316 3.11538 3.61538 7.09316 3.61538 12C3.61538 13.8945 4.20838 15.6506 5.21888 17.0927L4.42308 20.0769L7.45995 19.3177C8.89202 20.3059 10.6284 20.8846 12.5 20.8846Z" fill="white"/>
<path d="M9.87502 7.12504C9.62537 6.6236 9.2424 6.668 8.85551 6.668C8.16407 6.668 7.08594 7.49621 7.08594 9.03759C7.08594 10.3008 7.64259 11.6836 9.51831 13.7522C11.3285 15.7485 13.707 16.7812 15.6817 16.7461C17.6563 16.7109 18.0625 15.0117 18.0625 14.4379C18.0625 14.1835 17.9047 14.0566 17.796 14.0221C17.1231 13.6992 15.882 13.0975 15.5996 12.9844C15.3172 12.8714 15.1698 13.0243 15.0781 13.1075C14.8221 13.3515 14.3144 14.0707 14.1406 14.2325C13.9668 14.3942 13.7077 14.3124 13.5999 14.2512C13.2031 14.092 12.1272 13.6134 11.2696 12.7821C10.209 11.754 10.1467 11.4002 9.94693 11.0854C9.78707 10.8335 9.90437 10.6789 9.96291 10.6114C10.1914 10.3477 10.507 9.94061 10.6485 9.73832C10.79 9.53602 10.6776 9.22889 10.6102 9.03759C10.3203 8.21488 10.0747 7.52618 9.87502 7.12504Z" fill="white"/>
<defs>
<linearGradient id="paint0_linear_6394_2727" x1="20.375" y1="5.25" x2="3.5" y2="21" gradientUnits="userSpaceOnUse">
<stop stop-color="#5BD066"/>
<stop offset="1" stop-color="#27B43E"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

@ -21,8 +21,8 @@ var PACKAGES_ORDERS = '/api/orders';
var PACKAGES_ORDER_HISTORY = '/api/orders/items';
var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara';
// var BASE_URL = 'http://10.50.100.198:2018/';
var BASE_URL = 'https://uat.hmgwebservices.com/';
// var BASE_URL = 'https://hmgwebservices.com/';
// var BASE_URL = 'https://uat.hmgwebservices.com/';
var BASE_URL = 'https://hmgwebservices.com/';
// var BASE_URL = 'http://10.201.204.103/';
// var BASE_URL = 'https://orash.cloudsolutions.com.sa/';
// var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/';

@ -1,39 +1,32 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:hmg_patient_app/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart';
import 'package:hmg_patient_app/uitl/translations_delegate_base.dart';
import 'package:hmg_patient_app/widgets/mobile-no/mobile_no.dart';
import 'package:hmg_patient_app/widgets/text/app_texts_widget.dart';
class OtpVerificationBottomSheet extends StatefulWidget {
class GenericBottomSheet extends StatefulWidget {
final String countryCode;
final String initialPhoneNumber;
final Function(String phoneNumber, bool viaWhatsApp) onOtpRequested;
final List<Widget> buttons;
TextEditingController? textController;
const OtpVerificationBottomSheet({
GenericBottomSheet({
Key? key,
this.countryCode = "+966",
this.initialPhoneNumber = "",
required this.onOtpRequested,
required this.buttons,
this.textController,
}) : super(key: key);
@override
_OtpVerificationBottomSheetState createState() => _OtpVerificationBottomSheetState();
_GenericBottomSheetState createState() => _GenericBottomSheetState();
}
class _OtpVerificationBottomSheetState extends State<OtpVerificationBottomSheet> {
late TextEditingController _phoneController;
bool _viaWhatsApp = true;
class _GenericBottomSheetState extends State<GenericBottomSheet> {
@override
void initState() {
super.initState();
_phoneController = TextEditingController(text: widget.initialPhoneNumber);
}
@override
void dispose() {
_phoneController.dispose();
super.dispose();
widget.textController = TextEditingController(text: widget.initialPhoneNumber);
}
@override
@ -52,113 +45,43 @@ class _OtpVerificationBottomSheetState extends State<OtpVerificationBottomSheet>
// Title
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [AppText("Enter Phone Number", fontSize: 28, letterSpacing: -2, fontFamily: 'poppins', color: Color(0xFF2E3039), fontWeight: FontWeight.w600), Icon(Icons.close_outlined)],
children: [
AppText("Enter Phone Number", fontSize: 28, letterSpacing: -2, fontFamily: 'poppins', color: Color(0xFF2E3039), fontWeight: FontWeight.w600),
InkWell(
onTap: () {
Navigator.of(context).pop();
},
child: SvgPicture.asset("assets/images/svg/cross-circle.svg", width: 24, height: 24)),
],
),
const SizedBox(height: 10),
// Subtitle
AppText("Enter your phone number to receive OTP verification code", fontSize: 16, fontFamily: 'poppins', color: Color(0xFF2E3039), fontWeight: FontWeight.w500),
const SizedBox(height: 10),
_buildPhoneNumberSection(),
const SizedBox(height: 24),
_buildDeliveryMethodSection(),
widget.textController != null
? Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Directionality(
textDirection: TextDirection.ltr,
child: inputWidget(TranslationBase.of(context).phoneNumber, "5xxxxxxxx", widget.textController!, onChange: (value) {
widget.textController!.text = value!;
}, isEnable: true, prefix: "966", hasSelection: false, isBorderAllowed: false, isAllowLeadingIcon: true, leadingIcon: "assets/images/svg/smart-phone.svg"),
),
],
)
: SizedBox(),
SizedBox(height: 24),
...widget.buttons,
],
),
);
}
Widget _buildPhoneNumberSection() {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Directionality(
textDirection: TextDirection.ltr,
child: inputWidget(TranslationBase.of(context).phoneNumber, "5xxxxxxxx", _phoneController, isEnable: true, prefix: "966", hasSelection: false, isBorderAllowed: false, isAllowLeadingIcon: true),
),
],
);
}
Widget _buildDeliveryMethodSection() {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
// SMS Option
InkWell(
onTap: () {
setState(() {
_viaWhatsApp = false;
});
},
child: Row(
children: [
CustomButton(
text: "Send me OTP on SMS",
onPressed: () {
setState(() {
_viaWhatsApp = false;
});
},
backgroundColor: Colors.red,
borderColor: Colors.red,
textColor: Colors.white,
borderRadius: 12,
padding: const EdgeInsets.fromLTRB(8, 16, 8, 16),
fontSize: 16,
fontFamily: 'poppins',
fontWeight: FontWeight.w500,
),
],
),
),
const SizedBox(height: 10),
// OR Divider
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child:AppText("OR", fontSize: 16, fontFamily: 'poppins', color: Color(0xFF2E3039), fontWeight: FontWeight.w500),
),
],
),
const SizedBox(height: 10),
InkWell(
onTap: () {
setState(() {
_viaWhatsApp = true;
});
},
child: Row(
children: [
CustomButton(
text: "Send me OTP on WhatsApp",
onPressed: () {
setState(() {
_viaWhatsApp = true;
});
},
backgroundColor: Colors.white,
borderColor: Color(0xFF2E3039),
textColor: Color(0xFF2E3039),
borderRadius: 12,
padding: const EdgeInsets.fromLTRB(8, 16, 8, 16),
fontSize: 16,
borderWidth: 2,
fontFamily: 'poppins',
fontWeight: FontWeight.w500,
),
],
),
),
],
);
}
}
class CustomButton extends StatelessWidget {
final String text;
String? icon;
final VoidCallback onPressed;
final Color backgroundColor;
final Color borderColor;
@ -171,7 +94,7 @@ class CustomButton extends StatelessWidget {
final FontWeight fontWeight;
final bool isDisabled;
const CustomButton({
CustomButton({
Key? key,
required this.text,
required this.onPressed,
@ -185,25 +108,37 @@ class CustomButton extends StatelessWidget {
this.fontFamily = 'poppins',
this.fontWeight = FontWeight.w500,
this.isDisabled = false,
this.icon,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Expanded(
child: GestureDetector(
onTap: isDisabled ? null : onPressed,
child: Container(
padding: padding,
decoration: BoxDecoration(
color: isDisabled ? backgroundColor.withOpacity(0.5) : backgroundColor,
borderRadius: BorderRadius.circular(borderRadius),
border: Border.all(
color: isDisabled ? borderColor.withOpacity(0.5) : borderColor,
width: borderWidth,
),
return GestureDetector(
onTap: isDisabled ? null : onPressed,
child: Container(
padding: padding,
decoration: BoxDecoration(
color: isDisabled ? backgroundColor.withOpacity(0.5) : backgroundColor,
borderRadius: BorderRadius.circular(borderRadius),
border: Border.all(
color: isDisabled ? borderColor.withOpacity(0.5) : borderColor,
width: borderWidth,
),
child: Center(
child: Text(
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (icon != null)
Padding(
padding: const EdgeInsets.only(right: 8.0),
child: SvgPicture.asset(
icon!,
width: 24,
height: 24,
),
),
Text(
text,
style: TextStyle(
fontSize: fontSize,
@ -212,7 +147,7 @@ class CustomButton extends StatelessWidget {
fontWeight: fontWeight,
),
),
),
],
),
),
);

@ -305,8 +305,8 @@ class _CarbsState extends State<Carbs> {
// }
}
Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller,
{String? prefix, bool isEnable = true, bool hasSelection = false, bool isBorderAllowed = true, bool isAllowLeadingIcon = false}) {
Widget inputWidget(String _labelText, String _hintText, TextEditingController? _controller,
{Function? onChange(String? value)?, String? prefix, bool isEnable = true, bool hasSelection = false, bool isBorderAllowed = true, bool isAllowLeadingIcon = false, String? leadingIcon,}) {
return Container(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
alignment: Alignment.center,
@ -324,7 +324,7 @@ Widget inputWidget(String _labelText, String _hintText, TextEditingController _c
onTap: hasSelection ? () {} : null,
child: Row(
children: [
if (isAllowLeadingIcon)
if (isAllowLeadingIcon && leadingIcon != null)
Container(
height: 40,
width: 40,
@ -336,30 +336,43 @@ Widget inputWidget(String _labelText, String _hintText, TextEditingController _c
Radius.circular(10),
),
),
child: SvgPicture.asset("assets/images/svg/smart-phone.svg", width: 24,height: 24,),
child: SvgPicture.asset(
leadingIcon,
width: 24,
height: 24,
),
),
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
_labelText,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
color: Color(0xff898A8D),
fontFamily: 'poppins',
letterSpacing: -0.2,
height: 18/12
),
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w500, color: Color(0xff898A8D), fontFamily: 'poppins', letterSpacing: -0.2, height: 18 / 12),
),
// if(prefix !=null) Row(
// children: [
// Text(
// "+" + prefix,
// style: TextStyle(
// fontSize: 14,
// height: 21 / 14,
// fontWeight: FontWeight.w500,
// color: Color(0xff2E303A),
// letterSpacing: -0.56,
// ),
// ),
// ],
// ),
TextField(
enabled: isEnable,
scrollPadding: EdgeInsets.zero,
keyboardType: TextInputType.number,
controller: _controller,
onChanged: (value) => {},
textAlignVertical: TextAlignVertical.top,
onChanged: onChange,
style: TextStyle(
fontSize: 14,
height: 21 / 14,
@ -372,12 +385,12 @@ Widget inputWidget(String _labelText, String _hintText, TextEditingController _c
hintText: _hintText,
hintStyle: TextStyle(
fontSize: 14,
height: 21 / 14,
height: 21 / 16,
fontWeight: FontWeight.w500,
color: Color(0xff2E3039),
letterSpacing: -0.2,
),
prefixIconConstraints: BoxConstraints(minWidth: 50),
prefixIconConstraints: BoxConstraints(minWidth: 45),
prefixIcon: prefix == null
? null
: Text(
@ -387,7 +400,7 @@ Widget inputWidget(String _labelText, String _hintText, TextEditingController _c
height: 21 / 14,
fontWeight: FontWeight.w500,
color: Color(0xff2E303A),
letterSpacing: -0.56,
letterSpacing: -0.2,
),
),
contentPadding: EdgeInsets.zero,

@ -70,13 +70,9 @@ class _ConfirmLogin extends State<ConfirmLogin> {
var registerd_data;
bool isMoreOption = false;
var zipCode;
var patientOutSA;
var loginTokenID;
var loginType;
var deviceToken;
var lastLogin;

@ -54,6 +54,7 @@ class _RegisterNew extends State<RegisterNew> {
isShowAppBar: true,
isShowDecPage: false,
showNewAppBar: true,
showNewAppBarTitle: true,
body: SingleChildScrollView(
child: Container(

@ -1,17 +1,46 @@
import 'package:flutter/gestures.dart';
import 'package:hmg_patient_app/analytics/google-analytics.dart';
import 'package:hmg_patient_app/config/config.dart';
import 'package:hmg_patient_app/config/shared_pref_kay.dart';
import 'package:hmg_patient_app/core/service/AuthenticatedUserObject.dart';
import 'package:hmg_patient_app/core/viewModels/appointment_rate_view_model.dart';
import 'package:hmg_patient_app/core/viewModels/project_view_model.dart';
import 'package:hmg_patient_app/locator.dart';
import 'package:hmg_patient_app/models/Appointments/toDoCountProviderModel.dart';
import 'package:hmg_patient_app/models/Authentication/check_activation_code_response.dart';
import 'package:hmg_patient_app/models/Authentication/check_paitent_authentication_req.dart';
import 'package:hmg_patient_app/models/Authentication/select_device_imei_res.dart';
import 'package:hmg_patient_app/models/Authentication/send_activation_request.dart';
import 'package:hmg_patient_app/models/InPatientServices/get_admission_info_response_model.dart';
import 'package:hmg_patient_app/models/InPatientServices/get_admission_request_info_response_model.dart';
import 'package:hmg_patient_app/new_ui/otp/otp_validation_bootmsheet_widget.dart';
import 'package:hmg_patient_app/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart';
import 'package:hmg_patient_app/pages/landing/landing_page.dart';
import 'package:hmg_patient_app/pages/login/login-type.dart';
import 'package:hmg_patient_app/pages/login/register.dart';
import 'package:hmg_patient_app/pages/login/register_new.dart';
import 'package:hmg_patient_app/pages/login/user-login-agreement-page.dart';
import 'package:hmg_patient_app/pages/rateAppointment/rate_appointment_doctor.dart';
import 'package:hmg_patient_app/services/authentication/auth_provider.dart';
import 'package:hmg_patient_app/services/clinic_services/get_clinic_service.dart';
import 'package:hmg_patient_app/theme/colors.dart';
import 'package:hmg_patient_app/uitl/app_shared_preferences.dart';
import 'package:hmg_patient_app/uitl/app_toast.dart';
import 'package:hmg_patient_app/uitl/gif_loader_dialog_utils.dart';
import 'package:hmg_patient_app/uitl/translations_delegate_base.dart';
import 'package:hmg_patient_app/uitl/utils.dart';
import 'package:hmg_patient_app/widgets/buttons/defaultButton.dart';
import 'package:hmg_patient_app/widgets/others/app_scaffold_widget.dart';
import 'package:hmg_patient_app/widgets/otp/sms-popup.dart';
import 'package:hmg_patient_app/widgets/text/app_texts_widget.dart';
import 'package:hmg_patient_app/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:intl/src/intl/date_format.dart';
import 'package:provider/provider.dart';
enum OTPType { sms, whatsapp }
class WelcomeLogin extends StatefulWidget {
@override
@ -20,6 +49,46 @@ class WelcomeLogin extends StatefulWidget {
class _WelcomeLogin extends State<WelcomeLogin> {
bool isLoading = true;
TextEditingController nationIdController = TextEditingController();
TextEditingController phoneController = TextEditingController();
bool isDubai = false;
var _availableBiometrics;
final authService = AuthProvider();
var sharedPref = AppSharedPreferences();
bool authenticated = false;
late int mobileNumber;
String errorMsg = '';
SelectDeviceIMEIRES? user;
var registerd_data;
bool isMoreOption = false;
var zipCode;
var patientOutSA;
var loginTokenID;
var loginType;
var deviceToken;
var lastLogin;
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
AppointmentRateViewModel appointmentRateViewModel = locator<AppointmentRateViewModel>();
late ProjectViewModel projectViewModel;
late ToDoCountProviderModel toDoProvider;
late int selectedOption;
bool onlySMSBox = false;
var userData;
late BuildContext _context;
late bool _loading;
int fingrePrintBefore = 0;
var dob;
late int isHijri;
var healthId;
@override
void initState() {
@ -28,10 +97,15 @@ class _WelcomeLogin extends State<WelcomeLogin> {
}
Widget build(BuildContext context) {
projectViewModel = Provider.of(context);
toDoProvider = Provider.of<ToDoCountProviderModel>(context);
return AppScaffold(
appBarTitle: TranslationBase.of(context).welcome,
isShowDecPage: false,
isShowAppBar: true,
isshowBackButton: false,
showNewAppBar: true,
backgroundColor: Color(0xffF8F8F8),
showNewAppBarTitle: false,
@ -55,68 +129,623 @@ class _WelcomeLogin extends State<WelcomeLogin> {
],
),
),
Spacer(),
Expanded(
child: Container(
padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21),
child: Column(
children: [
Text(
// TranslationBase.of(context).welcome,
"Welcome to Dr. Sulaiman Al Habib Medical Group",
style: TextStyle(fontSize: 36, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 47 / 36),
),
SizedBox(height: 16)
],
padding: EdgeInsets.only(top: 30, bottom: 0, right: 21, left: 21),
child: Text(
// TranslationBase.of(context).welcome,
"Welcome to Dr. Sulaiman Al Habib Medical Group",
style: TextStyle(fontSize: 36, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 47 / 36),
),
),
),
Container(
color: Colors.white,
padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21),
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Expanded(
padding: EdgeInsets.only(top: 16, bottom: 10, right: 21, left: 21),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Directionality(
textDirection: TextDirection.ltr,
child: inputWidget(
"National ID. or File No",
"1xxxxxxxx",
nationIdController,
isEnable: true,
prefix: null,
hasSelection: false,
isBorderAllowed: false,
isAllowLeadingIcon: true,
leadingIcon: "assets/images/svg/student-card.svg",
),
),
],
),
),
SizedBox(
height: 15,
),
Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Expanded(
child: Container(
padding: EdgeInsets.only(top: 0, bottom: 16, right: 21, left: 21),
child: DefaultButton(
TranslationBase.of(context).login,
() => {
showModalBottomSheet(
context: context,
isScrollControlled: true,
backgroundColor: Colors.transparent,
builder: (context) => OtpVerificationBottomSheet(
countryCode: "+966", // Default is +966 as in your example
initialPhoneNumber: "574345434", // Optional initial value
onOtpRequested: (phoneNumber, viaWhatsApp) {
// Handle OTP request here
print("Requesting OTP for $phoneNumber via ${viaWhatsApp ? "WhatsApp" : "SMS"}");
Navigator.pop(context);
},
))
// Navigator.of(context).push(FadePage(page: RegisterNew())),
// locator<GAnalytics>().loginRegistration.visited_alhabib_group(false),
() {
bool isValid = validateIqama(nationIdController.text);
print("Iqama is valid: $isValid");
if (isValid) {
showModalBottomSheet(
context: context,
isScrollControlled: true,
isDismissible: false,
backgroundColor: Colors.transparent,
builder: (context) => Padding(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom,
),
child: SingleChildScrollView(
child: GenericBottomSheet(
countryCode: "966", // Default is +966 as in your example
initialPhoneNumber: "", //
textController: phoneController,
buttons: [
Padding(
padding: const EdgeInsets.only(bottom: 10),
child: CustomButton(
text: "Send me OTP on SMS",
onPressed: () {
onOtpBtnPressed(OTPType.sms);
},
backgroundColor: Colors.red,
borderColor: Colors.red,
textColor: Colors.white,
icon: "assets/images/svg/message.svg",
),
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: AppText(
"OR",
fontSize: 16,
fontFamily: 'poppins',
color: Color(0xFF2E3039),
fontWeight: FontWeight.w500,
),
),
],
),
Padding(
padding: const EdgeInsets.only(bottom: 10),
child: CustomButton(
text: "Send me OTP on WhatsApp",
onPressed: () {
onOtpBtnPressed(OTPType.whatsapp);
},
backgroundColor: Colors.white,
borderColor: Color(0xFF2E3039),
textColor: Color(0xFF2E3039),
icon: "assets/images/svg/whatsapp.svg",
),
),
],
),
),
));
} else {
Utils.showErrorToast("Please enter a valid Iqama number.");
}
},
color: CustomColors.accentColor,
// color: CustomColors.,
textColor: Colors.white,
),
),
// SizedBox(width: 8),
// Expanded(
// child: DefaultButton(
// TranslationBase.of(context).yes,
// () => {
// Navigator.of(context).push(FadePage(page: LoginType())),
// locator<GAnalytics>().loginRegistration.visited_alhabib_group(true),
// },
// color: CustomColors.green,
// ),
// ),
],
),
),
// SizedBox(width: 8),
// Expanded(
// child: DefaultButton(
// TranslationBase.of(context).yes,
// () => {
// Navigator.of(context).push(FadePage(page: LoginType())),
// locator<GAnalytics>().loginRegistration.visited_alhabib_group(true),
// },
// color: CustomColors.green,
// ),
// ),
],
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
RichText(
textAlign: TextAlign.center,
text: TextSpan(
style: TextStyle(
color: Colors.black,
fontSize: 16,
height: 26 / 16,
fontFamily: 'poppins',
fontWeight: FontWeight.w500,
),
children: <TextSpan>[
TextSpan(text: 'Dont have an account? '),
TextSpan(
text: 'Register now',
style: const TextStyle(
color: Colors.red,
fontSize: 16,
height: 26 / 16,
fontFamily: 'poppins',
fontWeight: FontWeight.w500,
),
recognizer: TapGestureRecognizer()
..onTap = () {
Navigator.of(context).push(FadePage(page: RegisterNew()));
// Example: Navigator.push(context, MaterialPageRoute(builder: (context) => RegisterScreen()));
},
),
],
),
),
],
)
],
),
);
}
}
void onOtpBtnPressed(OTPType type) {
if (phoneController.text.isEmpty) {
Utils.showErrorToast("Please enter your phone number.");
return;
}
if (type == OTPType.whatsapp && !phoneController.text.startsWith("+966")) {
Utils.showErrorToast("WhatsApp OTP requires a phone number starting with +966.");
return;
}
print("Requesting OTP for ${phoneController.text} via ${type == OTPType.whatsapp ? "WhatsApp" : "SMS"} and ${nationIdController.text}");
// Navigator.pop(context);
checkUserAuthentication(type == OTPType.sms ? 1 : 2);
}
bool validateIqama(String iqamaNumber) {
// Remove any non-digit characters
String cleanedIqama = iqamaNumber.replaceAll(RegExp(r'[^0-9]'), '');
// Check if length is 10 digits
if (cleanedIqama.length != 10) {
return false;
}
// Check if first digit is 2 or 1 (common for Iqama)
int firstDigit = int.parse(cleanedIqama[0]);
if (firstDigit != 2 && firstDigit != 1) {
return false;
}
// Checksum validation (similar to Saudi National ID)
int sum = 0;
for (int i = 0; i < 10; i++) {
int digit = int.parse(cleanedIqama[i]);
int weight = (i % 2 == 0) ? 2 : 1; // Alternate weights: 2, 1, 2, 1...
int product = digit * weight;
sum += (product > 9) ? product - 9 : product; // Sum digits if product > 9
}
return sum % 10 == 0;
}
checkUserAuthentication(type) {
showLoader(true);
var req = getCommonRequest(type: type);
req.logInTokenID = "";
var request = CheckPatientAuthenticationReq.fromJson(req.toJson());
sharedPref.setObject(REGISTER_DATA_FOR_REGISTER, request);
authService
.checkPatientAuthentication(request)
.then((value) => {
GifLoaderDialogUtils.hideDialog(context),
if (value['isSMSSent'])
{
sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']),
this.loginTokenID = value['LogInTokenID'],
sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, request),
// Future.delayed(Duration(seconds: 1), () {
this.sendActivationCode(type)
// })
}
else
{
if (value['IsAuthenticated']) {this.checkActivationCode()}
}
})
.catchError((err) {
print(err);
GifLoaderDialogUtils.hideDialog(context);
});
}
sendActivationCode(type) async {
var request = this.getCommonRequest(type: type);
request.sMSSignature = await SMSOTP.getSignature();
GifLoaderDialogUtils.showMyDialog(context);
if (healthId != null || isDubai) {
if (!isDubai) {
request.dob = dob; //isHijri == 1 ? dob : dateFormat2.format(dateFormat.parse(dob));
}
request.healthId = healthId;
request.isHijri = isHijri;
await this.authService.sendActivationCodeRegister(request).then((result) {
GifLoaderDialogUtils.hideDialog(context);
if (result != null && result['isSMSSent'] == true) {
this.startSMSService(type);
}
}).catchError((r) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: r);
});
} else {
request.dob = "";
request.healthId = "";
request.isHijri = 0;
await this.authService.sendActivationCode(request).then((result) {
GifLoaderDialogUtils.hideDialog(context);
if (result != null && result['isSMSSent'] == true) {
this.startSMSService(type);
}
}).catchError((r) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: r.toString());
});
}
}
checkActivationCode({value}) async {
// Navigator.pop(context);
GifLoaderDialogUtils.showMyDialog(context);
var request = this.getCommonRequest().toJson();
dynamic res;
if (healthId != null || isDubai) {
if (isDubai) {
request['DOB'] = dob;
}
request['HealthId'] = healthId;
request['IsHijri'] = isHijri;
authService
.checkActivationCodeRegister(request, value)
.then((result) => {
res = result,
if (result is Map)
{
result = CheckActivationCode.fromJson(result as Map<String, dynamic>),
if (this.registerd_data != null && this.registerd_data.isRegister == true)
{
// if(widget.isDubai ==false){
// widget.changePageViewIndex!(1),
// if(widget.isDubai ==false){
Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RegisterNew)),
}
}
else
{
Navigator.of(context).pop(),
GifLoaderDialogUtils.hideDialog(context),
Future.delayed(Duration(seconds: 1), () {
AppToast.showErrorToast(message: result);
}),
// projectViewModel.analytics.loginRegistration.login_fail(error: result),
// projectViewModel.analytics.errorTracking.log('otp_verification_at_confirm_login', error: result),
}
})
.catchError((err) {
print(err);
GifLoaderDialogUtils.hideDialog(context);
Future.delayed(Duration(seconds: 1), () {
AppToast.showErrorToast(message: err);
// startSMSService(tempType);
});
});
} else {
authService
.checkActivationCode(request, value)
.then((result) async => {
res = result,
if (result is Map)
{
result = CheckActivationCode.fromJson(result as Map<String, dynamic>),
if (result.errorCode == '699')
{
//699 block run here
GifLoaderDialogUtils.hideDialog(context),
Future.delayed(Duration(seconds: 2), () {
AppToast.showErrorToast(message: result.errorEndUserMessage);
Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: WelcomeLogin));
})
}
else if (this.registerd_data != null && this.registerd_data.isRegister == true)
{
// widget.changePageViewIndex!(1),
Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RegisterNew)),
}
else
{
sharedPref.remove(FAMILY_FILE),
result.list.isFamily = false,
userData = result.list,
sharedPref.setString(BLOOD_TYPE, result.patientBloodType ?? ""),
//Remove o+ from here Added by Aamir
authenticatedUserObject.user = result.list,
projectViewModel.setPrivilege(privilegeList: res),
await sharedPref.setObject(MAIN_USER, result.list),
await sharedPref.setObject(USER_PROFILE, result.list),
loginTokenID = result.logInTokenID,
await sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID),
await sharedPref.setString(TOKEN, result.authenticationTokenID),
checkIfUserAgreedBefore(result),
// projectViewModel.analytics.loginRegistration.login_successful(),
}
}
else
{
// Navigator.of(context).pop(),
GifLoaderDialogUtils.hideDialog(context),
Future.delayed(Duration(seconds: 1), () {
Navigator.of(context).pop();
AppToast.showErrorToast(message: result, localContext: context);
startSMSService(tempType);
}),
// projectViewModel.analytics.loginRegistration.login_fail(error: result),
// projectViewModel.analytics.errorTracking.log('otp_verification_at_confirm_login', error: result)
}
})
.catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
Future.delayed(Duration(seconds: 1), () {
print(err);
AppToast.showErrorToast(message: err);
// startSMSService(tempType);
});
});
}
}
var tempType;
startSMSService(type) {
tempType = type;
SMSOTP(
context,
type,
phoneController.text,
(value) {
this.checkActivationCode(value: value);
},
() => {
Navigator.pop(context),
},
).displayDialog(context);
}
showLoader(bool isTrue) {
setState(() {
isLoading = isTrue;
});
}
setDefault() async {
showLoader(true);
if (await sharedPref.getObject(IMEI_USER_DATA) != null) user = SelectDeviceIMEIRES.fromJson(await sharedPref.getObject(IMEI_USER_DATA));
if (await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN) != null) {
isMoreOption = true;
this.registerd_data = await CheckPatientAuthenticationReq.fromJson(await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN));
}
this.mobileNumber = this.registerd_data != null ? this.registerd_data.patientMobileNumber : int.parse(this.user!.mobile!);
this.zipCode = this.registerd_data != null
? this.registerd_data.zipCode
: this.user!.outSA == true
? "971"
: "966";
this.patientOutSA = this.registerd_data != null
? this.registerd_data.zipCode == "966"
? 0
: 1
: this.user!.outSA;
if (this.registerd_data != null) {
this.loginTokenID = await sharedPref.getString(LOGIN_TOKEN_ID);
this.loginType = this.registerd_data.searchType;
}
var nhic = await sharedPref.getObject(NHIC_DATA);
if (nhic != null) {
final DateFormat dateFormat = DateFormat('MM/dd/yyyy');
final DateFormat dateFormat2 = DateFormat('dd/MM/yyyy');
dob = nhic['IsHijri'] ? nhic['DateOfBirth'] : dateFormat2.format(dateFormat.parse(nhic['DateOfBirth']));
isHijri = nhic['IsHijri'] ? 1 : 0;
healthId = nhic['HealthId'];
}
this.deviceToken = await sharedPref.getString(PUSH_TOKEN);
this.lastLogin = await sharedPref.getInt(LAST_LOGIN) != null
? await sharedPref.getInt(LAST_LOGIN)
: user != null
? user!.logInType
: null;
showLoader(false);
//this.cs.sharedService.getStorage(AuthenticationService.LAST_LOGIN);
}
getCommonRequest({type}) {
var fileNo = false;
var request = SendActivationRequest();
request.patientMobileNumber = int.parse(phoneController.text);
request.mobileNo = '0' + phoneController.text.toString();
request.deviceToken = this.deviceToken;
request.projectOutSA = this.patientOutSA == true ? true : false;
request.loginType = type == 1 ? type : 2;
request.oTPSendType = type == 1 ? type : 2; //this.selectedOption == 1 ? 1 : 2;
request.zipCode = "966";
request.logInTokenID = this.loginTokenID ?? "";
if (this.registerd_data != null) {
request.searchType = this.registerd_data.searchType != null ? this.registerd_data.searchType : 1;
request.patientID = this.registerd_data.patientID != null ? this.registerd_data.patientID : 0;
request.patientIdentificationID = request.nationalID = this.registerd_data.patientIdentificationID != null ? this.registerd_data.patientIdentificationID : '0';
request.dob = this.registerd_data.dob;
request.isRegister = this.registerd_data.isRegister;
} else {
request.searchType = request.searchType != null ? request.searchType : 1;
if (fileNo) {
request.patientID = this.user!.patientID != null ? this.user!.patientID : 0;
} else {
request.patientID = 0;
}
request.nationalID = nationIdController != null ? nationIdController.text : '0';
request.patientIdentificationID = nationIdController != null ? nationIdController.text : '0';
request.isRegister = false;
}
request.deviceTypeID = request.searchType;
return request;
}
checkIfUserAgreedBefore(CheckActivationCode result) {
if (projectViewModel.havePrivilege(109)) {
this.authService.checkIfUserAgreed().then((result) {
if (result['IsPatientAlreadyAgreed']) {
goToHome();
} else {
this.authService.getUserAgreementContent().then((result) {
GifLoaderDialogUtils.hideDialog(AppGlobal.context);
Navigator.pushAndRemoveUntil(
context,
FadePage(
page: UserLoginAgreementPage(
userAgreementText: result['UserAgreementContent'],
authenticatedUserObject: authenticatedUserObject,
appointmentRateViewModel: appointmentRateViewModel,
selectedOption: selectedOption,
isArabic: projectViewModel.isArabic,
),
),
(r) => false);
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err);
});
}
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err);
});
} else {
goToHome();
}
}
Future<void> goToHome() async {
authenticatedUserObject.isLogin = true;
appointmentRateViewModel.isLogin = true;
projectViewModel.isLogin = true;
projectViewModel.user = authenticatedUserObject.user;
await authenticatedUserObject.getUser(getUser: true);
getToDoCount();
checkIfIsInPatient();
appointmentRateViewModel
.getIsLastAppointmentRatedList(projectViewModel.isArabic ? 1 : 2)
.then((_) {
GifLoaderDialogUtils.hideDialog(AppGlobal.context);
if (appointmentRateViewModel.isHaveAppointmentNotRate) {
Navigator.pushAndRemoveUntil(
context,
FadePage(page: RateAppointmentDoctor()),
(route) => false,
);
} else {
Navigator.pushAndRemoveUntil(
context,
FadePage(page: LandingPage()),
(route) => false,
);
}
insertIMEI();
}).catchError((error) {
print(error);
});
}
void getToDoCount() {
toDoProvider.setState(0, 0, true, "0");
ClinicListService()
.getActiveAppointmentNo(context)
.then((res) {
if (res['MessageStatus'] == 1) {
toDoProvider.setState(
res['AppointmentActiveNumber'],
res['AncillaryOrderListCount'],
true,
"0",
);
}
}).catchError((err) => print(err));
}
insertIMEI() {
authService.insertDeviceImei(selectedOption).then((value) => {}).catchError((err) {
print(err);
});
}
void checkIfIsInPatient() {
final service = ClinicListService();
service.checkIfInPatientAPI(context).then((res) {
if (res['MessageStatus'] != 1) return;
final isAdmitted = res['isAdmitted'] == true;
final hasAdmissionRequest = res['hasAdmissionRequests'] == true;
print("IS ADMITTED: $isAdmitted");
print("Has Admission Request: $hasAdmissionRequest");
if (isAdmitted && res['PatientAdmittedInformation']?.isNotEmpty == true) {
final info = GetAdmissionInfoResponseModel.fromJson(res['PatientAdmittedInformation'][0]);
projectViewModel.setInPatientProjectID(res['PatientAdmittedInformation'][0]['ProjectID']);
projectViewModel.setInPatientAdmissionInfo(info);
projectViewModel.setIsPatientAdmitted(true);
}
if (hasAdmissionRequest && res['MedicalInstruction']?.isNotEmpty == true) {
final reqInfo = GetAdmissionRequestInfoResponseModel.fromJson(res['MedicalInstruction'][0]);
projectViewModel.setInPatientProjectID(res['MedicalInstruction'][0]['projectId']);
projectViewModel.setInPatientAdmissionRequest(reqInfo);
projectViewModel.setPatientHasAdmissionRequest(true);
}
});
}
}

@ -7,6 +7,7 @@ import 'package:hmg_patient_app/config/shared_pref_kay.dart';
import 'package:hmg_patient_app/models/Appointments/DoctorListResponse.dart';
import 'package:hmg_patient_app/pages/BookAppointment/SearchResultsByRegion.dart';
import 'package:hmg_patient_app/pages/landing/landing_page.dart';
import 'package:hmg_patient_app/pages/login/welcome.dart';
import 'package:hmg_patient_app/theme/theme_notifier.dart';
import 'package:hmg_patient_app/theme/theme_value.dart';
import 'package:hmg_patient_app/uitl/LocalNotification.dart';
@ -38,7 +39,7 @@ class _SplashScreenState extends State<SplashScreen> {
@override
void initState() {
AppGlobal.context = context;
// AppGlobal.context = context;
super.initState();
print("Splash init called.............");
Timer(
@ -50,7 +51,8 @@ class _SplashScreenState extends State<SplashScreen> {
if (!_privilegeService.hasError) {
Navigator.of(context).pushReplacement(
MaterialPageRoute(
builder: (BuildContext context) => LandingPage(),
builder: (BuildContext context) => WelcomeLogin(),
// builder: (BuildContext context) => LandingPage(),
),
);
} else {}

@ -82,6 +82,7 @@ class AppScaffold extends StatefulWidget {
final ValueChanged<int>? changeCurrentTab;
final int? currentTab;
final bool isShowPharmacyAppbar;
final bool isshowBackButton;
final Widget? customAppBar;
AppScaffold setOnAppBarCartClick(VoidCallback onClick) {
@ -127,6 +128,7 @@ class AppScaffold extends StatefulWidget {
appBar,
this.customAppBar,
this.isLocalLoader = false,
this.isshowBackButton = true,
this.backButtonTab,
this.changeCurrentTab,
this.currentTab,
@ -240,6 +242,7 @@ class _AppScaffoldState extends State<AppScaffold> {
showDropDown: widget.showDropDown,
dropdownIndexValue: widget.dropdownIndexValue,
dropDownList: widget.dropDownList ?? [],
isShowBackButton: widget.isshowBackButton,
dropDownIndexChange: widget.dropDownIndexChange,
appBarIcons: widget.appBarIcons,
onTap: () {
@ -256,6 +259,7 @@ class _AppScaffoldState extends State<AppScaffold> {
isPharmacy: widget.isPharmacy,
showPharmacyCart: widget.showPharmacyCart,
isOfferPackages: widget.isOfferPackages,
isshowBackButton: widget.isshowBackButton,
showOfferPackagesCart: widget.showOfferPackagesCart,
isShowDecPage: widget.isShowDecPage,
backButtonTab: () {
@ -285,7 +289,7 @@ class _AppScaffoldState extends State<AppScaffold> {
bottomNavigationBar: widget.isBottomBar
? BottomNavPharmacyBar(
changeIndex: changeCurrentTab,
index: widget.currentTab==null ? 0: widget.currentTab!,
index: widget.currentTab == null ? 0 : widget.currentTab!,
)
: null,
floatingActionButton: widget.floatingActionButton,
@ -336,6 +340,8 @@ class _AppScaffoldState extends State<AppScaffold> {
class NewAppBarWidget extends StatelessWidget implements PreferredSizeWidget {
final bool showTitle;
bool isShowBackButton;
final String title;
final bool? showDropDown;
final int? dropdownIndexValue;
@ -345,7 +351,17 @@ class NewAppBarWidget extends StatelessWidget implements PreferredSizeWidget {
VoidCallback? onTap;
NewAppBarWidget({Key? key, this.showTitle = false, this.showDropDown = false, this.title = "", this.dropDownList, this.appBarIcons, this.dropdownIndexValue, this.dropDownIndexChange, this.onTap})
NewAppBarWidget(
{Key? key,
this.showTitle = false,
this.showDropDown = false,
this.title = "",
this.dropDownList,
this.appBarIcons,
this.dropdownIndexValue,
this.dropDownIndexChange,
this.onTap,
this.isShowBackButton = true})
: super(key: key);
@override
@ -357,9 +373,11 @@ class NewAppBarWidget extends StatelessWidget implements PreferredSizeWidget {
backgroundColor: showTitle ? Colors.white : Colors.transparent,
// backgroundColor: Colors.red,
// automaticallyImplyLeading: false,
leading: ArrowBack(
onTap: onTap,
),
leading: isShowBackButton
? ArrowBack(
onTap: onTap,
)
: null,
titleSpacing: -8,
// centerTitle: false,
title: Row(
@ -446,6 +464,7 @@ class AppBarWidget extends StatefulWidget implements PreferredSizeWidget {
final bool showPharmacyCart;
final bool showOfferPackagesCart;
final bool isShowDecPage;
final bool isshowBackButton;
final VoidCallback? backButtonTab;
Function(String)? badgeUpdater;
@ -455,6 +474,7 @@ class AppBarWidget extends StatefulWidget implements PreferredSizeWidget {
this.showHomeAppBarIcon,
this.appBarIcons,
this.isPharmacy = true,
this.isshowBackButton = true,
this.showPharmacyCart = true,
this.isOfferPackages = false,
this.showOfferPackagesCart = false,
@ -496,20 +516,22 @@ class AppBarWidgetState extends State<AppBarWidget> {
title: Text(widget.authenticatedUserObject.isLogin || !widget.isShowDecPage ? widget.appBarTitle!.toUpperCase() : TranslationBase.of(context).serviceInformationTitle,
// style: TextStyle(fontWeight: FontWeight.bold, color: Theme.of(context).textTheme.headline1!.color, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans')),
style: TextStyle(fontWeight: FontWeight.bold, color: CustomColors.white, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans')),
leading: Builder(
builder: (BuildContext context) {
return ArrowBack(
onTap: widget.backButtonTab,
);
},
),
leading: widget.isshowBackButton
? Builder(
builder: (BuildContext context) {
return ArrowBack(
onTap: widget.backButtonTab,
);
},
)
: null,
centerTitle: true,
actions: <Widget>[
(widget.isPharmacy && widget.showPharmacyCart)
? IconButton(
icon: badge_import.Badge(
badgeContent: Text(
orderPreviewViewModel.cartResponse.quantityCount !=null? orderPreviewViewModel.cartResponse.quantityCount.toString() :"",
orderPreviewViewModel.cartResponse.quantityCount != null ? orderPreviewViewModel.cartResponse.quantityCount.toString() : "",
style: TextStyle(color: Colors.white),
),
child: Icon(Icons.shopping_cart)),

Loading…
Cancel
Save