lottie & bottom sheet

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

@ -55,7 +55,7 @@ class _RegisterNew extends State<RegisterNew> {
appBarTitle: TranslationBase.of(context).register,
isShowDecPage: false,
isShowAppBar: true,
isshowBackButton: false,
isshowBackButton: true,
showNewAppBar: true,
backgroundColor: Color(0xffF8F8F8),
showNewAppBarTitle: false,
@ -64,7 +64,7 @@ class _RegisterNew extends State<RegisterNew> {
appBarIcons: [],
dropDownList: [],
dropDownIndexChange: (value) {
Utils.changeAppLanguage(projectViewModel: context.read<ProjectViewModel>(), context: context);
Utils.changeAppLanguage(context: context);
},
body: SingleChildScrollView(
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/config/config.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/viewModels/appointment_rate_view_model.dart';
import 'package:hmg_patient_app/core/viewModels/project_view_model.dart';
@ -101,99 +102,68 @@ class _WelcomeLogin extends State<WelcomeLogin> {
@override
Widget build(BuildContext context) {
projectViewModel = context.read<ProjectViewModel>();
return SafeArea(
child: 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: [],
dropDownIndexChange: (value) {
Utils.changeAppLanguage(projectViewModel: projectViewModel, context: context);
},
dropdownIndexValue: Utils.selectedLanguage,
body: Column(
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: [],
dropDownIndexChange: (value) {
Utils.changeAppLanguage(context: context);
},
body: Padding(
padding: EdgeInsets.symmetric(horizontal: 24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
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,
),
],
),
// Example of using toDoProvider:
// if (toDoProvider.count > 0) Text("To-Do items: ${toDoProvider.count}"),
],
Utils.showLottie(context: context, assetPath: 'assets/anims/lottie/login.json'),
// SvgPicture.asset("assets/images/new/hmg_icon.svg", height: 62, width: 62),
Spacer(flex: 1),
Text(
TranslationBase.of(context).welcomeToDrSulaiman,
style: TextStyle(
fontSize: 36,
fontFamily: (projectViewModel.currentLanguage == 'ar' ? 'Cairo' : 'Poppins'),
fontWeight: FontWeight.w600,
color: Color(0xff2B353E),
letterSpacing: -0.4,
height: 47 / 36,
),
),
Spacer(),
Container(
padding: EdgeInsets.only(top: 30, bottom: 0, right: 21, left: 21),
child: Text(
TranslationBase.of(context).welcomeToDrSulaiman,
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: 20),
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),
Spacer(flex: 1),
],
),
),
bottomSheet: Container(
decoration: BoxDecoration(color: Color(0xffF8F8F8)),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Expanded(
child: Padding(
padding: const EdgeInsets.all(10.0),
padding: const EdgeInsets.symmetric(horizontal: 24),
child: CustomButton(
text: TranslationBase.of(context).login,
icon: "assets/images/svg/login1.svg",
onPressed: () {
bool isValid = validateIqama(nationIdController.text);
print("Iqama is valid: $isValid");
if (isValid) {
showModalBottomSheet(
context: context,
@ -201,10 +171,7 @@ class _WelcomeLogin extends State<WelcomeLogin> {
isDismissible: false,
backgroundColor: Colors.transparent,
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: GenericBottomSheet(
countryCode: "966",
@ -265,277 +232,60 @@ class _WelcomeLogin extends State<WelcomeLogin> {
),
],
),
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: TranslationBase.of(context).dontHaveAccount,
SizedBox(
height: 10,
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0),
child: 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,
),
TextSpan(text: " "),
TextSpan(
text: TranslationBase.of(context).registerNow,
style: const TextStyle(
color: Colors.red,
fontSize: 16,
height: 26 / 16,
fontFamily: 'poppins',
fontWeight: FontWeight.w500,
children: <TextSpan>[
TextSpan(
text: TranslationBase.of(context).dontHaveAccount,
),
recognizer: TapGestureRecognizer()
..onTap = () {
Navigator.of(context).push(FadePage(page: RegisterNew()));
locator<GAnalytics>().loginRegistration.visited_alhabib_group(true);
},
),
],
TextSpan(text: " "),
TextSpan(
text: TranslationBase.of(context).registerNow,
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(
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) {
if (phoneController.text.isEmpty) {
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/material.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 'package:flutter_hms_gms_availability/flutter_hms_gms_availability.dart';
@ -66,40 +67,39 @@ import 'navigation_service.dart';
AppSharedPreferences sharedPref = new AppSharedPreferences();
class Utils {
// static ProgressDialog pr;
// 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}) {
static void changeAppLanguage({required BuildContext context}) {
sharedPref.setBool(IS_ROBOT_INIT, false);
sharedPref.remove(CLINICS_LIST);
if (projectViewModel.isArabic) {
selectedLanguage = 1; // 1 for English
projectViewModel.changeLanguage('en'); // This will call notifyListeners in ViewModel
if (context.read<ProjectViewModel>().isArabic) {
context.read<ProjectViewModel>().changeLanguage('en');
locator<GAnalytics>().hamburgerMenu.logMenuItemClick('change language to english');
} else {
selectedLanguage = 0; // 0 for Arabic
projectViewModel.changeLanguage('ar'); // This will call notifyListeners in ViewModel
context.read<ProjectViewModel>().changeLanguage('ar');
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 = [
{
"Desciption": "Sahafa Hospital",

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

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

Loading…
Cancel
Save