lottie & bottom sheet

updare-to-3.32.sultan
Aamir Muhammad 8 months ago
parent bf1eec0dc3
commit a95c272daf

@ -55,7 +55,7 @@ class _RegisterNew extends State<RegisterNew> {
appBarTitle: TranslationBase.of(context).register, appBarTitle: TranslationBase.of(context).register,
isShowDecPage: false, isShowDecPage: false,
isShowAppBar: true, isShowAppBar: true,
isshowBackButton: false, isshowBackButton: true,
showNewAppBar: true, showNewAppBar: true,
backgroundColor: Color(0xffF8F8F8), backgroundColor: Color(0xffF8F8F8),
showNewAppBarTitle: false, showNewAppBarTitle: false,
@ -64,7 +64,7 @@ class _RegisterNew extends State<RegisterNew> {
appBarIcons: [], appBarIcons: [],
dropDownList: [], dropDownList: [],
dropDownIndexChange: (value) { dropDownIndexChange: (value) {
Utils.changeAppLanguage(projectViewModel: context.read<ProjectViewModel>(), context: context); Utils.changeAppLanguage(context: context);
}, },
body: SingleChildScrollView( body: SingleChildScrollView(
child: Container( child: Container(

@ -2,6 +2,7 @@ import 'package:flutter/gestures.dart';
import 'package:hmg_patient_app/analytics/google-analytics.dart'; import 'package:hmg_patient_app/analytics/google-analytics.dart';
import 'package:hmg_patient_app/config/config.dart'; import 'package:hmg_patient_app/config/config.dart';
import 'package:hmg_patient_app/config/shared_pref_kay.dart'; import 'package:hmg_patient_app/config/shared_pref_kay.dart';
import 'package:hmg_patient_app/config/size_config.dart';
import 'package:hmg_patient_app/core/service/AuthenticatedUserObject.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/appointment_rate_view_model.dart';
import 'package:hmg_patient_app/core/viewModels/project_view_model.dart'; import 'package:hmg_patient_app/core/viewModels/project_view_model.dart';
@ -101,99 +102,68 @@ class _WelcomeLogin extends State<WelcomeLogin> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
projectViewModel = context.read<ProjectViewModel>(); projectViewModel = context.read<ProjectViewModel>();
return AppScaffold(
return SafeArea( appBarTitle: TranslationBase.of(context).welcome,
child: AppScaffold( isShowDecPage: false,
appBarTitle: TranslationBase.of(context).welcome, isShowAppBar: true,
isShowDecPage: false, isshowBackButton: false,
isShowAppBar: true, showNewAppBar: true,
isshowBackButton: false, backgroundColor: Color(0xffF8F8F8),
showNewAppBar: true, showNewAppBarTitle: false,
backgroundColor: Color(0xffF8F8F8), showDropDown: true,
showNewAppBarTitle: false, isShowLanguageChanger: true,
showDropDown: true, appBarIcons: [],
isShowLanguageChanger: true, dropDownList: [],
appBarIcons: [], dropDownIndexChange: (value) {
dropDownList: [], Utils.changeAppLanguage(context: context);
dropDownIndexChange: (value) { },
Utils.changeAppLanguage(projectViewModel: projectViewModel, context: context); body: Padding(
}, padding: EdgeInsets.symmetric(horizontal: 24),
dropdownIndexValue: Utils.selectedLanguage, child: Column(
body: Column( crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Expanded( Utils.showLottie(context: context, assetPath: 'assets/anims/lottie/login.json'),
child: ListView( // SvgPicture.asset("assets/images/new/hmg_icon.svg", height: 62, width: 62),
padding: EdgeInsets.only(left: 21, right: 21), Spacer(flex: 1),
physics: BouncingScrollPhysics(), Text(
children: [ TranslationBase.of(context).welcomeToDrSulaiman,
SizedBox(height: 30), style: TextStyle(
Row( fontSize: 36,
children: [ fontFamily: (projectViewModel.currentLanguage == 'ar' ? 'Cairo' : 'Poppins'),
SvgPicture.asset( fontWeight: FontWeight.w600,
"assets/images/new/hmg_icon.svg", color: Color(0xff2B353E),
height: 62, letterSpacing: -0.4,
width: 62, height: 47 / 36,
),
],
),
// Example of using toDoProvider:
// if (toDoProvider.count > 0) Text("To-Do items: ${toDoProvider.count}"),
],
), ),
), ),
Spacer(), SizedBox(height: 20),
Container( Directionality(
padding: EdgeInsets.only(top: 30, bottom: 0, right: 21, left: 21), textDirection: TextDirection.ltr,
child: Text( child: inputWidget("National ID. or File No", "1xxxxxxxx", nationIdController,
TranslationBase.of(context).welcomeToDrSulaiman, isEnable: true, prefix: null, hasSelection: false, isBorderAllowed: false, isAllowLeadingIcon: true, leadingIcon: "assets/images/svg/student-card.svg"),
style: TextStyle(
fontSize: 36,
fontFamily: (projectViewModel.currentLanguage == 'ar' ? 'Cairo' : 'Poppins'),
fontWeight: FontWeight.w600,
color: Color(0xff2B353E),
letterSpacing: -0.4,
height: 47 / 36,
),
),
),
Container(
padding: EdgeInsets.only(top: 16, bottom: 10, right: 21, left: 21),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Directionality(
textDirection: TextDirection.ltr, // Consider making this dynamic based on language
child: inputWidget(
"National ID. or File No",
"1xxxxxxxx",
nationIdController, // Assumed to be a TextEditingController in your State class
isEnable: true,
prefix: null,
hasSelection: false,
isBorderAllowed: false,
isAllowLeadingIcon: true,
leadingIcon: "assets/images/svg/student-card.svg",
),
),
],
),
),
SizedBox(
height: 15,
), ),
SizedBox(height: 15),
Spacer(flex: 1),
],
),
),
bottomSheet: Container(
decoration: BoxDecoration(color: Color(0xffF8F8F8)),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row( Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.symmetric(horizontal: 24),
child: CustomButton( child: CustomButton(
text: TranslationBase.of(context).login, text: TranslationBase.of(context).login,
icon: "assets/images/svg/login1.svg", icon: "assets/images/svg/login1.svg",
onPressed: () { onPressed: () {
bool isValid = validateIqama(nationIdController.text); bool isValid = validateIqama(nationIdController.text);
print("Iqama is valid: $isValid"); print("Iqama is valid: $isValid");
if (isValid) { if (isValid) {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
@ -201,10 +171,7 @@ class _WelcomeLogin extends State<WelcomeLogin> {
isDismissible: false, isDismissible: false,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
builder: (bottomSheetContext) => Padding( builder: (bottomSheetContext) => Padding(
// Use a different context name padding: EdgeInsets.only(bottom: MediaQuery.of(bottomSheetContext).viewInsets.bottom),
padding: EdgeInsets.only(
bottom: MediaQuery.of(bottomSheetContext).viewInsets.bottom,
),
child: SingleChildScrollView( child: SingleChildScrollView(
child: GenericBottomSheet( child: GenericBottomSheet(
countryCode: "966", countryCode: "966",
@ -265,277 +232,60 @@ class _WelcomeLogin extends State<WelcomeLogin> {
), ),
], ],
), ),
Row( SizedBox(
crossAxisAlignment: CrossAxisAlignment.center, height: 10,
mainAxisAlignment: MainAxisAlignment.center, ),
children: [ Padding(
RichText( padding: const EdgeInsets.symmetric(vertical: 16.0),
textAlign: TextAlign.center, child: Row(
text: TextSpan( crossAxisAlignment: CrossAxisAlignment.center,
style: TextStyle( mainAxisAlignment: MainAxisAlignment.center,
color: Colors.black, children: [
fontSize: 16, RichText(
height: 26 / 16, textAlign: TextAlign.center,
fontFamily: 'poppins', text: TextSpan(
fontWeight: FontWeight.w500, style: TextStyle(
), color: Colors.black,
children: <TextSpan>[ fontSize: 16,
TextSpan( height: 26 / 16,
text: TranslationBase.of(context).dontHaveAccount, fontFamily: 'poppins',
fontWeight: FontWeight.w500,
), ),
TextSpan(text: " "), children: <TextSpan>[
TextSpan( TextSpan(
text: TranslationBase.of(context).registerNow, text: TranslationBase.of(context).dontHaveAccount,
style: const TextStyle(
color: Colors.red,
fontSize: 16,
height: 26 / 16,
fontFamily: 'poppins',
fontWeight: FontWeight.w500,
), ),
recognizer: TapGestureRecognizer() TextSpan(text: " "),
..onTap = () { TextSpan(
Navigator.of(context).push(FadePage(page: RegisterNew())); text: TranslationBase.of(context).registerNow,
locator<GAnalytics>().loginRegistration.visited_alhabib_group(true); 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()));
locator<GAnalytics>().loginRegistration.visited_alhabib_group(true);
},
),
],
),
), ),
), ],
], ),
), ),
SizedBox( SizedBox(
height: 10, height: 30,
), )
], ],
), ),
), ),
); );
} }
// Widget build(BuildContext context) {
// projectViewModel = Provider.of(context);
// projectViewModel.isArabic ? _selectedLanguage = 0 : 1;
// 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,
// showDropDown: true,
// isShowLanguageChanger: true,
// appBarIcons: [],
// dropDownList: [
// TranslationBase.of(context).arabicChange,
// TranslationBase.of(context).english,
// ],
// dropDownIndexChange: (value) {
// _selectedLanguage = value!;
// if (projectViewModel.isArabic) {
// projectViewModel.changeLanguage('en');
// locator<GAnalytics>().hamburgerMenu.logMenuItemClick('change language to english');
// } else {
// projectViewModel.changeLanguage('ar');
// locator<GAnalytics>().hamburgerMenu.logMenuItemClick('change language to arabic');
// }
// },
// dropdownIndexValue: _selectedLanguage,
// body: Column(
// children: <Widget>[
// Expanded(
// child: ListView(
// padding: EdgeInsets.only(left: 21, right: 21),
// physics: BouncingScrollPhysics(),
// children: [
// SizedBox(height: 30),
// Row(
// children: [
// SvgPicture.asset(
// "assets/images/new/hmg_icon.svg",
// height: 62,
// width: 62,
// ),
// ],
// ),
// ],
// ),
// ),
// Spacer(),
// Expanded(
// child: Container(
// 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(
// 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,
// () {
// 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.,
// 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,
// // ),
// // ),
// ],
// ),
// 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) { void onOtpBtnPressed(OTPType type) {
if (phoneController.text.isEmpty) { if (phoneController.text.isEmpty) {
Utils.showErrorToast("Please enter your phone number."); Utils.showErrorToast("Please enter your phone number.");

@ -50,6 +50,7 @@ import 'package:hmg_patient_app/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_api_availability/google_api_availability.dart'; import 'package:google_api_availability/google_api_availability.dart';
import 'package:lottie/lottie.dart';
import 'dart:math' show asin, cos, pi, pow, sin, sqrt; import 'dart:math' show asin, cos, pi, pow, sin, sqrt;
// import 'package:flutter_hms_gms_availability/flutter_hms_gms_availability.dart'; // import 'package:flutter_hms_gms_availability/flutter_hms_gms_availability.dart';
@ -66,40 +67,39 @@ import 'navigation_service.dart';
AppSharedPreferences sharedPref = new AppSharedPreferences(); AppSharedPreferences sharedPref = new AppSharedPreferences();
class Utils { class Utils {
// static ProgressDialog pr; static void changeAppLanguage({required BuildContext context}) {
// void changeLanguage(ProjectViewModel projectViewModel, int value, Function onChange(int)) {
// sharedPref.setBool(IS_ROBOT_INIT, false);
// sharedPref.remove(CLINICS_LIST);
// if (projectViewModel.isArabic) {
// _selectedLanguage = 1;
// projectViewModel.changeLanguage('en');
// locator<GAnalytics>().hamburgerMenu.logMenuItemClick('change language to english');
// } else {
// _selectedLanguage = 0;
// projectViewModel.changeLanguage('ar');
// locator<GAnalytics>().hamburgerMenu.logMenuItemClick('change language to arabic');
// }
// var themeNotifier = Provider.of<ThemeNotifier>(context, listen: false);
// themeNotifier.setTheme(defaultTheme(fontName: projectViewModel.isArabic ? 'Cairo' : 'Poppins'));
// }
static int selectedLanguage = 0;
static void changeAppLanguage({required ProjectViewModel projectViewModel, required BuildContext context}) {
sharedPref.setBool(IS_ROBOT_INIT, false); sharedPref.setBool(IS_ROBOT_INIT, false);
sharedPref.remove(CLINICS_LIST); sharedPref.remove(CLINICS_LIST);
if (projectViewModel.isArabic) { if (context.read<ProjectViewModel>().isArabic) {
selectedLanguage = 1; // 1 for English context.read<ProjectViewModel>().changeLanguage('en');
projectViewModel.changeLanguage('en'); // This will call notifyListeners in ViewModel
locator<GAnalytics>().hamburgerMenu.logMenuItemClick('change language to english'); locator<GAnalytics>().hamburgerMenu.logMenuItemClick('change language to english');
} else { } else {
selectedLanguage = 0; // 0 for Arabic context.read<ProjectViewModel>().changeLanguage('ar');
projectViewModel.changeLanguage('ar'); // This will call notifyListeners in ViewModel
locator<GAnalytics>().hamburgerMenu.logMenuItemClick('change language to arabic'); locator<GAnalytics>().hamburgerMenu.logMenuItemClick('change language to arabic');
} }
} }
static Widget showLottie({
required BuildContext context,
String assetPath = 'assets/icons/no_property.json',
double? height,
double? width,
BoxFit fit = BoxFit.cover,
Alignment alignment = Alignment.center,
bool repeat = false,
bool animate = true,
void Function(LottieComposition)? onLoaded,
}) {
return Lottie.asset(assetPath,
height: height ?? MediaQuery.of(context).size.height * 0.26,
width: width ?? MediaQuery.of(context).size.width,
fit: fit,
alignment: alignment,
repeat: repeat,
animate: animate,
onLoaded: onLoaded);
}
static var navigationProjectsList = [ static var navigationProjectsList = [
{ {
"Desciption": "Sahafa Hospital", "Desciption": "Sahafa Hospital",

@ -354,6 +354,8 @@ class NewAppBarWidget extends StatelessWidget implements PreferredSizeWidget {
final List<Widget>? appBarIcons; final List<Widget>? appBarIcons;
final bool isShowLanguageChanger; final bool isShowLanguageChanger;
String currentLang = 'ar';
VoidCallback? onTap; VoidCallback? onTap;
NewAppBarWidget( NewAppBarWidget(
@ -442,9 +444,9 @@ class NewAppBarWidget extends StatelessWidget implements PreferredSizeWidget {
child: Directionality( child: Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: LanguageSelector( child: LanguageSelector(
currentLanguage: dropdownIndexValue == 0 ? 'ar' : 'en', currentLanguage: projectViewModel.isArabic ? 'ar' : 'en',
onLanguageChanged: (String value) { onLanguageChanged: (String value) {
dropDownIndexChange!(value == 'ar' ? 0 : 1); dropDownIndexChange!(value == 'ar' ? 1 : 0);
}, },
languages: [ languages: [
{'code': 'ar', 'name': '${TranslationBase.of(context).lanEnglish}'}, {'code': 'ar', 'name': '${TranslationBase.of(context).lanEnglish}'},

@ -130,6 +130,7 @@ dependencies:
firebase_analytics: ^11.5.1 firebase_analytics: ^11.5.1
cloudflare_turnstile: ^3.2.0 cloudflare_turnstile: ^3.2.0
device_info_plus: ^11.5.0 device_info_plus: ^11.5.0
lottie: ^3.3.1
google_maps_place_picker_mb_v2: ^1.0.1 google_maps_place_picker_mb_v2: ^1.0.1
# vital_sign_camera: # vital_sign_camera:
@ -182,6 +183,7 @@ flutter:
- assets/images/new/body_parts/ - assets/images/new/body_parts/
- assets/images/new/body_parts/male/ - assets/images/new/body_parts/male/
- assets/images/new/body_parts/female/ - assets/images/new/body_parts/female/
- assets/anims/lottie/
fonts: fonts:
- family: WorkSans - family: WorkSans

Loading…
Cancel
Save