diff --git a/lib/config/config.dart b/lib/config/config.dart index 5781a91d..dade19d6 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -61,3 +61,6 @@ const CHANNEL = 9; const SESSION_ID = 'BlUSkYymTt'; const IS_LOGIN_FOR_DOCTOR_APP = true; const PATIENT_OUT_SA = false; + +/// Timer Info +const TIMER_MIN =10; diff --git a/lib/landing_page.dart b/lib/landing_page.dart new file mode 100644 index 00000000..a9f844f8 --- /dev/null +++ b/lib/landing_page.dart @@ -0,0 +1,98 @@ +import 'package:doctor_app_flutter/screens/dashboard_screen.dart'; +import 'package:doctor_app_flutter/screens/doctor/message_screen.dart'; +import 'package:doctor_app_flutter/screens/doctor/my_schedule_screen.dart'; +import 'package:doctor_app_flutter/screens/doctor/services_screen.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_drawer_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/bottom_nav_bar.dart'; +import 'package:doctor_app_flutter/widgets/shared/profile_image_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + + +class LandingPage extends StatefulWidget { + @override + _LandingPageState createState() => _LandingPageState(); +} + +class _LandingPageState extends State { + int currentTab = 0; + PageController pageController; + + _changeCurrentTab(int tab) { + setState(() { + currentTab = tab; + pageController.jumpToPage(tab); + }); + } + + @override + void initState() { + super.initState(); + pageController = new PageController(keepPage: true); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + elevation: 0, + backgroundColor: Hexcolor('#515B5D'), + textTheme: TextTheme( + headline6: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)), + title: Text(getText(currentTab).toUpperCase()), + leading: Builder( + builder: (BuildContext context) { + return IconButton( + icon: Icon(Icons.menu), + color: Colors.white, + onPressed: () => Scaffold.of(context).openDrawer(), + ); + }, + ), + centerTitle: true, + actions: [ + ProfileImageWidget( + height: 50, + width: 50, + url: + "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png", + ) + ], + ), + drawer: Theme( + data: Theme.of(context).copyWith( + canvasColor: Colors.transparent, + ), + child: SafeArea(child: AppDrawer()), + ), + extendBody: true, + body: PageView( + physics: NeverScrollableScrollPhysics(), + controller: pageController, + children: [ + DashboardScreen(), + MessagesScreen(), + MyScheduleScreen(), + ServicesScreen() + ], + ), + bottomNavigationBar: BottomNavBar(changeIndex: _changeCurrentTab), + + ); + } + + getText(currentTab) { + switch (currentTab) { + case 0: + return "HOME"; + case 1: + return "REPLAY"; + case 2: + return "SCHEDULE"; + case 3: + return 'SERVICES'; + + } + } +} \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index 2ab87a2a..470c5d52 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/providers/project_provider.dart'; +import 'package:doctor_app_flutter/providers/schedule_provider.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; @@ -26,7 +27,8 @@ class MyApp extends StatelessWidget { ChangeNotifierProvider(create: (context) => PatientsProvider()), ChangeNotifierProvider(create: (context) => AuthProvider()), ChangeNotifierProvider(create: (context) => HospitalProvider()), - ChangeNotifierProvider(create: (context) => ProjectProvider(),) + ChangeNotifierProvider(create: (context) => ProjectProvider(),), + ChangeNotifierProvider(create: (context) => ScheduleProvider(),) ], child: Consumer( builder: (context,projectProvider,child) => MaterialApp( @@ -47,7 +49,7 @@ class MyApp extends StatelessWidget { primaryColor: Colors.grey, buttonColor: Hexcolor('#B8382C'), fontFamily: 'WorkSans', - dividerColor: Colors.grey[200], + dividerColor: Colors.grey[350], backgroundColor: Color.fromRGBO(255,255,255, 1) ), initialRoute: INIT_ROUTE, diff --git a/lib/routes.dart b/lib/routes.dart index f90e1ba9..a24cfe52 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -26,6 +26,7 @@ import './screens/patients/profile/vital_sign/vital_sign_item_details_screen.dar import './screens/patients/profile/vital_sign/vital_sign_screen.dart'; import './screens/profile_screen.dart'; import './screens/settings/settings_screen.dart'; +import 'landing_page.dart'; import 'screens/doctor/doctor_reply_screen.dart'; const String INIT_ROUTE = LOGIN; @@ -59,7 +60,7 @@ const String VITAL_SIGN_DETAILS = 'patients/vital-sign-details'; const String BODY_MEASUREMENTS = 'patients/body-measurements'; var routes = { - HOME: (_) => DashboardScreen(), + HOME: (_) => LandingPage(), LOGIN: (_) => Loginsreen(), PROFILE: (_) => ProfileScreen(), MY_SCHEDULE: (_) => MyScheduleScreen(), diff --git a/lib/screens/auth/change_password_screen.dart b/lib/screens/auth/change_password_screen.dart index dc57b99d..6fa15bfd 100644 --- a/lib/screens/auth/change_password_screen.dart +++ b/lib/screens/auth/change_password_screen.dart @@ -7,10 +7,8 @@ import '../../widgets/auth/change_password.dart'; class ChangePasswordScreen extends StatelessWidget { @override Widget build(BuildContext context) { - // return Container()]; return AppScaffold( - pageOnly: true, body: SafeArea( child: ListView(children: [ Container( diff --git a/lib/screens/auth/login_screen.dart b/lib/screens/auth/login_screen.dart index d8c45a57..8b25d21d 100644 --- a/lib/screens/auth/login_screen.dart +++ b/lib/screens/auth/login_screen.dart @@ -57,8 +57,7 @@ class _LoginsreenState extends State { Widget build(BuildContext context) { getSharedPref(); return AppScaffold( - pageOnly: true, - isloading: _isLoading, + isLoading: _isLoading, body: SafeArea( child: ListView(children: [ FutureBuilder( diff --git a/lib/screens/auth/verification_methods_screen.dart b/lib/screens/auth/verification_methods_screen.dart index 89193c65..830530c9 100644 --- a/lib/screens/auth/verification_methods_screen.dart +++ b/lib/screens/auth/verification_methods_screen.dart @@ -37,8 +37,7 @@ class _VerificationMethodsScreenState extends State { @override Widget build(BuildContext context) { return AppScaffold( - pageOnly: true, - isloading: _isLoading, + isLoading: _isLoading, body: ListView(children: [ Container( margin: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), diff --git a/lib/screens/auth/verify_account_screen.dart b/lib/screens/auth/verify_account_screen.dart index 15eb846b..61d58306 100644 --- a/lib/screens/auth/verify_account_screen.dart +++ b/lib/screens/auth/verify_account_screen.dart @@ -1,3 +1,5 @@ +import 'dart:async'; + import 'package:flutter/material.dart'; import '../../lookups/auth_lookup.dart'; @@ -28,10 +30,8 @@ class _VerifyAccountScreenState extends State { @override Widget build(BuildContext context) { - // return Container()]; return AppScaffold( - isloading: _isLoading, - pageOnly: true, + isLoading: _isLoading, body: SafeArea( child: ListView(children: [ Container( @@ -40,7 +40,7 @@ class _VerifyAccountScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ AuthHeader(loginType.verifyPassword), - VerifyAccount(changeLoadingStata:changeLoadingStata), + VerifyAccount(changeLoadingStata: changeLoadingStata), ], ), ), diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index 33f272c0..2db9dcfd 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -33,14 +33,14 @@ class DashboardScreen extends StatefulWidget { class _DashboardScreenState extends State { HospitalProvider projectsProvider; + @override Widget build(BuildContext context) { projectsProvider = Provider.of(context); - return AppScaffold( - appBarTitle: TranslationBase.of(context).dashboardScreenToolbarTitle, - current: 0, - body: Container( - child: new SingleChildScrollView( + return SafeArea( + bottom: true, + child: Scaffold( + body: SingleChildScrollView( child: SizedBox( height: MediaQuery.of(context).size.height, child: Column( @@ -50,7 +50,6 @@ class _DashboardScreenState extends State { child: Container( margin: EdgeInsets.all(10), child: AppText( - TranslationBase.of(context).todayStatistics, fontWeight: FontWeight.bold, ), @@ -100,7 +99,7 @@ class _DashboardScreenState extends State { flex: 1, child: Column( crossAxisAlignment: - CrossAxisAlignment.stretch, + CrossAxisAlignment.stretch, children: [ Expanded( child: DashboardItemTexts( @@ -118,7 +117,7 @@ class _DashboardScreenState extends State { ), Expanded( child: Column( - crossAxisAlignment: + crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Expanded( @@ -162,7 +161,6 @@ class _DashboardScreenState extends State { child: new DashboardItemIconText( DoctorApp.home_icon, "10", - TranslationBase.of(context).radiology, backgroundColor: Colors.black45, // valueFontColor: Colors.white, @@ -379,7 +377,9 @@ class _DashboardScreenState extends State { // , //constraints: new BoxConstraints(), ), - ))); + ), + ), + ); // Container( diff --git a/lib/screens/doctor/doctor_reply_screen.dart b/lib/screens/doctor/doctor_reply_screen.dart index 73585593..dae9b5a5 100644 --- a/lib/screens/doctor/doctor_reply_screen.dart +++ b/lib/screens/doctor/doctor_reply_screen.dart @@ -31,7 +31,6 @@ class DoctorReplyScreen extends StatelessWidget { _doctorReplyProvider = Provider.of(context); return AppScaffold( appBarTitle: TranslationBase.of(context).doctorReply, - showAppDrawer: false, body:_doctorReplyProvider.isLoading? DrAppCircularProgressIndeicator(): _doctorReplyProvider.isError? Center( child: Text( diff --git a/lib/screens/doctor/message_screen.dart b/lib/screens/doctor/message_screen.dart index 1321c4fc..18c6bf93 100644 --- a/lib/screens/doctor/message_screen.dart +++ b/lib/screens/doctor/message_screen.dart @@ -5,9 +5,7 @@ import 'package:flutter/material.dart'; class MessagesScreen extends StatelessWidget { @override Widget build(BuildContext context) { - return AppScaffold( - current: 1, - appBarTitle: TranslationBase.of(context).messagesScreenToolbarTitle, + return Scaffold( body: Center( child: Text('Messages heeer'), ), diff --git a/lib/screens/doctor/my_referral_patient_screen.dart b/lib/screens/doctor/my_referral_patient_screen.dart index 4c95663a..d79313e4 100644 --- a/lib/screens/doctor/my_referral_patient_screen.dart +++ b/lib/screens/doctor/my_referral_patient_screen.dart @@ -17,8 +17,6 @@ class MyReferralPatient extends StatelessWidget { Widget build(BuildContext context) { referralPatientProvider = Provider.of(context); return AppScaffold( - showBottomBar: false, - showAppDrawer: false, appBarTitle: 'My Referral Patient', body: referralPatientProvider.isLoading ? DrAppCircularProgressIndeicator() diff --git a/lib/screens/doctor/my_referred_patient_screen.dart b/lib/screens/doctor/my_referred_patient_screen.dart index bfed1ef3..e2220855 100644 --- a/lib/screens/doctor/my_referred_patient_screen.dart +++ b/lib/screens/doctor/my_referred_patient_screen.dart @@ -18,8 +18,6 @@ class MyReferredPatient extends StatelessWidget { Widget build(BuildContext context) { referredPatientProvider = Provider.of(context); return AppScaffold( - showBottomBar: false, - showAppDrawer: false, appBarTitle: 'My Referred Patient', body: referredPatientProvider.isLoading ? DrAppCircularProgressIndeicator() diff --git a/lib/screens/doctor/my_schedule_screen.dart b/lib/screens/doctor/my_schedule_screen.dart index dd40dada..f7b9d444 100644 --- a/lib/screens/doctor/my_schedule_screen.dart +++ b/lib/screens/doctor/my_schedule_screen.dart @@ -15,11 +15,7 @@ class MyScheduleScreen extends StatelessWidget { @override Widget build(BuildContext context) { scheduleProvider = Provider.of(context); - return AppScaffold( - // pageOnly: false, - showBottomBar: false, - showAppDrawer: false, - appBarTitle: TranslationBase.of(context).mySchedule, + return Scaffold( body: scheduleProvider.isLoading ? DrAppCircularProgressIndeicator() : scheduleProvider.isError diff --git a/lib/screens/doctor/services_screen.dart b/lib/screens/doctor/services_screen.dart index fd599ecc..1000e694 100644 --- a/lib/screens/doctor/services_screen.dart +++ b/lib/screens/doctor/services_screen.dart @@ -4,9 +4,7 @@ import 'package:flutter/material.dart'; class ServicesScreen extends StatelessWidget { @override Widget build(BuildContext context) { - return AppScaffold( - current: 2, - appBarTitle: 'Services', + return Scaffold( body: Center( child: Text('Services heeer'), ), diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index ba136dbf..dffe342c 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -113,8 +113,6 @@ class _PatientSearchScreenState extends State { Widget build(BuildContext context) { return AppScaffold( appBarTitle: "SEARCH FOR PATIENT", - showBottomBar: false, - showAppDrawer: false, body: ListView( children: [ RoundedContainer( diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 21da6178..1128832f 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -296,8 +296,6 @@ class _PatientsScreenState extends State { PatientsProvider patientsProv = Provider.of(context); return AppScaffold( - showBottomBar: false, - showAppDrawer: false, appBarTitle: patientTypetitle, body: _isLoading ? DrAppCircularProgressIndeicator() diff --git a/lib/screens/patients/profile/insurance_approvals_screen.dart b/lib/screens/patients/profile/insurance_approvals_screen.dart index 2015e106..bb88321d 100644 --- a/lib/screens/patients/profile/insurance_approvals_screen.dart +++ b/lib/screens/patients/profile/insurance_approvals_screen.dart @@ -77,8 +77,6 @@ class _InsuranceApprovalsState extends State { Widget build(BuildContext context) { return AppScaffold( appBarTitle: "Insurance Approvals", - showAppDrawer: false, - showBottomBar: false, body: patientsProv.isLoading ? DrAppCircularProgressIndeicator() : patientsProv.isError diff --git a/lib/screens/patients/profile/lab_result/lab_orders_screen.dart b/lib/screens/patients/profile/lab_result/lab_orders_screen.dart index 66991967..b0a4a13d 100644 --- a/lib/screens/patients/profile/lab_result/lab_orders_screen.dart +++ b/lib/screens/patients/profile/lab_result/lab_orders_screen.dart @@ -73,8 +73,6 @@ class _LabOrdersScreenState extends State { Widget build(BuildContext context) { return AppScaffold( appBarTitle: "Lab Orders", - showAppDrawer: false, - showBottomBar: false, body: patientsProv.isLoading ? DrAppCircularProgressIndeicator() : patientsProv.isError diff --git a/lib/screens/patients/profile/lab_result/lab_result_secreen.dart b/lib/screens/patients/profile/lab_result/lab_result_secreen.dart index fed749c7..a8583d4a 100644 --- a/lib/screens/patients/profile/lab_result/lab_result_secreen.dart +++ b/lib/screens/patients/profile/lab_result/lab_result_secreen.dart @@ -41,8 +41,6 @@ class _LabResultState extends State { Widget build(BuildContext context) { return AppScaffold( appBarTitle: "Lab Orders", - showAppDrawer: false, - showBottomBar: false, body: patientsProv.isLoading ? DrAppCircularProgressIndeicator() : patientsProv.isError diff --git a/lib/screens/patients/profile/patient_orders_screen.dart b/lib/screens/patients/profile/patient_orders_screen.dart index b602fea7..30f61bf0 100644 --- a/lib/screens/patients/profile/patient_orders_screen.dart +++ b/lib/screens/patients/profile/patient_orders_screen.dart @@ -76,8 +76,6 @@ class _PatientsOrdersState extends State { Widget build(BuildContext context) { return AppScaffold( appBarTitle: "Orders", - showAppDrawer: false, - showBottomBar: false, body: patientsProv.isLoading ? DrAppCircularProgressIndeicator() : patientsProv.isError diff --git a/lib/screens/patients/profile/patient_profile_screen.dart b/lib/screens/patients/profile/patient_profile_screen.dart index 20954d38..2ee3d939 100644 --- a/lib/screens/patients/profile/patient_profile_screen.dart +++ b/lib/screens/patients/profile/patient_profile_screen.dart @@ -9,9 +9,6 @@ class PatientProfileScreen extends StatelessWidget { @override Widget build(BuildContext context) { return AppScaffold( - // child: child, - showBottomBar: false, - showAppDrawer: false, appBarTitle: 'Patient Profile', body: PatientProfileWidget(), ); diff --git a/lib/screens/patients/profile/prescriptions/prescriptions_screen.dart b/lib/screens/patients/profile/prescriptions/prescriptions_screen.dart index c246d9ff..360ec776 100644 --- a/lib/screens/patients/profile/prescriptions/prescriptions_screen.dart +++ b/lib/screens/patients/profile/prescriptions/prescriptions_screen.dart @@ -81,8 +81,6 @@ class _PrescriptionScreenState extends State { Widget build(BuildContext context) { return AppScaffold( appBarTitle: "Prescriptions", - showAppDrawer: false, - showBottomBar: false, body: patientsProv.isLoading ? DrAppCircularProgressIndeicator() : patientsProv.isError diff --git a/lib/screens/patients/profile/progress_note_screen.dart b/lib/screens/patients/profile/progress_note_screen.dart index 0014432c..07f0ff88 100644 --- a/lib/screens/patients/profile/progress_note_screen.dart +++ b/lib/screens/patients/profile/progress_note_screen.dart @@ -76,8 +76,6 @@ class _ProgressNoteState extends State { Widget build(BuildContext context) { return AppScaffold( appBarTitle: "Progress Note", - showAppDrawer: false, - showBottomBar: false, body: patientsProv.isLoading ? DrAppCircularProgressIndeicator() : patientsProv.isError diff --git a/lib/screens/patients/profile/radiology/radiology_report_screen.dart b/lib/screens/patients/profile/radiology/radiology_report_screen.dart index badb88f8..db0f7544 100644 --- a/lib/screens/patients/profile/radiology/radiology_report_screen.dart +++ b/lib/screens/patients/profile/radiology/radiology_report_screen.dart @@ -13,8 +13,6 @@ class RadiologyReportScreen extends StatelessWidget { Widget build(BuildContext context) { return AppScaffold( appBarTitle: "Radiology Report", - showAppDrawer: false, - showBottomBar: false, body: Container( padding: EdgeInsets.all(10), margin: EdgeInsets.all(10), diff --git a/lib/screens/patients/profile/radiology/radiology_screen.dart b/lib/screens/patients/profile/radiology/radiology_screen.dart index 10adf2d5..1ddf944e 100644 --- a/lib/screens/patients/profile/radiology/radiology_screen.dart +++ b/lib/screens/patients/profile/radiology/radiology_screen.dart @@ -76,8 +76,6 @@ class _RadiologyScreenState extends State { Widget build(BuildContext context) { return AppScaffold( appBarTitle: "Radiology", - showAppDrawer: false, - showBottomBar: false, body: patientsProv.isLoading ? DrAppCircularProgressIndeicator() : patientsProv.isError diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_screen.dart b/lib/screens/patients/profile/vital_sign/vital_sign_screen.dart index 8b08f8ac..a03a031c 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_screen.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_screen.dart @@ -77,8 +77,6 @@ class _VitalSignScreenState extends State { Widget build(BuildContext context) { return AppScaffold( appBarTitle: "VITAL SIGN", - showAppDrawer: false, - showBottomBar: false, body: patientsProv.isLoading ? DrAppCircularProgressIndeicator() : patientsProv.isError diff --git a/lib/widgets/auth/show_timer_text.dart b/lib/widgets/auth/show_timer_text.dart new file mode 100644 index 00000000..3ee67312 --- /dev/null +++ b/lib/widgets/auth/show_timer_text.dart @@ -0,0 +1,102 @@ +import 'dart:async'; + +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/providers/auth_provider.dart'; +import 'package:doctor_app_flutter/providers/patients_provider.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +class ShowTimerText extends StatefulWidget { + ShowTimerText({Key key, this.model}); + final model; + + @override + _ShowTimerTextState createState() => _ShowTimerTextState(); +} + +class _ShowTimerTextState extends State { + String timerText = (TIMER_MIN - 1).toString() + ':59'; + int min = TIMER_MIN - 1; + int sec = 59; + Timer _timer; + + AuthProvider authProv; + + resendCode() { + min = TIMER_MIN - 1; + sec = 59; + _timer = Timer.periodic(Duration(seconds: 1), (Timer timer) { + if (min <= 0 && sec <= 0) { + timer.cancel(); + } else { + setState(() { + sec = sec - 1; + if (sec == 0 && min == 0) { + min = 0; + sec = 0; + } else if (sec == 0) { + min = min - 1; + sec = 59; + } + timerText = min.toString() + ':' + sec.toString(); + }); + } + }); + } + + @override + void initState() { + super.initState(); + resendCode(); + } + + @override + void dispose() { + _timer.cancel(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + authProv = Provider.of(context); + return Center( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + InkWell( + onTap: min != 0 || sec != 0 + ? null + : () { + resendActivatioinCode(); + }, + child: Text( + min == 0 && sec == 0 ? 'Resend Login Code' : timerText, + style: TextStyle( + fontSize: 3.0 * SizeConfig.textMultiplier, + color: + min == 0 && sec == 0 ? Colors.blue : Hexcolor('#B8382C'), + fontWeight: FontWeight.bold), + ), + ), + ], + ), + ); + } + + resendActivatioinCode() { + authProv + .sendActivationCodeByOtpNotificationType(widget.model) + .then((res) => { + // print('$value') + if (res['MessageStatus'] == 1) + {resendCode()} + else + {helpers.showErrorToast(res['ErrorEndUserMessage'])} + }) + .catchError((err) { + helpers.showErrorToast(); + }); + } +} diff --git a/lib/widgets/auth/verfiy_account.dart b/lib/widgets/auth/verfiy_account.dart index 7bf1944f..0ebbeab4 100644 --- a/lib/widgets/auth/verfiy_account.dart +++ b/lib/widgets/auth/verfiy_account.dart @@ -1,7 +1,9 @@ +import 'dart:async'; + import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/models/clinic_model.dart'; -import 'package:doctor_app_flutter/models/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/profile_req_Model.dart'; +import 'package:doctor_app_flutter/widgets/auth/show_timer_text.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; @@ -35,6 +37,8 @@ class _VerifyAccountState extends State { Future _loggedUserFuture; var _loggedUser; AuthProvider authProv; + bool _isInit =true; + var model; @override void initState() { super.initState(); @@ -47,6 +51,17 @@ class _VerifyAccountState extends State { }); } + @override + void didChangeDependencies() { + super.didChangeDependencies(); + if (_isInit) { + authProv = Provider.of(context); + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + model = routeArgs['model']; + } + _isInit = false; + } + @override Widget build(BuildContext context) { authProv = Provider.of(context); @@ -132,10 +147,11 @@ class _VerifyAccountState extends State { onSaved: (val) { verifyAccountFormValue['digit3'] = val; - },onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus(focusD4); - }, + }, + onFieldSubmitted: (_) { + FocusScope.of(context) + .requestFocus(focusD4); + }, validator: validateCodeDigit)), Container( width: SizeConfig.realScreenWidth * 0.20, @@ -190,14 +206,7 @@ class _VerifyAccountState extends State { color: Hexcolor('#CCCCCC'))), ), buildSizedBox(20), - Center( - child: Text( - "Resend in 4.20", - style: TextStyle( - fontSize: 3.0 * SizeConfig.textMultiplier, - ), - ), - ), + ShowTimerText(model: model), buildSizedBox(10), ]))); } @@ -401,10 +410,10 @@ class _VerifyAccountState extends State { } }).catchError((err) { print('$err'); - changeLoadingStata(false); + changeLoadingStata(false); - print('$err'); - helpers.showErrorToast(); + print('$err'); + helpers.showErrorToast(); }); } } diff --git a/lib/widgets/auth/verification_methods.dart b/lib/widgets/auth/verification_methods.dart index 061d85c6..3a7fa482 100644 --- a/lib/widgets/auth/verification_methods.dart +++ b/lib/widgets/auth/verification_methods.dart @@ -270,7 +270,7 @@ class _VerificationMethodsState extends State { widget.changeLoadingStata(false); if (res['MessageStatus'] == 1) { - Navigator.of(context).pushNamed(VERIFY_ACCOUNT); + Navigator.of(context).pushNamed(VERIFY_ACCOUNT, arguments: {'model':model}); } else { print(res['ErrorEndUserMessage']); helpers.showErrorToast(res['ErrorEndUserMessage']); diff --git a/lib/widgets/shared/app_scaffold_widget.dart b/lib/widgets/shared/app_scaffold_widget.dart index e7b9012e..1e6da3fc 100644 --- a/lib/widgets/shared/app_scaffold_widget.dart +++ b/lib/widgets/shared/app_scaffold_widget.dart @@ -10,63 +10,33 @@ import '../../widgets/shared/app_loader_widget.dart'; import '../../widgets/shared/custom_shape_clipper.dart'; class AppScaffold extends StatelessWidget { - bool pageOnly = false; - // bool showAll = - bool showAppBar = true; - bool showAppDrawer = true; - bool showBottomBar = true; - bool showbg = true; - bool showCurve = true; - String appBarTitle = ''; + String appBarTitle; Widget body; - bool isloading = false; - int current; - //====== - Color backGroundcolorhex=Colors.teal;//Hexcolor('#88b74093');//Hexcolor('#FCF7F7'); - //====== + bool isLoading; - AppScaffold( - {this.pageOnly, - this.appBarTitle, - this.showAppBar, - this.showBottomBar, - this.showAppDrawer = true, - this.body, - this.showbg, - this.showCurve, - this.isloading = false, - this.current, - this.backGroundcolorhex - }); + AppScaffold({this.appBarTitle ='', this.body, this.isLoading = false}); @override Widget build(BuildContext context) { return Scaffold( - backgroundColor:Hexcolor('#F5F5F5'), - // (pageOnly == true || showbg == false) ? null : Hexcolor('#FCF7F7'), - appBar: (pageOnly == true || showAppBar == false) - ? null - : AppBar( + backgroundColor: Hexcolor('#F5F5F5'), + appBar: appBarTitle != '' + ? AppBar( elevation: 0, - backgroundColor:Hexcolor('#515B5D'), //Hexcolor('#FFDDD9'), + backgroundColor: Hexcolor('#515B5D'), textTheme: TextTheme( - title: TextStyle( - color: Colors.white, fontWeight: FontWeight.bold)),//Colors.black + headline6: TextStyle( + color: Colors.white, fontWeight: FontWeight.bold)), title: Text(appBarTitle.toUpperCase()), leading: Builder(builder: (BuildContext context) { return IconButton( - icon: showAppDrawer - ? Icon(Icons.menu) - : Icon(Icons.arrow_back_ios), - color: Colors.white,//Colors.black, - onPressed: () => showAppDrawer - ? Scaffold.of(context).openDrawer() - : Navigator.pop(context), + icon: Icon(Icons.arrow_back_ios), + color: Colors.white, //Colors.black, + onPressed: () => Navigator.pop(context), ); }), centerTitle: true, actions: [ - // IconButton(icon: Icon(Icons.person), onPressed: null) ProfileImageWidget( height: 50, width: 50, @@ -74,93 +44,12 @@ class AppScaffold extends StatelessWidget { "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png", ) ], - ), - drawer: (pageOnly == true || showAppDrawer == false) - ? null - : Theme( - data: Theme.of(context).copyWith( - canvasColor: Colors.transparent, - ), - child: SafeArea(child: AppDrawer()), - ), - // , - bottomNavigationBar: (pageOnly == true || showBottomBar == false) - ? null - : BottomNavigationBar( - items: [ - BottomNavigationBarItem( - icon: Icon( - Icons.home, - color: current == 0 ? Colors.red : Colors.grey, - ), - title: Text( - 'Home', - style: TextStyle( - color: current == 0 ? Colors.red : Colors.grey), - ), - backgroundColor: Colors.green, - // activeIcon: Icon(DoctorApp.home_icon) - ), - BottomNavigationBarItem( - icon: new Icon( - Icons.mail, - color: current == 1 ? Colors.red : Colors.grey, - ), - title: new Text('Messages', - style: TextStyle( - color: current == 1 ? Colors.red : Colors.grey)), - // backgroundColor: current == 1?Colors.red:Colors.grey, - ), - BottomNavigationBarItem( - icon: Icon( - Icons.apps, - color: current == 2 ? Colors.red : Colors.grey, - ), - title: Text('Menu', - style: TextStyle( - color: current == 2 ? Colors.red : Colors.grey)), - ) - ], - onTap: (index) => navigatot(index, context), - ), - body: (pageOnly == true || showCurve == false) - ? Stack(children: [body, buildAppLoaderWidget(isloading)]) - : Stack( - children: [ - ClipPath( - clipper: CustomShapeClipper(), - child: Container( - height: SizeConfig.realScreenHeight * 0.40, - decoration: - BoxDecoration(color: Hexcolor('#F5F5F5')))),//Hexcolor('#FFDDD9') - Positioned( - // key: , - // top: SizeConfig.realScreenHeight * 0.10, - child: body), - buildAppLoaderWidget(isloading) - ], - )); + ) + : null, + body: Stack(children: [body, buildAppLoaderWidget(isLoading)])); } Widget buildAppLoaderWidget(bool isloading) { return isloading ? AppLoaderWidget() : Container(); } - - navigatot(index, context) { - print('index :${index} current : ${current}'); - if (index != current) { - switch (index) { - case 0: - Navigator.of(context).pushReplacementNamed(HOME); - break; - case 1: - Navigator.of(context).pushReplacementNamed(MESSAGES); - break; - case 2: - Navigator.of(context).pushReplacementNamed(SERVICES); - break; - default: - } - } - } } diff --git a/lib/widgets/shared/bottom_nav_bar.dart b/lib/widgets/shared/bottom_nav_bar.dart new file mode 100644 index 00000000..f2fd66cc --- /dev/null +++ b/lib/widgets/shared/bottom_nav_bar.dart @@ -0,0 +1,75 @@ +import 'package:doctor_app_flutter/presentation/doctor_app_icons.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import 'bottom_navigation_item.dart'; + +class BottomNavBar extends StatefulWidget { + final ValueChanged changeIndex; + + BottomNavBar({Key key, this.changeIndex}) : super(key: key); + + @override + _BottomNavBarState createState() => _BottomNavBarState(); +} + +class _BottomNavBarState extends State { + int _index = 0; + + _changeIndex(int index) { + widget.changeIndex(index); + setState(() { + _index = index; + }); + } + + @override + Widget build(BuildContext context) { + return BottomAppBar( + elevation: 4, + shape: CircularNotchedRectangle(), + color: Colors.white, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 18), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + BottomNavigationItem( + icon: DoctorApp.home_icon, + activeIcon: DoctorApp.home_icon_active, + changeIndex: _changeIndex, + index: _index, + currentIndex: 0, + name: 'HOME', + ), + BottomNavigationItem( + icon: DoctorApp.message_icon, + activeIcon: DoctorApp.message_icon_active, + changeIndex: _changeIndex, + index: _index, + currentIndex: 1, + name: 'REPLAY', + ), + BottomNavigationItem( + icon: DoctorApp.schedule_icon, + activeIcon: DoctorApp.scdedule_icon_active, + changeIndex: _changeIndex, + index: _index, + currentIndex: 2, + name: 'SCHEDULE', + ), + BottomNavigationItem( + icon: DoctorApp.menu_icon, + activeIcon: DoctorApp.menu_icon_active, + changeIndex: _changeIndex, + index: _index, + currentIndex: 3, + name: 'SERVICES', + ) + ], + ), + ), + ); + } +} diff --git a/lib/widgets/shared/bottom_navigation_item.dart b/lib/widgets/shared/bottom_navigation_item.dart new file mode 100644 index 00000000..d35d66c3 --- /dev/null +++ b/lib/widgets/shared/bottom_navigation_item.dart @@ -0,0 +1,68 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class BottomNavigationItem extends StatelessWidget { + final IconData icon; + final IconData activeIcon; + final ValueChanged changeIndex; + final int index; + final int currentIndex; + final String name; + + BottomNavigationItem( + {this.icon, + this.activeIcon, + this.changeIndex, + this.index, + this.currentIndex, + this.name}); + + @override + Widget build(BuildContext context) { + return Expanded( + child: SizedBox( + height: 70.0, + child: Material( + type: MaterialType.transparency, + child: InkWell( + highlightColor: Colors.transparent, + splashColor: Colors.transparent, + onTap: () => changeIndex(currentIndex), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox(height: 15,), + Container( +// decoration: BoxDecoration(boxShadow: [ +// BoxShadow( +// color: currentIndex == index +// ? Color.fromRGBO(78, 62, 253, 0.4) +// : Color.fromRGBO(78, 62, 253, 0), +// blurRadius: 9.0, +// spreadRadius: -4.0, +// offset: Offset(0.0, 2.0)) +// ]), + child: Icon(currentIndex == index ? activeIcon : icon, + /*color: currentIndex == index + ? Theme.of(context).primaryColor + : Theme.of(context).dividerColor,*/ + size: 22.0), + ), + SizedBox(height: 5,), + Text( + name, + style: TextStyle( + color: currentIndex == index + ? Theme.of(context).primaryColor + : Theme.of(context).dividerColor, + ), + ), + ], + ), + ), + ), + ), + ); + } +}