fix issue on app drawer

merge-requests/271/head
Elham Rababah 5 years ago
parent 00543a759a
commit 9ddfbd3e66

@ -37,7 +37,7 @@ const Map<String, Map<String, String>> localizedValues = {
'lab': {'en': 'Lab', 'ar': 'المختبر'}, 'lab': {'en': 'Lab', 'ar': 'المختبر'},
'result': {'en': 'Result', 'ar': 'نتيجة'}, 'result': {'en': 'Result', 'ar': 'نتيجة'},
'todayStatistics': {'en': 'Today Statistics', 'ar': 'إحصائيات اليوم'}, 'todayStatistics': {'en': 'Today Statistics', 'ar': 'إحصائيات اليوم'},
'arrived': {'en': 'Arrived', 'ar': 'وصل'}, 'arrived': {'en': 'Arrival Patients', 'ar': ' المرضى الواصلين'},
'er': {'en': 'ER', 'ar': 'حالة طوارئ'}, 'er': {'en': 'ER', 'ar': 'حالة طوارئ'},
'walkIn': {'en': 'Walk-in', 'ar': 'ادخل'}, 'walkIn': {'en': 'Walk-in', 'ar': 'ادخل'},
'notArrived': {'en': 'Not Arrived', 'ar': 'لم يصل'}, 'notArrived': {'en': 'Not Arrived', 'ar': 'لم يصل'},

@ -24,11 +24,7 @@ class PrescriptionService extends BaseService {
PrescriptionReqModel _prescriptionReqModel = PrescriptionReqModel(); PrescriptionReqModel _prescriptionReqModel = PrescriptionReqModel();
SearchDrugRequestModel _drugRequestModel = SearchDrugRequestModel( SearchDrugRequestModel _drugRequestModel = SearchDrugRequestModel(
//search: ["Acetaminophen"], //search: ["Acetaminophen"],
// vidaAuthTokenID:
// "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiY2QwOWU3MTEtZDEwYy00NjZhLWEwNDctMjc4MDBmNmRkMTYxIiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3l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CJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTYyMDMiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkhFQUQgTlVSU0VTIiwiRE9DVE9SUyIsIkhFQUQgRE9DVE9SUyIsIkFETUlOSVNUUkFUT1JTIiwiUkVDRVBUSU9OSVNUIiwiRVIgTlVSU0UiLCJJVkYgUkVDRVBUSU9OSVNUIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIklWRiBET0NUT1IiLCJJVkYgTlVSU0UiLCJJVkYgQ09PUkRJTkFUT1IiLCJJVkYgTEFCIFNUQUZGIiwiQ09OU0VOVCAiLCJNRURJQ0FMIFJFUE9SVCAtIFNJQ0sgTEVBVkUgTUFOQUdFUiJdLCJuYmYiOjE2MDkyNjQ2MTQsImV4cCI6MTYxMDEyODYxNCwiaWF0IjoxNjA5MjY0NjE0fQ.xCJ0jGtSFf36G8uZpdmHVoLfXDyP6e9mBpuOPSlzuio",
); );
PostPrescriptionReqModel _postPrescriptionReqModel = PostPrescriptionReqModel _postPrescriptionReqModel =

@ -49,18 +49,22 @@ class PatientViewModel extends BaseViewModel {
_patientService.referalFrequancyList; _patientService.referalFrequancyList;
Future getPatientList(patient, patientType, Future getPatientList(patient, patientType,
{bool isBusyLocal = false}) async { {bool isBusyLocal = false}) async {
var localRes ;
if (isBusyLocal) { if (isBusyLocal) {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
} else { } else {
setState(ViewState.Busy); setState(ViewState.Busy);
} }
localRes = await _patientService.getPatientList(patient, patientType);
if (_patientService.hasError) { if (_patientService.hasError) {
error = _patientService.error; error = _patientService.error;
setState(ViewState.Error); setState(ViewState.Error);
} }
return _patientService.getPatientList(patient, patientType); return localRes;
} }

@ -44,6 +44,8 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
bool _autoValidate = false; bool _autoValidate = false;
bool onlyArrived = true; bool onlyArrived = true;
bool isFormSubmitted = false;
var _patientSearchFormValues = PatientModel( var _patientSearchFormValues = PatientModel(
FirstName: "0", FirstName: "0",
MiddleName: "0", MiddleName: "0",
@ -64,7 +66,9 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
PatientOutSA: false); PatientOutSA: false);
void _validateInputs() async { void _validateInputs() async {
setState(() {
isFormSubmitted = true;
});
try { try {
if (_formKey.currentState.validate()) { if (_formKey.currentState.validate()) {
@ -73,8 +77,11 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
if ((_patientSearchFormValues.From == "0" || if ((_patientSearchFormValues.From == "0" ||
_patientSearchFormValues.To == "0") && _patientSearchFormValues.To == "0") &&
_selectedType == "7") { _selectedType == "7") {
helpers.showErrorToast("Please Choose The Dates"); // helpers.showErrorToast("Please Choose The Dates");
} else { } else {
setState(() {
isFormSubmitted = false;
});
Navigator.of(context).pushNamed(PATIENTS, arguments: { Navigator.of(context).pushNamed(PATIENTS, arguments: {
"patientSearchForm": _patientSearchFormValues, "patientSearchForm": _patientSearchFormValues,
"selectedType": _selectedType "selectedType": _selectedType
@ -112,7 +119,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
children: <Widget>[ children: <Widget>[
Container( Container(
child: Icon( child: Icon(
DoctorApp.search_patient, DoctorApp.search_patient_1,
size: 100, size: 100,
color: Colors.black, color: Colors.black,
), ),
@ -403,7 +410,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
), ),
), ),
(!(_selectedType == '2' || _selectedType == '4')) (!(_selectedType == '2' || _selectedType == '4'))
? DynamicElements(_patientSearchFormValues) ? DynamicElements(_patientSearchFormValues, isFormSubmitted)
: SizedBox( : SizedBox(
height: 0, height: 0,
), ),

@ -273,7 +273,7 @@ class _PatientsScreenState extends State<PatientsScreen> {
patientType) patientType)
.then((res) { .then((res) {
setState(() { setState(() {
_isLoading = false;
if (res != null && res['MessageStatus'] == 1) { if (res != null && res['MessageStatus'] == 1) {
if (val2 == 7) { if (val2 == 7) {
@ -302,10 +302,13 @@ class _PatientsScreenState extends State<PatientsScreen> {
responseModelList = new ModelResponse.fromJson(parsed).list; responseModelList = new ModelResponse.fromJson(parsed).list;
responseModelList2 = responseModelList; responseModelList2 = responseModelList;
_isError = false; _isError = false;
} else { } else {
_isError = true; _isError = true;
error = model.error; //res['ErrorEndUserMessage'] ?? res['ErrorMessage']; error = model.error??res['ErrorEndUserMessage'] ?? res['ErrorMessage'];
} }
_isLoading = false;
}); });
}).catchError((error) { }).catchError((error) {
setState(() { setState(() {

@ -1,13 +1,15 @@
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/models/patient/patient_model.dart'; import 'package:doctor_app_flutter/models/patient/patient_model.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/custom_validation_error.dart';
import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
class DynamicElements extends StatefulWidget { class DynamicElements extends StatefulWidget {
final PatientModel _patientSearchFormValues; final PatientModel _patientSearchFormValues;
DynamicElements(this._patientSearchFormValues); final bool isFormSubmitted;
DynamicElements(this._patientSearchFormValues, this.isFormSubmitted);
@override @override
_DynamicElementsState createState() => _DynamicElementsState(); _DynamicElementsState createState() => _DynamicElementsState();
} }
@ -113,6 +115,10 @@ class _DynamicElementsState extends State<DynamicElements> {
), ),
SizedBox( SizedBox(
height: 5,
),
if(widget._patientSearchFormValues.From == "0" && widget.isFormSubmitted)
CustomValidationError(),SizedBox(
height: 10, height: 10,
), ),
AppTextFormField( AppTextFormField(
@ -137,6 +143,10 @@ class _DynamicElementsState extends State<DynamicElements> {
} }
}, },
), ),
if(widget._patientSearchFormValues.To == "0" && widget.isFormSubmitted)
CustomValidationError(),SizedBox(
height: 10,
),
], ],
); );
}, },

@ -1,9 +1,10 @@
import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../../config/size_config.dart'; import '../../config/size_config.dart';
@ -28,6 +29,7 @@ class _AppDrawerState extends State<AppDrawer> {
bool _isInit = true; bool _isInit = true;
Helpers helpers = new Helpers(); Helpers helpers = new Helpers();
ProjectViewModel projectsProvider; ProjectViewModel projectsProvider;
// @override // @override
// void didChangeDependencies() { // void didChangeDependencies() {
// super.didChangeDependencies(); // super.didChangeDependencies();
@ -47,119 +49,126 @@ class _AppDrawerState extends State<AppDrawer> {
// margin: EdgeInsets.only(top: SizeConfig.heightMultiplier * 2), // margin: EdgeInsets.only(top: SizeConfig.heightMultiplier * 2),
child: Drawer( child: Drawer(
child: Column(children: <Widget>[ child: Column(children: <Widget>[
Expanded( Expanded(
flex: 4, flex: 4,
child: ListView(padding: EdgeInsets.zero, children: <Widget>[ child: ListView(padding: EdgeInsets.zero, children: <Widget>[
Container( Container(
height: SizeConfig.heightMultiplier * 50, height: SizeConfig.heightMultiplier * 50,
child: InkWell( child: InkWell(
child: DrawerHeader( child: DrawerHeader(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Container( Container(
child: Image.asset('assets/images/logo.png'), child: Image.asset(
margin: EdgeInsets.only(top: 10, bottom: 15), 'assets/images/logo.png',
),
SizedBox(
height: 1,
child: Container(
color: Colors.black26,
), ),
margin: EdgeInsets.only(top: 10, bottom: 15),
), ),
SizedBox(height: 15), SizedBox(
authProvider.doctorProfile != null height: 1,
? CircleAvatar( child: Container(
radius: SizeConfig.imageSizeMultiplier * 12, color: Colors.black26,
backgroundImage: NetworkImage( ),
authProvider.doctorProfile.doctorImageURL), ),
backgroundColor: Colors.white, SizedBox(height: 15),
) InkWell(
: SizedBox(), onTap: (){
authProvider.doctorProfile != null Navigator.of(context).pushNamed(PROFILE, arguments: {
? Padding( 'title': authProvider.doctorProfile.doctorName,
padding: EdgeInsets.only(top: 10), "doctorProfileall": authProvider.doctorProfile
child: AppText( });
authProvider.doctorProfile?.doctorName, },
fontWeight: FontWeight.bold, child: Column(
color: Colors.black, children: [
fontSize: SizeConfig.textMultiplier * 2, authProvider.doctorProfile != null
)) ? CircleAvatar(
: SizedBox(), radius: SizeConfig.imageSizeMultiplier * 12,
AppText( backgroundImage: NetworkImage(
projectsProvider.isArabic authProvider.doctorProfile.doctorImageURL),
? authProvider backgroundColor: Colors.white,
.doctorProfile.titleDescriptionN ?? )
"" : SizedBox(),
: authProvider authProvider.doctorProfile != null
.doctorProfile?.titleDescription ?? ? Padding(
"", padding: EdgeInsets.only(top: 10),
fontWeight: FontWeight.normal, child: AppText(
color: Colors.black87), authProvider.doctorProfile?.doctorName,
RaisedButton( fontWeight: FontWeight.bold,
shape: RoundedRectangleBorder( color: Colors.black,
borderRadius: BorderRadius.circular(18.0), fontSize: SizeConfig.textMultiplier * 2,
side: BorderSide(color: Colors.red)), ))
child: AppText( : SizedBox(),
TranslationBase.of(context).logout, AppText(
color: Colors.white, projectsProvider.isArabic
), ? authProvider
onPressed: () async { .doctorProfile.titleDescriptionN ??
Navigator.pop(context); ""
await helpers.logout(); : authProvider
}, .doctorProfile?.titleDescription ??
"",
fontWeight: FontWeight.normal,
color: Colors.black87),
],
),
),
RaisedButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18.0),
side: BorderSide(color: Colors.red)),
child: AppText(
TranslationBase.of(context).logout,
color: Colors.white,
),
onPressed: () async {
Navigator.pop(context);
await helpers.logout();
},
),
],
), ),
], ),
), ),
), ),
onTap: () { InkWell(
//Navigator.of(context).pushNamed(PROFILE); child: DrawerItem(
Navigator.of(context).pushNamed(PROFILE, arguments: { TranslationBase.of(context).settings, Icons.settings),
'title': authProvider.doctorProfile.doctorName, onTap: () {
"doctorProfileall": authProvider.doctorProfile Navigator.pop(context);
}); Navigator.of(context).pushNamed(SETTINGS);
}, },
), ),
), InkWell(
InkWell( child: DrawerItem(
child: DrawerItem( TranslationBase.of(context).qr +
TranslationBase.of(context).settings, Icons.settings), TranslationBase.of(context).reader,
onTap: () { DoctorApp.qr_code),
Navigator.pop(context); onTap: () {
Navigator.of(context).pushNamed(SETTINGS); Navigator.pop(context);
}, Navigator.of(context).pushNamed(QR_READER);
), },
InkWell( ),
child: DrawerItem( ]),
TranslationBase.of(context).qr +
TranslationBase.of(context).reader,
DoctorApp.qr_code),
onTap: () {
Navigator.pop(context);
Navigator.of(context).pushNamed(QR_READER);
},
), ),
]), Expanded(
), flex: 1,
Expanded( child: Column(children: <Widget>[
flex: 1, Container(
child: Column(children: <Widget>[ // This align moves the children to the bottom
Container( child: Align(
// This align moves the children to the bottom alignment: FractionalOffset.bottomCenter,
child: Align( child: Container(
alignment: FractionalOffset.bottomCenter, child: Column(
child: Container( children: <Widget>[
child: Column( Text("Powered by"),
children: <Widget>[ Image.asset(
Text("Powered by"), 'assets/images/cs_logo_container.png',
Image.asset( width: SizeConfig.imageSizeMultiplier * 30,
'assets/images/cs_logo_container.png', )
width: SizeConfig.imageSizeMultiplier * 30, ],
) ))))
], ]))
)))) ])),
]))
])),
), ),
width: SizeConfig.realScreenWidth * 0.60, width: SizeConfig.realScreenWidth * 0.60,
margin: 0, margin: 0,

@ -28,7 +28,7 @@ class _DrawerItemState extends State<DrawerItem> {
return Container( return Container(
margin: EdgeInsets.only(top: 5, bottom: 5, left: 10, right: 10), margin: EdgeInsets.only(top: 5, bottom: 5, left: 10, right: 10),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Icon( Icon(
widget.icon, widget.icon,
@ -37,12 +37,15 @@ class _DrawerItemState extends State<DrawerItem> {
), ),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[ children: <Widget>[
AppText( AppText(
widget.title, widget.title,
color: widget.color ?? Colors.black, color: widget.color ?? Colors.black,
// fontWeight: FontWeight.bold, // fontWeight: FontWeight.bold,
margin: 5, // margin: 5,
marginLeft: 5,
marginRight: 5,
fontSize: SizeConfig.textMultiplier * 2.3, fontSize: SizeConfig.textMultiplier * 2.3,
), ),
AppText( AppText(

Loading…
Cancel
Save