From ec83d720384faba687bfe57ce7b468a8801e374e Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Mon, 22 Nov 2021 08:56:45 +0200 Subject: [PATCH] first step from fix screen --- lib/core/viewModel/dashboard_view_model.dart | 2 +- .../auth/verification_methods_screen.dart | 10 ++++---- .../doctor_replay/all_doctor_questions.dart | 8 +++---- .../doctor_replay/doctor_repaly_chat.dart | 18 +++++++------- .../doctor_replay/doctor_reply_screen.dart | 8 +++---- .../doctor_replay/doctor_reply_widget.dart | 6 ++--- .../not_replaied_doctor_questions.dart | 8 +++---- lib/screens/home/home_patient_card.dart | 6 ++--- lib/screens/home/home_screen.dart | 24 ++++--------------- 9 files changed, 38 insertions(+), 52 deletions(-) diff --git a/lib/core/viewModel/dashboard_view_model.dart b/lib/core/viewModel/dashboard_view_model.dart index 38bf85e6..2a064296 100644 --- a/lib/core/viewModel/dashboard_view_model.dart +++ b/lib/core/viewModel/dashboard_view_model.dart @@ -81,7 +81,7 @@ List get specialClinicalCareList => // setState(ViewState.Idle); } - Future changeClinic(int clinicId, AuthenticationViewModel authProvider) async { + Future changeClinic(var clinicId, AuthenticationViewModel authProvider) async { setState(ViewState.BusyLocal); await getDoctorProfile(); ClinicModel clinicModel = ClinicModel( diff --git a/lib/screens/auth/verification_methods_screen.dart b/lib/screens/auth/verification_methods_screen.dart index d22e13df..17aa4fdc 100644 --- a/lib/screens/auth/verification_methods_screen.dart +++ b/lib/screens/auth/verification_methods_screen.dart @@ -12,6 +12,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/secondary_button.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -25,6 +26,7 @@ import '../../widgets/auth/verification_methods_list.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); Helpers helpers = Helpers(); +///TODO Elham* check if this still in user or not class VerificationMethodsScreen extends StatefulWidget { final password; @@ -339,7 +341,7 @@ class _VerificationMethodsScreenState extends State { SecondaryButton( label: TranslationBase .of(context) - .useAnotherAccount, + .useAnotherAccount??'', color: Color(0xFFD02127), //fontWeight: FontWeight.w700, onTap: () { @@ -387,7 +389,7 @@ class _VerificationMethodsScreenState extends State { Helpers.showErrorToast(authenticationViewModel.error); } else { await sharedPref.setString(TOKEN, - authenticationViewModel.activationCodeVerificationScreenRes.logInTokenID); + authenticationViewModel.activationCodeVerificationScreenRes.logInTokenID!); if (authMethodType == AuthMethodTypes.SMS || authMethodType == AuthMethodTypes.WhatsApp) { GifLoaderDialogUtils.hideDialog(context); this.startSMSService(authMethodType,isSilentLogin: true); @@ -470,8 +472,8 @@ class _VerificationMethodsScreenState extends State { } } - checkActivationCode({String value,bool isSilentLogin = false}) async { - await authenticationViewModel.checkActivationCodeForDoctorApp(activationCode: value,isSilentLogin: isSilentLogin); + checkActivationCode({String? value,bool isSilentLogin = false}) async { + await authenticationViewModel.checkActivationCodeForDoctorApp(activationCode: value!,isSilentLogin: isSilentLogin); if (authenticationViewModel.state == ViewState.ErrorLocal) { Navigator.pop(context); Helpers.showErrorToast(authenticationViewModel.error); diff --git a/lib/screens/doctor/doctor_replay/all_doctor_questions.dart b/lib/screens/doctor/doctor_replay/all_doctor_questions.dart index ac6736e0..66f2e7aa 100644 --- a/lib/screens/doctor/doctor_replay/all_doctor_questions.dart +++ b/lib/screens/doctor/doctor_replay/all_doctor_questions.dart @@ -12,9 +12,8 @@ import 'package:flutter/material.dart'; import 'doctor_repaly_chat.dart'; class AllDoctorQuestions extends StatefulWidget { - final Function changeCurrentTab; - const AllDoctorQuestions({Key? key, this.changeCurrentTab}) : super(key: key); + const AllDoctorQuestions({Key? key}) : super(key: key); @override _AllDoctorQuestionsState createState() => _AllDoctorQuestionsState(); @@ -31,10 +30,9 @@ class _AllDoctorQuestionsState extends State { }, builder: (_, model, w) => AppScaffold( baseViewModel: model, - appBarTitle: TranslationBase.of(context).replay2, isShowAppBar: false, body: model.listDoctorWorkingHoursTable.isEmpty - ?ErrorMessage(error: TranslationBase.of(context).noItem)// DrAppEmbeddedError(error: TranslationBase.of(context).noItem) + ?ErrorMessage(error: TranslationBase.of(context).noItem!)// DrAppEmbeddedError(error: TranslationBase.of(context).noItem) : Column( children: [ Expanded( @@ -82,7 +80,7 @@ class _AllDoctorQuestionsState extends State { }); model.getDoctorReply(pageIndex: pageIndex); } - return; + return false; }, ), ), diff --git a/lib/screens/doctor/doctor_replay/doctor_repaly_chat.dart b/lib/screens/doctor/doctor_replay/doctor_repaly_chat.dart index 85c06b18..39528c9c 100644 --- a/lib/screens/doctor/doctor_replay/doctor_repaly_chat.dart +++ b/lib/screens/doctor/doctor_replay/doctor_repaly_chat.dart @@ -7,11 +7,11 @@ import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/TextFields.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -24,7 +24,7 @@ class DoctorReplayChat extends StatefulWidget { final DoctorReplayViewModel previousModel; bool showMsgBox = false; DoctorReplayChat( - {Key? key, this.reply, this.previousModel, + {Key? key, required this.reply, required this.previousModel, }); @override @@ -37,8 +37,8 @@ class _DoctorReplayChatState extends State { @override Widget build(BuildContext context) { - if(widget.reply.doctorResponse.isNotEmpty){ - msgController.text = widget.reply.doctorResponse; + if(widget.reply.doctorResponse!.isNotEmpty){ + msgController.text = widget.reply.doctorResponse!; } else { widget.showMsgBox = true; @@ -172,7 +172,7 @@ class _DoctorReplayChatState extends State { margin: EdgeInsets.symmetric(horizontal: 0), child: InkWell( onTap: () { - launch("tel://" +widget.reply.mobileNumber); + launch("tel://" +widget.reply.mobileNumber!); }, child: Icon( Icons.phone, @@ -194,7 +194,7 @@ class _DoctorReplayChatState extends State { fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *2.8, ), AppText( - widget.reply.createdOn !=null?AppDateUtils.getHour(AppDateUtils.getDateTimeFromServerFormat(widget.reply.createdOn)):AppDateUtils.getHour(DateTime.now()), + widget.reply.createdOn !=null?AppDateUtils.getHour(AppDateUtils.getDateTimeFromServerFormat(widget.reply.createdOn!)):AppDateUtils.getHour(DateTime.now()), fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *2.8, fontFamily: 'Poppins', color: Colors.white, @@ -236,7 +236,7 @@ class _DoctorReplayChatState extends State { SizedBox(height: 30,), SizedBox(height: 30,), - if(widget.reply.doctorResponse != null && widget.reply.doctorResponse.isNotEmpty) + if(widget.reply.doctorResponse != null && widget.reply.doctorResponse!.isNotEmpty) Align( alignment: Alignment.centerRight, child: Container( @@ -269,7 +269,7 @@ class _DoctorReplayChatState extends State { width: 50, height: 50, child: Image.asset( - widget.previousModel.doctorProfile.gender == 0 + widget.previousModel.doctorProfile!.gender == 0 ? 'assets/images/male_avatar.png' : 'assets/images/female_avatar.png', fit: BoxFit.cover, @@ -280,7 +280,7 @@ class _DoctorReplayChatState extends State { Container( width: MediaQuery.of(context).size.width * 0.35, child: AppText( - widget.previousModel.doctorProfile.doctorName, + widget.previousModel.doctorProfile!.doctorName, fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontFamily: 'Poppins', color: Color(0xFF2B353E), diff --git a/lib/screens/doctor/doctor_replay/doctor_reply_screen.dart b/lib/screens/doctor/doctor_replay/doctor_reply_screen.dart index 84c951f8..9bdfe49d 100644 --- a/lib/screens/doctor/doctor_replay/doctor_reply_screen.dart +++ b/lib/screens/doctor/doctor_replay/doctor_reply_screen.dart @@ -28,7 +28,7 @@ import 'not_replaied_Doctor_Questions.dart'; class DoctorReplyScreen extends StatefulWidget { final Function changeCurrentTab; - const DoctorReplyScreen({Key? key, this.changeCurrentTab}) : super(key: key); + const DoctorReplyScreen({Key? key, required this.changeCurrentTab}) : super(key: key); @override _DoctorReplyScreenState createState() => _DoctorReplyScreenState(); @@ -36,7 +36,7 @@ class DoctorReplyScreen extends StatefulWidget { class _DoctorReplyScreenState extends State with SingleTickerProviderStateMixin { - TabController _tabController; + late TabController _tabController; int _activeTab = 0; int pageIndex = 1; @@ -69,7 +69,7 @@ class _DoctorReplyScreenState extends State return false; }, child: AppScaffold( - appBarTitle: TranslationBase.of(context).replay2, + appBarTitle: TranslationBase.of(context).replay2!, isShowAppBar: false, body: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -109,7 +109,7 @@ class _DoctorReplyScreenState extends State tabWidget( screenSize, _activeTab == 1, - TranslationBase.of(context).all, + TranslationBase.of(context).all!, ), ], ), diff --git a/lib/screens/doctor/doctor_replay/doctor_reply_widget.dart b/lib/screens/doctor/doctor_replay/doctor_reply_widget.dart index 77014074..c48dbf08 100644 --- a/lib/screens/doctor/doctor_replay/doctor_reply_widget.dart +++ b/lib/screens/doctor/doctor_replay/doctor_reply_widget.dart @@ -188,10 +188,10 @@ class _DoctorReplyWidgetState extends State { isCopyable:false, ), CustomRow( - label: TranslationBase.of(context).age + " : ", + label: TranslationBase.of(context).age! + " : ", isCopyable:false, value: - "${AppDateUtils.getAgeByBirthday(widget.reply.dateofBirth, context)}", + "${AppDateUtils.getAgeByBirthday(widget.reply.dateofBirth!, context)}", ), SizedBox( height: 8, @@ -213,7 +213,7 @@ class _DoctorReplyWidgetState extends State { children: [ new TextSpan( text: - TranslationBase.of(context).requestType + + TranslationBase.of(context).requestType! + ": ", style: TextStyle( fontSize: SizeConfig diff --git a/lib/screens/doctor/doctor_replay/not_replaied_doctor_questions.dart b/lib/screens/doctor/doctor_replay/not_replaied_doctor_questions.dart index 65b95217..1416e70a 100644 --- a/lib/screens/doctor/doctor_replay/not_replaied_doctor_questions.dart +++ b/lib/screens/doctor/doctor_replay/not_replaied_doctor_questions.dart @@ -14,7 +14,7 @@ import 'doctor_repaly_chat.dart'; class NotRepliedDoctorQuestions extends StatefulWidget { final Function changeCurrentTab; - const NotRepliedDoctorQuestions({Key? key, this.changeCurrentTab}) + const NotRepliedDoctorQuestions({Key? key, required this.changeCurrentTab}) : super(key: key); @override @@ -33,10 +33,10 @@ class _NotRepliedDoctorQuestionsState extends State { }, builder: (_, model, w) => AppScaffold( baseViewModel: model, - appBarTitle: TranslationBase.of(context).replay2, + appBarTitle: TranslationBase.of(context).replay2!, isShowAppBar: false, body: model.listDoctorNotRepliedQuestions.isEmpty - ? ErrorMessage(error: TranslationBase.of(context).noItem) + ? ErrorMessage(error: TranslationBase.of(context).noItem!) : Column( children: [ Expanded( @@ -91,7 +91,7 @@ class _NotRepliedDoctorQuestionsState extends State { }); model.getDoctorReply(pageIndex: pageIndex, isGettingNotReply: true); } - return; + return false; }, ), ), diff --git a/lib/screens/home/home_patient_card.dart b/lib/screens/home/home_patient_card.dart index 704c9eb3..a1a5f8f8 100644 --- a/lib/screens/home/home_patient_card.dart +++ b/lib/screens/home/home_patient_card.dart @@ -6,7 +6,7 @@ import 'package:flutter/material.dart'; class HomePatientCard extends StatelessWidget { final Color backgroundColor; final IconData cardIcon; - final String cardIconImage; + final String? cardIconImage; final Color backgroundIconColor; final String text; final Color textColor; @@ -17,7 +17,7 @@ class HomePatientCard extends StatelessWidget { required this.backgroundColor, required this.backgroundIconColor, required this.cardIcon, - required this.cardIconImage, + this.cardIconImage, required this.text, required this.textColor, required this.onTap, @@ -75,7 +75,7 @@ class HomePatientCard extends StatelessWidget { color: textColor, ) : Image.asset( - cardIconImage, + cardIconImage!, height: iconSize, width: iconSize, ), diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index c609ad7a..2d469daf 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -21,6 +21,7 @@ import 'package:doctor_app_flutter/screens/patients/register_patient/RegisterPat import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/profile-welcome-widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; @@ -29,6 +30,7 @@ import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:sticky_headers/sticky_headers/widget.dart'; import '../../routes.dart'; import 'home_screen_header.dart'; @@ -51,7 +53,7 @@ class _HomeScreenState extends State { bool isExpanded = false; bool isInpatient = false; int sliderActiveIndex = 0; - String? clinicId; + var clinicId; late AuthenticationViewModel authenticationViewModel; int colorIndex = 0; final GlobalKey scaffoldKey = new GlobalKey(); @@ -328,22 +330,6 @@ class _HomeScreenState extends State { DashboardViewModel model, projectsProvider) { colorIndex = 0; - // List backgroundColors = List(3); - // backgroundColors[0] = Color(0xffD02127); - // backgroundColors[1] = Colors.grey[300]; - // backgroundColors[2] = Color(0xff2B353E); - // List backgroundIconColors = List(3); - // backgroundIconColors[0] = Colors.white12; - // backgroundIconColors[1] = Colors.white38; - // backgroundIconColors[2] = Colors.white10; - // List textColors = List(3); - // textColors[0] = Colors.white; - // textColors[1] = Color(0xFF353E47); - // textColors[2] = Colors.white; - // - // List patientCards = []; - // - List backgroundColors = []; backgroundColors.add(Color(0xffD02127)); backgroundColors.add(Colors.grey[300]!); @@ -407,7 +393,7 @@ class _HomeScreenState extends State { context, FadePage( page: InPatientScreen( - specialClinic: model.getSpecialClinic(clinicId ?? projectsProvider!.doctorClinicsList[0]!.clinicID!), + specialClinic: model.getSpecialClinic(clinicId ?? projectsProvider!.doctorClinicsList[0]!.clinicID!)!, ), ), ); @@ -421,7 +407,7 @@ class _HomeScreenState extends State { //TODO Elham* match the of the icon cardIcon: DoctorApp.arrival_patients, textColor: textColors[colorIndex], - text: TranslationBase.of(context).registerNewPatient, + text: TranslationBase.of(context).registerNewPatient!, onTap: () { Navigator.push( context,