dev_sultan #36

Merged
Haroon6138 merged 4 commits from dev_sultan into master 2 months ago

@ -814,6 +814,7 @@
"notNow": "ليس الآن",
"pendingActivation": "في انتظار التنشيط",
"awaitingApproval": "انتظر القبول",
"news": "أخبار",
"ready": "جاهز",
"enterValidNationalId": "الرجاء إدخال رقم الهوية الوطنية أو رقم الملف الصحيح",
"enterValidPhoneNumber": "الرجاء إدخال رقم هاتف صالح"

@ -810,7 +810,8 @@
"notNow": "Not Now",
"pendingActivation": "Pending Activation",
"awaitingApproval": "Awaiting Approval",
"ready": "Ready",
"enterValidNationalId": "Please enter a valid national ID or file number",
"enterValidPhoneNumber": "Please enter a valid phone number"
"enterValidPhoneNumber": "Please enter a valid phone number",
"ready": "Ready",
"news": "News"
}

@ -123,7 +123,8 @@ class AppAssets {
static const String toDoBottom = '$svgBasePath/todo_bottom.svg';
static const String servicesBottom = '$svgBasePath/services_bottom.svg';
static const String closeBottomNav = '$svgBasePath/close_bottom_nav.svg';
static const String feedback = '$svgBasePath/feedback.svg';
static const String news = '$svgBasePath/news.svg';
// PNGS //
static const String hmg_logo = '$pngBasePath/hmg_logo.png';
static const String livecare_service = '$pngBasePath/livecare_service.png';
@ -145,4 +146,5 @@ class AppAnimations {
static const String loadingAnimation = '$lottieBasePath/Loader.json';
static const String errorAnimation = '$lottieBasePath/ErrorAnimation.json';
static const String warningAnimation = '$lottieBasePath/warningAnimation.json';
}

@ -72,4 +72,5 @@ class CacheConst {
static const String isLastAppointmentRateShown = 'is-last-appointment-rate-shown';
static const String patientOccupationList = 'patient-occupation-list';
static const String hasEnabledQuickLogin = 'has-enabled-quick-login';
static const String quickLoginEnabled = 'quick-login-enabled';
}

@ -3,6 +3,7 @@ import 'dart:developer';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/services.dart' show rootBundle;
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:hijri_gregorian_calendar/hijri_gregorian_calendar.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/cache_consts.dart';
@ -47,7 +48,6 @@ class AuthenticationViewModel extends ChangeNotifier {
final DialogService _dialogService;
final NavigationService _navigationService;
final LocalAuthService _localAuthService;
AuthenticationViewModel({
required AppState appState,
required AuthenticationRepo authenticationRepo,
@ -62,7 +62,6 @@ class AuthenticationViewModel extends ChangeNotifier {
_appState = appState,
_authenticationRepo = authenticationRepo,
_localAuthService = localAuthService;
final TextEditingController nationalIdController = TextEditingController(),
phoneNumberController = TextEditingController(),
dobController = TextEditingController(),
@ -74,6 +73,7 @@ class AuthenticationViewModel extends ChangeNotifier {
bool isTermsAccepted = false;
List<NationalityCountries>? countriesList;
String? dob = "";
final CacheService cacheService = GetIt.instance<CacheService>();
NationalityCountries? pickedCountryByUAEUser;
CalenderEnum calenderType = CalenderEnum.gregorian;
@ -106,6 +106,7 @@ class AuthenticationViewModel extends ChangeNotifier {
}
Future<void> clearDefaultInputValues() async {
nationalIdController.clear();
phoneNumberController.clear();
emailController.clear();
@ -621,19 +622,22 @@ class AuthenticationViewModel extends ChangeNotifier {
}
checkLastLoginStatus(Function() onSuccess) async {
Future.delayed(Duration(seconds: 1), () {
if (_appState.getSelectDeviceByImeiRespModelElement != null &&
(_appState.getSelectDeviceByImeiRespModelElement!.logInType == 1 || _appState.getSelectDeviceByImeiRespModelElement!.logInType == 4)) {
phoneNumberController.text =
(_appState.getAuthenticatedUser()!.mobileNumber!.startsWith("0") ? _appState.getAuthenticatedUser()!.mobileNumber!.replaceFirst("0", "") : _appState.getAuthenticatedUser()!.mobileNumber)!;
nationalIdController.text = _appState.getAuthenticatedUser()!.nationalityId!;
onSuccess();
} else if ((loginTypeEnum == LoginTypeEnum.sms || loginTypeEnum == LoginTypeEnum.whatsapp && _appState.getSelectDeviceByImeiRespModelElement == null) &&
_appState.getAuthenticatedUser() != null) {
phoneNumberController.text =
(_appState.getAuthenticatedUser()!.mobileNumber!.startsWith("0") ? _appState.getAuthenticatedUser()!.mobileNumber!.replaceFirst("0", "") : _appState.getAuthenticatedUser()!.mobileNumber)!;
nationalIdController.text = _appState.getAuthenticatedUser()!.nationalityId!;
onSuccess();
Future.delayed(Duration(seconds: 1), () async {
if(cacheService.getBool(key: CacheConst.quickLoginEnabled) == null){
if (_appState.getSelectDeviceByImeiRespModelElement != null &&
(_appState.getSelectDeviceByImeiRespModelElement!.logInType == 1 || _appState.getSelectDeviceByImeiRespModelElement!.logInType == 4)) {
phoneNumberController.text =
(_appState.getAuthenticatedUser()!.mobileNumber!.startsWith("0") ? _appState.getAuthenticatedUser()!.mobileNumber!.replaceFirst("0", "") : _appState.getAuthenticatedUser()!.mobileNumber)!;
nationalIdController.text = _appState.getAuthenticatedUser()!.nationalityId!;
onSuccess();
} else if ((loginTypeEnum == LoginTypeEnum.sms || loginTypeEnum == LoginTypeEnum.whatsapp && _appState.getSelectDeviceByImeiRespModelElement == null) &&
_appState.getAuthenticatedUser() != null) {
phoneNumberController.text =
(_appState.getAuthenticatedUser()!.mobileNumber!.startsWith("0") ? _appState.getAuthenticatedUser()!.mobileNumber!.replaceFirst("0", "") : _appState.getAuthenticatedUser()!.mobileNumber)!;
nationalIdController.text = _appState.getAuthenticatedUser()!.nationalityId!;
onSuccess();
}
}
});
}

@ -816,4 +816,5 @@ abstract class LocaleKeys {
static const enterValidNationalId = 'enterValidNationalId';
static const enterValidPhoneNumber = 'enterValidPhoneNumber';
static const news = 'news';
}

@ -3,8 +3,10 @@ import 'dart:async';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import 'package:get_it/get_it.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/cache_consts.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
@ -25,6 +27,7 @@ import 'package:hmg_patient_app_new/presentation/home/widgets/small_service_card
import 'package:hmg_patient_app_new/presentation/home/widgets/welcome_widget.dart';
import 'package:hmg_patient_app_new/presentation/medical_file/medical_file_page.dart';
import 'package:hmg_patient_app_new/presentation/profile_settings/profile_settings.dart';
import 'package:hmg_patient_app_new/services/cache_service.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
@ -49,6 +52,7 @@ class _LandingPageState extends State<LandingPage> {
late AppState appState;
late MyAppointmentsViewModel myAppointmentsViewModel;
late PrescriptionsViewModel prescriptionsViewModel;
final CacheService cacheService = GetIt.instance<CacheService>();
@override
void initState() {
@ -370,6 +374,7 @@ class _LandingPageState extends State<LandingPage> {
// sharedPref.setBool(HAS_ENABLED_QUICK_LOGIN, true);
authVM.loginWithFingerPrintFace(() {
isDone = true;
cacheService.saveBool(key: CacheConst.quickLoginEnabled,value: true);
setState(() {});
});
},

@ -1,4 +1,6 @@
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/presentation/book_appointment/book_appointment_page.dart';
import 'package:hmg_patient_app_new/presentation/home/landing_page.dart';
import 'package:hmg_patient_app_new/presentation/medical_file/medical_file_page.dart';
@ -13,20 +15,22 @@ class LandingNavigation extends StatefulWidget {
class _LandingNavigationState extends State<LandingNavigation> {
int _currentIndex = 0;
late AppState appState;
final PageController _pageController = PageController();
@override
Widget build(BuildContext context) {
appState = getIt.get<AppState>();
return Scaffold(
body: PageView(
controller: _pageController,
physics: const NeverScrollableScrollPhysics(),
children: [
const LandingPage(),
MedicalFilePage(),
appState.isAuthenticated ? MedicalFilePage() :/* need add feedback page */ const LandingPage(),
BookAppointmentPage(),
const LandingPage(),
const LandingPage(),
appState.isAuthenticated ? /* need add news page */ LandingPage() : const LandingPage(),
],
),
bottomNavigationBar: BottomNavigation(

@ -1,6 +1,8 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
@ -19,16 +21,17 @@ class BottomNavigation extends StatelessWidget {
@override
Widget build(BuildContext context) {
AppState appState = getIt.get<AppState>();
final items = [
BottomNavItem(icon: AppAssets.homeBottom, label: LocaleKeys.home.tr()),
BottomNavItem(icon: AppAssets.myFilesBottom, label: LocaleKeys.myFiles.tr()),
appState.isAuthenticated ? BottomNavItem(icon: AppAssets.myFilesBottom, label: LocaleKeys.myFiles.tr()) : BottomNavItem(icon: AppAssets.feedback, label: LocaleKeys.feedback.tr()),
BottomNavItem(
icon: AppAssets.bookAppoBottom,
label: LocaleKeys.appointment.tr(),
iconSize: 27,
isSpecial: true,
),
BottomNavItem(icon: AppAssets.toDoBottom, label: LocaleKeys.todoList.tr()),
appState.isAuthenticated ? BottomNavItem(icon: AppAssets.toDoBottom, label: LocaleKeys.todoList.tr()) : BottomNavItem(icon: AppAssets.news, label: LocaleKeys.news.tr()) ,
BottomNavItem(icon: AppAssets.servicesBottom, label: LocaleKeys.services2.tr()),
];

@ -0,0 +1,44 @@
import 'package:flutter/material.dart';
class ProfileSelector extends StatelessWidget {
final List<Map<String, dynamic>> profiles;
final Function(Map<String, dynamic>) onSelect;
const ProfileSelector({
Key? key,
required this.profiles,
required this.onSelect,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Column(
mainAxisSize: MainAxisSize.min,
children: profiles.map((profile) {
return ListTile(
leading: CircleAvatar(
radius: 22,
backgroundImage: profile["GenderImage"] != null &&
profile["GenderImage"].toString().isNotEmpty
? NetworkImage(profile["GenderImage"])
: AssetImage(
profile["Gender"] == 1
? "assets/images/male.png"
: "assets/images/female.png")
as ImageProvider,
),
title: Text(
profile["PatientName"] ?? "Unknown",
style: const TextStyle(fontWeight: FontWeight.w600),
),
subtitle: Text(
profile["Relationship"] ?? "Self",
style: const TextStyle(color: Colors.grey),
),
trailing: const Icon(Icons.arrow_forward_ios, size: 16),
onTap: () => onSelect(profile),
);
}).toList(),
);
}
}

@ -0,0 +1,15 @@
import 'package:flutter/material.dart';
import '../common_bottom_sheet.dart';
import 'my_Family.dart';
class MyFamilySheet {
static void show(BuildContext context, List<Map<String, dynamic>> profiles, Function(Map<String, dynamic>) onSelect) {
showCommonBottomSheetWithoutHeight(
context,
title: 'Select Profile',
child: ProfileSelector(profiles: profiles, onSelect: (profile) {
Navigator.of(context).pop(); // Close the bottom sheet
onSelect(profile); // Call the onSelect callback
}), callBackFunc: () {},
);
}
}
Loading…
Cancel
Save