diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 9aba36b8..183b2a0f 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -47,9 +47,9 @@ const Map> localizedValues = { 'radiology': {'en': 'Radiology', 'ar': 'الأشعة'}, 'service': {'en': 'Service', 'ar': 'خدمة'}, 'referral': {'en': 'Referral', 'ar': 'الإحالة'}, - 'inPatient': {'en': 'My InPatients', 'ar': 'المريض الداخلي'}, + 'inPatient': {'en': 'My Patients', 'ar': 'مرضاي'}, 'inPatientLabel': {'en': 'InPatients', 'ar': 'المريض الداخلي'}, - 'inPatientAll': {'en': 'All InPatients', 'ar': 'كل المرضى الداخليين'}, + 'inPatientAll': {'en': 'All Patients', 'ar': 'كل المرضى'}, 'operations': {'en': 'Operations', 'ar': 'عمليات'}, 'patientServices': {'en': 'Patient Services', 'ar': 'خدمات المرضى'}, 'searchMedicine': {'en': 'Search Medicines', 'ar': 'بحث عن الدواء'}, @@ -961,6 +961,5 @@ const Map> localizedValues = { 'medical': {'en': 'Medical', 'ar': 'الطبي'}, 'report': {'en': 'Report', 'ar': 'التقرير'}, 'discharge': {'en': 'Discharge', 'ar': 'discharge'}, - - + "discharged": {"en": "Discharged", "ar": "المصرف"}, }; diff --git a/lib/core/service/patientInPatientService.dart b/lib/core/service/patientInPatientService.dart index 3e0ba4a4..6ec77514 100644 --- a/lib/core/service/patientInPatientService.dart +++ b/lib/core/service/patientInPatientService.dart @@ -5,6 +5,7 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; class PatientInPatientService extends BaseService { List inPatientList = List(); + List myInPatientList = List(); Future getInPatientList( PatientSearchRequestModel requestModel, bool isMyInpatient) async { @@ -21,9 +22,14 @@ class PatientInPatientService extends BaseService { GET_PATIENT_IN_PATIENT_LIST, onSuccess: (dynamic response, int statusCode) { inPatientList.clear(); + myInPatientList.clear(); response['List_MyInPatient'].forEach((v) { - inPatientList.add(PatiantInformtion.fromJson(v)); + PatiantInformtion patient = PatiantInformtion.fromJson(v); + inPatientList.add(patient); + if(patient.doctorId == doctorProfile.doctorID){ + myInPatientList.add(patient); + } }); }, onFailure: (String error, int statusCode) { diff --git a/lib/core/viewModel/PatientSearchViewModel.dart b/lib/core/viewModel/PatientSearchViewModel.dart index 5b5a99a3..087a2dbb 100644 --- a/lib/core/viewModel/PatientSearchViewModel.dart +++ b/lib/core/viewModel/PatientSearchViewModel.dart @@ -10,7 +10,7 @@ import 'package:doctor_app_flutter/util/date-utils.dart'; import '../../locator.dart'; import 'base_view_model.dart'; -class PatientSearchViewModel extends BaseViewModel{ +class PatientSearchViewModel extends BaseViewModel { OutPatientService _outPatientService = locator(); List get patientList => _outPatientService.patientList; @@ -25,10 +25,14 @@ class PatientSearchViewModel extends BaseViewModel{ if (strExist) { filterData = []; for (var i = 0; i < _outPatientService.patientList.length; i++) { - String firstName = _outPatientService.patientList[i].firstName.toUpperCase(); - String lastName = _outPatientService.patientList[i].lastName.toUpperCase(); - String mobile = _outPatientService.patientList[i].mobileNumber.toUpperCase(); - String patientID = _outPatientService.patientList[i].patientId.toString(); + String firstName = + _outPatientService.patientList[i].firstName.toUpperCase(); + String lastName = + _outPatientService.patientList[i].lastName.toUpperCase(); + String mobile = + _outPatientService.patientList[i].mobileNumber.toUpperCase(); + String patientID = + _outPatientService.patientList[i].patientId.toString(); if (firstName.contains(str.toUpperCase()) || lastName.contains(str.toUpperCase()) || @@ -44,19 +48,19 @@ class PatientSearchViewModel extends BaseViewModel{ } } - getOutPatient(PatientSearchRequestModel patientSearchRequestModel , {bool isLocalBusy = false}) async { - if(isLocalBusy) { + getOutPatient(PatientSearchRequestModel patientSearchRequestModel, + {bool isLocalBusy = false}) async { + if (isLocalBusy) { setState(ViewState.BusyLocal); } else { setState(ViewState.Busy); } - await getDoctorProfile(isGetProfile: true); + await getDoctorProfile(isGetProfile: true); patientSearchRequestModel.doctorID = doctorProfile.doctorID; - await _outPatientService.getOutPatient( - patientSearchRequestModel); + await _outPatientService.getOutPatient(patientSearchRequestModel); if (_outPatientService.hasError) { error = _outPatientService.error; - if(isLocalBusy) { + if (isLocalBusy) { setState(ViewState.ErrorLocal); } else { setState(ViewState.Error); @@ -67,10 +71,11 @@ class PatientSearchViewModel extends BaseViewModel{ } } - getPatientFileInformation(PatientSearchRequestModel patientSearchRequestModel, {bool isLocalBusy = false}) async { + getPatientFileInformation(PatientSearchRequestModel patientSearchRequestModel, + {bool isLocalBusy = false}) async { setState(ViewState.Busy); - await _outPatientService.getPatientFileInformation( - patientSearchRequestModel); + await _outPatientService + .getPatientFileInformation(patientSearchRequestModel); if (_outPatientService.hasError) { error = _outPatientService.error; setState(ViewState.Error); @@ -88,22 +93,13 @@ class PatientSearchViewModel extends BaseViewModel{ String dateTo; String dateFrom; if (OutPatientFilterType.Previous == outPatientFilterType) { - - selectedFromDate = DateTime(DateTime.now().year, DateTime.now().month-1, - DateTime.now().day); - selectedToDate = DateTime(DateTime.now().year, DateTime.now().month, - DateTime.now().day-1); - dateTo = DateUtils.convertDateToFormat( - selectedToDate, - 'yyyy-MM-dd'); - dateFrom = DateUtils.convertDateToFormat( - selectedFromDate, - 'yyyy-MM-dd'); - - + selectedFromDate = DateTime( + DateTime.now().year, DateTime.now().month - 1, DateTime.now().day); + selectedToDate = DateTime( + DateTime.now().year, DateTime.now().month, DateTime.now().day - 1); + dateTo = DateUtils.convertDateToFormat(selectedToDate, 'yyyy-MM-dd'); + dateFrom = DateUtils.convertDateToFormat(selectedFromDate, 'yyyy-MM-dd'); } else if (OutPatientFilterType.NextWeek == outPatientFilterType) { - - dateTo = DateUtils.convertDateToFormat( DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 6), @@ -118,76 +114,85 @@ class PatientSearchViewModel extends BaseViewModel{ DateTime( DateTime.now().year, DateTime.now().month, DateTime.now().day), 'yyyy-MM-dd'); - dateTo= DateUtils.convertDateToFormat( + dateTo = DateUtils.convertDateToFormat( DateTime( DateTime.now().year, DateTime.now().month, DateTime.now().day), 'yyyy-MM-dd'); } PatientSearchRequestModel currentModel = PatientSearchRequestModel(); - currentModel.patientID = patientSearchRequestModel.patientID; - currentModel.firstName = patientSearchRequestModel.firstName; - currentModel.lastName = patientSearchRequestModel.lastName; + currentModel.patientID = patientSearchRequestModel.patientID; + currentModel.firstName = patientSearchRequestModel.firstName; + currentModel.lastName = patientSearchRequestModel.lastName; currentModel.middleName = patientSearchRequestModel.middleName; currentModel.doctorID = patientSearchRequestModel.doctorID; currentModel.from = dateFrom; currentModel.to = dateTo; await getOutPatient(currentModel, isLocalBusy: true); filterData = _outPatientService.patientList; - } + PatientInPatientService _inPatientService = + locator(); + List get inPatientList => _inPatientService.inPatientList; - PatientInPatientService _inPatientService = - locator(); + List get myIinPatientList => + _inPatientService.myInPatientList; - List get _inPatientList => _inPatientService.inPatientList; List filteredInPatientItems = List(); Future getInPatientList(PatientSearchRequestModel requestModel, - {bool isMyInpatient = false, bool isFirstTime = true}) async { - await getDoctorProfile(); - if (isFirstTime) + {bool isMyInpatient = false}) async { + await getDoctorProfile(); setState(ViewState.Busy); - else - setState(ViewState.BusyLocal); - await _inPatientService.getInPatientList(requestModel, false); + + if (inPatientList.length == 0) + await _inPatientService.getInPatientList(requestModel, false); if (_inPatientService.hasError) { error = _inPatientService.error; setState(ViewState.Error); } else { - filteredInPatientItems.clear(); - if (_inPatientList.length > 0) - filteredInPatientItems.addAll(_inPatientList); + // setDefaultInPatientList(); setState(ViewState.Idle); } } + Future setDefaultInPatientList() async { + setState(ViewState.BusyLocal); + await getDoctorProfile(); + filteredInPatientItems.clear(); + if (inPatientList.length > 0) + filteredInPatientItems.addAll(inPatientList); + setState(ViewState.Idle); + } + + void clearPatientList(){ + _inPatientService.inPatientList = []; + _inPatientService.myInPatientList = []; + } + void filterSearchResults(String query) { var strExist = query.length > 0 ? true : false; if (strExist) { filteredInPatientItems = []; - for (var i = 0; i < _inPatientList.length; i++) { - String firstName = _inPatientList[i].firstName.toUpperCase(); - String lastName = _inPatientList[i].lastName.toUpperCase(); - String mobile = _inPatientList[i].mobileNumber.toUpperCase(); - String patientID = _inPatientList[i].patientId.toString(); + for (var i = 0; i < inPatientList.length; i++) { + String firstName = inPatientList[i].firstName.toUpperCase(); + String lastName = inPatientList[i].lastName.toUpperCase(); + String mobile = inPatientList[i].mobileNumber.toUpperCase(); + String patientID = inPatientList[i].patientId.toString(); if (firstName.contains(query.toUpperCase()) || lastName.contains(query.toUpperCase()) || mobile.contains(query) || patientID.contains(query)) { - filteredInPatientItems.add(_inPatientList[i]); + filteredInPatientItems.add(inPatientList[i]); } } notifyListeners(); } else { - if (_inPatientList.length > 0) - filteredInPatientItems.clear(); - filteredInPatientItems.addAll(_inPatientList); + if (inPatientList.length > 0) filteredInPatientItems.clear(); + filteredInPatientItems.addAll(inPatientList); notifyListeners(); } } - - } diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index f6f1d85b..fdc4e3df 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -654,84 +654,6 @@ class _HomeScreenState extends State { ); }, ), - // HomePageCard( - // color: Colors.red[800], - // margin: EdgeInsets.all(5), - // child: Column( - // mainAxisAlignment: - // MainAxisAlignment.center, - // crossAxisAlignment: - // CrossAxisAlignment.start, - // children: [ - // Padding( - // padding: EdgeInsets.only( - // top: 10, left: 10, right: 0), - // child: Icon( - // DoctorApp.discharge_patients, - // size: 35, - // color: Colors.white, - // )), - // Container( - // padding: EdgeInsets.all(10), - // child: AppText( - // 'Discharged Patients', - // color: Colors.white, - // textAlign: TextAlign.start, - // fontSize: 15, - // )) - // ], - // ), - // hasBorder: false, - // onTap: () { - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => - // DischargedPatient(), - // // MyReferredPatient(), - // ), - // ); - // }, - // ), - // HomePageCard( - // color: Colors.grey[300], - // margin: EdgeInsets.all(5), - // child: Column( - // mainAxisAlignment: - // MainAxisAlignment.center, - // crossAxisAlignment: - // CrossAxisAlignment.start, - // children: [ - // Padding( - // padding: EdgeInsets.only( - // top: 10, left: 10, right: 0), - // child: Icon( - // DoctorApp.referral_discharge, - // size: 35, - // color: Colors.black, - // )), - // Container( - // padding: EdgeInsets.all(10), - // child: AppText( - // 'Referral Discharged', - // color: Colors.black, - // textAlign: TextAlign.start, - // fontSize: 15, - // )) - // ], - // ), - // hasBorder: false, - // onTap: () { - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => - // ReferralDischargedPatientPage(), - // // MyReferredPatient(), - // ), - // ); - // }, - // ), HomePageCard( color: Color(0xffD02127), margin: EdgeInsets.all(5), diff --git a/lib/screens/patients/DischargedPatientPage.dart b/lib/screens/patients/DischargedPatientPage.dart index 28f7b834..e4138305 100644 --- a/lib/screens/patients/DischargedPatientPage.dart +++ b/lib/screens/patients/DischargedPatientPage.dart @@ -26,15 +26,18 @@ class _DischargedPatientState extends State { return BaseView( onModelReady: (model) => model.getDischargedPatient(), builder: (_, model, w) => AppScaffold( - appBarTitle: 'Discharged Patient', - subtitle: "Last Three Months", + //appBarTitle: 'Discharged Patient', + //subtitle: "Last Three Months", backgroundColor: Colors.grey[200], - isShowAppBar: true, + isShowAppBar: false, baseViewModel: model, - body: model.myDischargedPatient.isEmpty?Center( + body: model.myDischargedPatient.isEmpty? Center( child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ + Container( + height: MediaQuery.of(context).size.height * 0.070, + ), SizedBox( height: 100, ), @@ -53,6 +56,9 @@ class _DischargedPatientState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ + Container( + height: MediaQuery.of(context).size.height * 0.070, + ), SizedBox(height: 12,), Container( width: double.maxFinite, @@ -97,10 +103,10 @@ class _DischargedPatientState extends State { }), ])), SizedBox(height: 5,), - Expanded( - child: ListView.builder( - itemCount: model.filterData.length, - itemBuilder: (context,index)=>InkWell( + Expanded(child: SingleChildScrollView( + child: Column( + children: [ + ...List.generate(model.filterData.length, (index) => InkWell( onTap: () { Navigator.of(context) .pushNamed( @@ -324,8 +330,9 @@ class _DischargedPatientState extends State { ), ), )), - ), - + ], + ), + )) ], ), ), diff --git a/lib/screens/patients/InPatientPage.dart b/lib/screens/patients/InPatientPage.dart new file mode 100644 index 00000000..1b42d305 --- /dev/null +++ b/lib/screens/patients/InPatientPage.dart @@ -0,0 +1,164 @@ +import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/PatientCard.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; +import 'package:flutter/material.dart'; + +import '../../routes.dart'; + +class InPatientPage extends StatefulWidget { + final bool isMyInPatient; + + InPatientPage(this.isMyInPatient); + + @override + _InPatientPageState createState() => _InPatientPageState(); +} + +class _InPatientPageState extends State { + TextEditingController _searchController = TextEditingController(); + + @override + void dispose() { + _searchController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) async { + await model.setDefaultInPatientList(); + }, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: false, + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + height: MediaQuery.of(context).size.height * 0.070, + ), + Container( + margin: EdgeInsets.all(16.0), + child: AppTextFieldCustom( + hintText: TranslationBase.of(context).searchPatientName, + isTextFieldHasSuffix: true, + suffixIcon: IconButton( + icon: Icon( + Icons.search, + color: Colors.black, + ), + onPressed: () {}, + ), + controller: _searchController, + onChanged: (value) { + model.filterSearchResults(value); + }), + ), + model.filteredInPatientItems.length > 0 + ? Expanded( + child: Container( + margin: EdgeInsets.symmetric(horizontal: 16.0), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ...List.generate( + model.filteredInPatientItems.length, (index) { + if (!widget.isMyInPatient) + return PatientCard( + patientInfo: + model.filteredInPatientItems[index], + patientType: "1", + arrivalType: "1", + isInpatient: true, + isMyPatient: model + .filteredInPatientItems[index] + .doctorId == + model.doctorProfile.doctorID, + onTap: () { + FocusScopeNode currentFocus = + FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + } + + Navigator.of(context).pushNamed( + PATIENTS_PROFILE, + arguments: { + "patient": model + .filteredInPatientItems[index], + "patientType": "1", + "from": "0", + "to": "0", + "isSearch": false, + "isInpatient": true, + "arrivalType": "1", + }); + }, + ); + else if (model.filteredInPatientItems[index] + .doctorId == + model.doctorProfile.doctorID && + widget.isMyInPatient) + return PatientCard( + patientInfo: + model.filteredInPatientItems[index], + patientType: "1", + arrivalType: "1", + isInpatient: true, + isMyPatient: model + .filteredInPatientItems[index] + .doctorId == + model.doctorProfile.doctorID, + onTap: () { + FocusScopeNode currentFocus = + FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + } + + Navigator.of(context).pushNamed( + PATIENTS_PROFILE, + arguments: { + "patient": model + .filteredInPatientItems[index], + "patientType": "1", + "from": "0", + "to": "0", + "isSearch": false, + "isInpatient": true, + "arrivalType": "1", + }); + }, + ); + else + return SizedBox(); + }), + SizedBox( + height: 15, + ) + ], + ), + ), + ), + ) + : Expanded( + child: SingleChildScrollView( + child: Container( + child: ErrorMessage( + error: + TranslationBase.of(context).noDataAvailable)), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/screens/patients/PatientsInPatientScreen.dart b/lib/screens/patients/PatientsInPatientScreen.dart index 7d41b3cb..6f2bafd9 100644 --- a/lib/screens/patients/PatientsInPatientScreen.dart +++ b/lib/screens/patients/PatientsInPatientScreen.dart @@ -1,44 +1,55 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/model/PatientSearchRequestModel.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.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/patients/PatientCard.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'; -import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; -import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; import 'package:flutter/material.dart'; -import '../../routes.dart'; +import 'DischargedPatientPage.dart'; +import 'InPatientPage.dart'; class PatientInPatientScreen extends StatefulWidget { @override _PatientInPatientScreenState createState() => _PatientInPatientScreenState(); } -class _PatientInPatientScreenState extends State { - PatientSearchRequestModel requestModel = PatientSearchRequestModel(); +class _PatientInPatientScreenState extends State with SingleTickerProviderStateMixin{ + + TabController _tabController; int _activeTab = 0; - TextEditingController _searchController = TextEditingController(); + @override + void initState() { + super.initState(); + _tabController = TabController(length: 3, vsync: this); + _tabController.addListener(_handleTabSelection); + } @override void dispose() { - _searchController.dispose(); super.dispose(); + _tabController.dispose(); + } + + _handleTabSelection() { + setState(() { + _activeTab = _tabController.index; + }); } @override Widget build(BuildContext context) { final screenSize = MediaQuery.of(context).size; + PatientSearchRequestModel requestModel = PatientSearchRequestModel(); return BaseView( - onModelReady: (model) => model.getInPatientList(requestModel), + onModelReady: (model) async { + model.clearPatientList(); + model.getInPatientList(requestModel); + }, builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: false, @@ -71,168 +82,107 @@ class _PatientInPatientScreenState extends State { ]), ), ), - tabsBar(context, screenSize, model), - Container( - margin: EdgeInsets.all(16.0), - child: AppTextFieldCustom( - hintText: TranslationBase.of(context) - .searchPatientName, - isTextFieldHasSuffix: true, - suffixIcon: IconButton( - icon: Icon( - Icons.search, - color: Colors.black, - ), - onPressed: () {}, - ), - controller: _searchController, - onChanged: (value) { - model.filterSearchResults(value); - }), - ), - model.filteredInPatientItems.length > 0 - ? Expanded( - child: Container( - margin: EdgeInsets.symmetric(horizontal: 16.0), - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // const SizedBox( - // height: 16, - // ), - ...List.generate(model.filteredInPatientItems.length, (index) { - if(_activeTab == 0) - return PatientCard( - patientInfo: model.filteredInPatientItems[index], - patientType: "1", - arrivalType: "1", - isInpatient: true, - isMyPatient: model.filteredInPatientItems[index].doctorId==model.doctorProfile.doctorID, - onTap: () { - FocusScopeNode currentFocus = FocusScope.of(context); - if (!currentFocus.hasPrimaryFocus) { - currentFocus.unfocus(); - } - - Navigator.of(context) - .pushNamed(PATIENTS_PROFILE, arguments: { - "patient": model.filteredInPatientItems[index], - "patientType": "1", - "from": "0", - "to": "0", - "isSearch": false, - "isInpatient": true, - "arrivalType": "1", - }); - }, - ); - else if(model.filteredInPatientItems[index].doctorId==model.doctorProfile.doctorID && _activeTab==1) - return PatientCard( - patientInfo: model.filteredInPatientItems[index], - patientType: "1", - arrivalType: "1", - isInpatient: true, - isMyPatient: model.filteredInPatientItems[index].doctorId==model.doctorProfile.doctorID, - onTap: () { - FocusScopeNode currentFocus = FocusScope.of(context); - if (!currentFocus.hasPrimaryFocus) { - currentFocus.unfocus(); - } - - Navigator.of(context) - .pushNamed(PATIENTS_PROFILE, arguments: { - "patient": model.filteredInPatientItems[index], - "patientType": "1", - "from": "0", - "to": "0", - "isSearch": false, - "isInpatient": true, - "arrivalType": "1", - }); - }, - ); - else return SizedBox(); - }), - SizedBox(height: 15,) - ], + Expanded( + child: Scaffold( + extendBodyBehindAppBar: true, + appBar: PreferredSize( + preferredSize: Size.fromHeight(MediaQuery.of(context).size.height * 0.070), + child: Container( + height: MediaQuery.of(context).size.height * 0.070, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Theme.of(context).dividerColor, + width: 0.5), //width: 0.7 ), + color: Colors.white), + child: Center( + child: TabBar( + isScrollable: false, + controller: _tabController, + indicatorColor: Colors.transparent, + indicatorWeight: 1.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Theme.of(context).primaryColor, + labelPadding: EdgeInsets.only(top: 0, left:0, right: 0,bottom: 0), + unselectedLabelColor: Colors.grey[800], + tabs: [ + tabWidget(screenSize, _activeTab == 0, TranslationBase.of(context).inPatientAll, counter: model.inPatientList.length), + tabWidget(screenSize, _activeTab == 1, TranslationBase.of(context).inPatient, counter: model.myIinPatientList.length), + tabWidget(screenSize, _activeTab == 2, TranslationBase.of(context).discharged), + ], ), ), - ) - : Expanded( - child: SingleChildScrollView( - child: Container( - child: ErrorMessage( - error: TranslationBase.of(context).noDataAvailable)), ), ), + body: Column( + children: [ + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + InPatientPage(false), + InPatientPage(true), + DischargedPatient(), + ], + ), + ), + ], + ), + ), + ), ], ), ), ); } - Widget tabsBar( - BuildContext context, Size screenSize, PatientSearchViewModel model) { - List _tabs = [ - TranslationBase.of(context).inPatientAll.toUpperCase(), - TranslationBase.of(context).inPatient.toUpperCase(), - ]; - - return Container( - height: screenSize.height * 0.070, - decoration: TextFieldsUtils.containerBorderDecoration( - Color(0Xffffffff), Color(0xFFCCCCCC), - borderRadius: 4, borderWidth: 0), - child: Row( - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.center, - children: _tabs.map((item) { - bool _isActive = _tabs[_activeTab] == item ? true : false; + Widget tabWidget(Size screenSize, bool isActive, String title, {int counter = -1}){ - return Expanded( - child: InkWell( - onTap: () async { - setState(() { - _activeTab = _tabs.indexOf(item); - }); - FocusScopeNode currentFocus = FocusScope.of(context); - if (!currentFocus.hasPrimaryFocus) { - currentFocus.unfocus(); - } - if (_activeTab==0) { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getInPatientList(requestModel, - isMyInpatient: _activeTab == 1, isFirstTime: false); - GifLoaderDialogUtils.hideDialog( - context); - } - }, - child: Center( - child: Container( - height: screenSize.height * 0.070, - decoration: TextFieldsUtils.containerBorderDecoration( - _isActive - ? Color(0xFFD02127 /*B8382B*/) - : Color(0xFFEAEAEA), - _isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA), - borderRadius: 4, - borderWidth: 0), - child: Center( + return Center( + child: Container( + height: screenSize.height * 0.070, + decoration: TextFieldsUtils.containerBorderDecoration( + isActive + ? Color(0xFFD02127 /*B8382B*/) + : Color(0xFFEAEAEA), + isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA), + borderRadius: 4, + borderWidth: 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppText( + title, + fontSize: SizeConfig.textMultiplier * 1.6, + color: isActive ? Colors.white : Color(0xFF2B353E), + fontWeight: FontWeight.w700, + ), + if (counter != -1) + Container( + margin: EdgeInsets.all(4), + width: 15, + height: 15, + decoration: BoxDecoration( + color: isActive + ? Colors.white + : Color(0xFFD02127), + shape: BoxShape.circle, + ), + child: Center( + child: FittedBox( child: AppText( - item, - fontSize: SizeConfig.textMultiplier * 1.8, - color: _isActive ? Colors.white : Color(0xFF2B353E), + "$counter", + fontSize: SizeConfig.textMultiplier * 1.5, + color: !isActive ? Colors.white : Color(0xFFD02127), fontWeight: FontWeight.w700, ), ), ), ), - ), - ); - }).toList(), + ], + ), ), ); } diff --git a/lib/screens/patients/ReferralDischargedPatientPage.dart b/lib/screens/patients/ReferralDischargedPatientPage.dart index 6da969d1..b9860af8 100644 --- a/lib/screens/patients/ReferralDischargedPatientPage.dart +++ b/lib/screens/patients/ReferralDischargedPatientPage.dart @@ -25,7 +25,7 @@ class _ReferralDischargedPatientPageState extends State AppScaffold( appBarTitle: 'Referral Discharged ', backgroundColor: Colors.grey[200], - isShowAppBar: true, + isShowAppBar: false, baseViewModel: model, body: model.myDischargeReferralPatient.isEmpty?Center( child: Column( diff --git a/lib/screens/patients/profile/profile_screen/PatientProfileCardModel.dart b/lib/screens/patients/profile/profile_screen/PatientProfileCardModel.dart new file mode 100644 index 00000000..3b566d81 --- /dev/null +++ b/lib/screens/patients/profile/profile_screen/PatientProfileCardModel.dart @@ -0,0 +1,25 @@ +class PatientProfileCardModel { + final String nameLine1; + final String nameLine2; + final dynamic route; + final String icon; + final bool isInPatient; + final bool isDisable; + final bool isLoading; + final Function onTap; + final bool isDischargedPatient; + final bool isSelectInpatient; + + PatientProfileCardModel( + this.nameLine1, + this.nameLine2, + this.route, + this.icon, { + this.isInPatient = false, + this.isDisable = false, + this.isLoading = false, + this.onTap, + this.isDischargedPatient = false, + this.isSelectInpatient = false, + }); +} diff --git a/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart b/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart index 59b3dd2f..1df7d236 100644 --- a/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart +++ b/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart @@ -1,7 +1,9 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/PatientProfileCardModel.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; import '../../../../routes.dart'; @@ -17,252 +19,135 @@ class ProfileGridForInPatient extends StatelessWidget { String from; String to; - ProfileGridForInPatient( + ProfileGridForInPatient( {Key key, this.patient, this.patientType, this.arrivalType, this.height, - this.isInpatient, this.from,this.to, this.isDischargedPatient, this.isFromSearch}) + this.isInpatient, + this.from, + this.to, + this.isDischargedPatient, + this.isFromSearch}) : super(key: key); @override Widget build(BuildContext context) { + final List cardsList = [ + PatientProfileCardModel( + TranslationBase.of(context).vital, + TranslationBase.of(context).signs, + VITAL_SIGN_DETAILS, + 'patient/vital_signs.png', + isInPatient: isInpatient), + PatientProfileCardModel( + TranslationBase.of(context).lab, + TranslationBase.of(context).result, + LAB_RESULT, + 'patient/lab_results.png', + isInPatient: isInpatient), + PatientProfileCardModel( + TranslationBase.of(context).radiology, + TranslationBase.of(context).result, + RADIOLOGY_PATIENT, + 'patient/health_summary.png', + isInPatient: isInpatient), + PatientProfileCardModel( + TranslationBase.of(context).patient, + TranslationBase.of(context).prescription, + ORDER_PRESCRIPTION_NEW, + 'patient/order_prescription.png', + isInPatient: isInpatient), + PatientProfileCardModel( + TranslationBase.of(context).progress, + TranslationBase.of(context).note, + PROGRESS_NOTE, + 'patient/Progress_notes.png', + isInPatient: isInpatient, + isDischargedPatient: isDischargedPatient), + PatientProfileCardModel( + TranslationBase.of(context).order, + TranslationBase.of(context).sheet, + ORDER_NOTE, + 'patient/Progress_notes.png', + isInPatient: isInpatient, + isDischargedPatient: isDischargedPatient), + PatientProfileCardModel( + TranslationBase.of(context).orders, + TranslationBase.of(context).procedures, + ORDER_PROCEDURE, + 'patient/Order_Procedures.png', + isInPatient: isInpatient), + PatientProfileCardModel( + TranslationBase.of(context).health, + TranslationBase.of(context).summary, + HEALTH_SUMMARY, + 'patient/health_summary.png', + isInPatient: isInpatient), + PatientProfileCardModel( + TranslationBase.of(context).medical, + TranslationBase.of(context).report, + HEALTH_SUMMARY, + 'patient/health_summary.png', + isInPatient: isInpatient, + isDisable: true), + PatientProfileCardModel( + TranslationBase.of(context).referral, + TranslationBase.of(context).patient, + REFER_IN_PATIENT_TO_DOCTOR, + 'patient/refer_patient.png', + isInPatient: isInpatient, + isDisable: isDischargedPatient || isFromSearch, + ), + PatientProfileCardModel( + TranslationBase.of(context).insurance, + TranslationBase.of(context).approvals, + PATIENT_INSURANCE_APPROVALS_NEW, + 'patient/vital_signs.png', + isInPatient: isInpatient), + PatientProfileCardModel( + TranslationBase.of(context).discharge, + TranslationBase.of(context).report, + null, + 'patient/patient_sick_leave.png', + isInPatient: isInpatient, + isDisable: true), + PatientProfileCardModel( + TranslationBase.of(context).patientSick, + TranslationBase.of(context).leave, + ADD_SICKLEAVE, + 'patient/patient_sick_leave.png', + isInPatient: isInpatient, + ), + ]; + return Padding( - padding: - const EdgeInsets.symmetric( - vertical: 15.0, - horizontal: 15), - child: GridView.count( + padding: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 15), + child: StaggeredGridView.countBuilder( shrinkWrap: true, - physics: - NeverScrollableScrollPhysics(), + physics: NeverScrollableScrollPhysics(), crossAxisSpacing: 10, mainAxisSpacing: 10, - childAspectRatio: 1 / 1.0, crossAxisCount: 3, - children: [ - PatientProfileButton( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - from: from, - to: to, - nameLine1: - TranslationBase - .of( - context) - .vital, - nameLine2: - TranslationBase - .of( - context) - .signs, - route: VITAL_SIGN_DETAILS, - isInPatient: true, - icon: - 'patient/vital_signs.png'), - PatientProfileButton( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: LAB_RESULT, - isInPatient: true, - nameLine1: - TranslationBase - .of( - context) - .lab, - nameLine2: - TranslationBase - .of( - context) - .result, - icon: - 'patient/lab_results.png'), - PatientProfileButton( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - isInPatient: isInpatient, - route: RADIOLOGY_PATIENT, - nameLine1: - TranslationBase - .of( - context) - .radiology, - nameLine2: - TranslationBase - .of( - context) - .result, - icon: - 'patient/health_summary.png'), - PatientProfileButton( - patient: patient, - isInPatient: isInpatient, - patientType: patientType, - arrivalType: arrivalType, - route: - ORDER_PRESCRIPTION_NEW, - isSelectInpatient: true, - nameLine1: - TranslationBase - .of( - context) - .patient, - nameLine2: - TranslationBase - .of( - context) - .prescription, - icon: - 'patient/order_prescription.png'), - PatientProfileButton( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: PROGRESS_NOTE, - isInPatient: isInpatient, - isDischargedPatient: - isDischargedPatient, - nameLine1: - TranslationBase - .of( - context) - .progress, - nameLine2: - TranslationBase - .of( - context) - .note, - icon: - 'patient/Progress_notes.png'), - PatientProfileButton( - patient: patient, - isInPatient: isInpatient, - patientType: patientType, - arrivalType: arrivalType, - route: ORDER_NOTE, - isDischargedPatient: - isDischargedPatient, - nameLine1:TranslationBase.of(context).order, - nameLine2: - TranslationBase.of(context).sheet, - icon: - 'patient/Progress_notes.png'), - PatientProfileButton( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: ORDER_PROCEDURE, - isInPatient: isInpatient, - nameLine1: - TranslationBase - .of( - context) - .orders, - nameLine2: - TranslationBase - .of( - context) - .procedures, - icon: - 'patient/Order_Procedures.png'), - PatientProfileButton( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: HEALTH_SUMMARY, - nameLine1: TranslationBase.of(context).health, - nameLine2: TranslationBase.of(context).summary, - isInPatient: isInpatient, - - icon: - 'patient/health_summary.png'), - PatientProfileButton( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - isDisable: true, - route: HEALTH_SUMMARY, - nameLine1: - TranslationBase.of(context).medical, - nameLine2: - TranslationBase.of(context).report, - isInPatient: isInpatient, - icon: - 'patient/health_summary.png'), - PatientProfileButton( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: - REFER_IN_PATIENT_TO_DOCTOR, - isInPatient: true, - isDisable: - isDischargedPatient || - isFromSearch, - nameLine1: - TranslationBase - .of( - context) - .referral, - nameLine2: - TranslationBase - .of( - context) - .patient, - icon: - 'patient/refer_patient.png'), - PatientProfileButton( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: - PATIENT_INSURANCE_APPROVALS_NEW, - nameLine1: - TranslationBase - .of( - context) - .insurance, - nameLine2: - TranslationBase - .of( - context) - .approvals, - icon: - 'patient/vital_signs.png'), - PatientProfileButton( - isInPatient: isInpatient, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - isDisable: true, - route: null, - nameLine1: TranslationBase.of(context).discharge, - nameLine2: TranslationBase.of(context).report, - icon: - 'patient/patient_sick_leave.png'), - PatientProfileButton( - isInPatient: isInpatient, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: ADD_SICKLEAVE, - nameLine1: - TranslationBase - .of( - context) - .patientSick, - nameLine2: - TranslationBase - .of( - context) - .leave, - icon: - 'patient/patient_sick_leave.png'), - ], + itemCount: cardsList.length, + staggeredTileBuilder: (int index) => StaggeredTile.fit(1), + itemBuilder: (BuildContext context, int index) => PatientProfileButton( + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + from: from, + to: to, + nameLine1: cardsList[index].nameLine1, + nameLine2: cardsList[index].nameLine2, + route: cardsList[index].route, + icon: cardsList[index].icon, + isInPatient: cardsList[index].isInPatient, + isDischargedPatient: cardsList[index].isDischargedPatient, + isDisable: cardsList[index].isDisable, + onTap: cardsList[index].onTap, + isLoading: cardsList[index].isLoading, + ), ), ); } diff --git a/lib/screens/patients/profile/referral/patient_referral_screen.dart b/lib/screens/patients/profile/referral/patient_referral_screen.dart index 6b7f448b..c5aaed7a 100644 --- a/lib/screens/patients/profile/referral/patient_referral_screen.dart +++ b/lib/screens/patients/profile/referral/patient_referral_screen.dart @@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils. import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import '../../ReferralDischargedPatientPage.dart'; import 'my-referral-inpatient-screen.dart'; class PatientReferralScreen extends StatefulWidget { @@ -24,7 +25,7 @@ class _PatientReferralScreen extends State with SingleTic @override void initState() { super.initState(); - _tabController = TabController(length: 2, vsync: this); + _tabController = TabController(length: 3, vsync: this); _tabController.addListener(_handleTabSelection); } @@ -74,7 +75,7 @@ class _PatientReferralScreen extends State with SingleTic unselectedLabelColor: Colors.grey[800], tabs: [ Container( - width: MediaQuery.of(context).size.width * 0.50, + width: MediaQuery.of(context).size.width * 0.33, height: MediaQuery.of(context).size.height * 0.070, decoration: TextFieldsUtils.containerBorderDecoration( Color(0Xffffffff), Color(0xFFCCCCCC), @@ -101,7 +102,7 @@ class _PatientReferralScreen extends State with SingleTic ), ), Container( - width: MediaQuery.of(context).size.width * 0.50, + width: MediaQuery.of(context).size.width * 0.34, height: MediaQuery.of(context).size.height * 0.070, decoration: TextFieldsUtils.containerBorderDecoration( Color(0Xffffffff), Color(0xFFCCCCCC), @@ -127,6 +128,33 @@ class _PatientReferralScreen extends State with SingleTic ), ), ), + Container( + width: MediaQuery.of(context).size.width * 0.33, + height: MediaQuery.of(context).size.height * 0.070, + decoration: TextFieldsUtils.containerBorderDecoration( + Color(0Xffffffff), Color(0xFFCCCCCC), + borderRadius: 4, borderWidth: 0), + child: Center( + child: Container( + height: MediaQuery.of(context).size.height * 0.070, + decoration: TextFieldsUtils.containerBorderDecoration( + index == 2 + ? Color(0xFFD02127 ) + : Color(0xFFEAEAEA), + index == 2 ? Color(0xFFD02127) : Color(0xFFEAEAEA), + borderRadius: 4, + borderWidth: 0), + child: Center( + child: AppText( + 'Discharged', + fontSize: SizeConfig.textMultiplier * 1.8, + color: index == 2 ? Colors.white : Color(0xFF2B353E), + fontWeight: FontWeight.w700, + ), + ), + ), + ), + ), ], ), @@ -143,6 +171,7 @@ class _PatientReferralScreen extends State with SingleTic children: [ ReferredPatientScreen(), MyReferralInPatientScreen(), + ReferralDischargedPatientPage() // MyReferredPatient(), ], ), diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 8bf49397..f42437c2 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1301,8 +1301,8 @@ class TranslationBase { String get insurance22 => localizedValues["insurance22"][locale.languageCode]; String get approvals22 => localizedValues["approvals22"][locale.languageCode]; String get severe => localizedValues["severe"][locale.languageCode]; - String get graphDetails => - localizedValues["graphDetails"][locale.languageCode]; + String get graphDetails => localizedValues["graphDetails"][locale.languageCode]; + String get discharged => localizedValues["discharged"][locale.languageCode]; String get addNewOrderSheet => localizedValues["addNewOrderSheet"][locale.languageCode]; String get addNewProgressNote => diff --git a/lib/widgets/patients/PatientCard.dart b/lib/widgets/patients/PatientCard.dart index aa6f114f..e02ebb5b 100644 --- a/lib/widgets/patients/PatientCard.dart +++ b/lib/widgets/patients/PatientCard.dart @@ -6,6 +6,7 @@ import 'package:doctor_app_flutter/util/date-utils.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/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; @@ -32,36 +33,22 @@ class PatientCard extends StatelessWidget { return Container( width: SizeConfig.screenWidth * 0.9, margin: EdgeInsets.all(6), - padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5), + padding: EdgeInsets.only(left: 0, right: 5, bottom: 0, top: 0), decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), + borderRadius: BorderRadius.circular(10), color: Colors.white, ), - child: Stack(children: [ - if (!isInpatient&& !isMyPatient && !isFromSearch) - Container( - height: 160, - width: 5, - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10), - bottomLeft: Radius.circular(10)), - color: patientInfo.patientStatusType == 43 - ? Colors.green[500] - : Colors.red[800], - )), - if(isMyPatient && !isFromSearch) - Container( - height: 180, - width: 5, - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10), - bottomLeft: Radius.circular(10)), - color: Colors.green[500] - )), - Container( - padding: EdgeInsets.only(left: 10, right: 0, bottom: 0), + child: CardWithBgWidget( + padding: 0, + marginLeft: (!isMyPatient && isInpatient)?0:10, + marginSymmetric:isFromSearch ? 10 : 0.0, + hasBorder: false, + bgColor:(isMyPatient && !isFromSearch)?Colors.green[500]: patientInfo.patientStatusType == 43 + ? Colors.green[500] + :isMyPatient? Colors.green[500]:isInpatient?Colors.white:!isFromSearch?Colors.red[800]:Colors.white, + widget: Container( + color: Colors.white, + // padding: EdgeInsets.only(left: 10, right: 0, bottom: 0), child: InkWell( child: Column( children: [ @@ -82,7 +69,7 @@ class PatientCard extends StatelessWidget { color: Colors.green, fontWeight: FontWeight.bold, fontFamily: 'Poppins', - fontSize: 12, + fontSize: 10, ), SizedBox(width: 8,), SizedBox(height: 12,width: 1.5,child: Container(color: Colors.grey,),), @@ -92,7 +79,7 @@ class PatientCard extends StatelessWidget { color: patientInfo.status==2? Colors.green:Colors.grey , fontWeight: FontWeight.bold, fontFamily: 'Poppins', - fontSize: 12, + fontSize: 10, ), ], ) @@ -103,7 +90,7 @@ class PatientCard extends StatelessWidget { color: Colors.red[800], fontWeight: FontWeight.bold, fontFamily: 'Poppins', - fontSize: 12, + fontSize: 10, ), SizedBox(width: 8,), SizedBox(height: 12,width: 1.5,child: Container(color: Colors.grey,),), @@ -113,7 +100,7 @@ class PatientCard extends StatelessWidget { color: patientInfo.status==2? Colors.green:Colors.grey , fontWeight: FontWeight.bold, fontFamily: 'Poppins', - fontSize: 12, + fontSize: 10, ), ], ): !isFromSearch && patientInfo.patientStatusType==null ? Row( @@ -151,14 +138,15 @@ class PatientCard extends StatelessWidget { )+" "+ "${DateUtils.getStartTime(patientInfo.startTime)}", fontFamily: 'Poppins', fontWeight: FontWeight.w400, + fontSize: 15, ) : (patientInfo.appointmentDate != null && patientInfo.appointmentDate.isNotEmpty)? AppText( - // - // )+" "+ DateUtils.getTimeHHMMA(DateUtils.convertStringToDate(patientInfo.appointmentDate,)), - " ${DateUtils.getDayMonthYearDate(DateUtils.convertStringToDate(patientInfo.appointmentDate,))} ${DateUtils.getStartTime(patientInfo.startTime)}", + + "${DateUtils.getDayMonthYearDate(DateUtils.convertStringToDate(patientInfo.appointmentDate,))} ${DateUtils.getStartTime(patientInfo.startTime)}", fontFamily: 'Poppins', fontWeight: FontWeight.w400, + fontSize: 15, ):SizedBox() ], )) @@ -181,29 +169,31 @@ class PatientCard extends StatelessWidget { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row(children: [ - Container( - width: 170, - child: AppText( - (Helpers.capitalize(patientInfo.firstName) + - " " + - Helpers.capitalize(patientInfo.lastName)), - fontSize: 16, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - textOverflow: TextOverflow.ellipsis, + Expanded( + child: Row(children: [ + Expanded( + // width: MediaQuery.of(context).size.width*0.51, + child: AppText( + (Helpers.capitalize(patientInfo.firstName) + + " " + + Helpers.capitalize(patientInfo.lastName)), + fontSize: 16, + color: Color(0xff2e303a), + fontWeight: FontWeight.w700, + fontFamily: 'Poppins', + textOverflow: TextOverflow.ellipsis, + ), ), - ), - patientInfo.gender == 1 - ? Icon( - DoctorApp.male_2, - color: Colors.blue, - ) - : Icon( - DoctorApp.female_1, - color: Colors.pink, - ), - ]), + if (patientInfo.gender == 1) + Icon( + DoctorApp.male_2, + color: Colors.blue, + ) else Icon( + DoctorApp.female_1, + color: Colors.pink, + ), + ]), + ), Row( children: [ AppText( @@ -280,14 +270,14 @@ class PatientCard extends StatelessWidget { text: TranslationBase.of(context) .fileNumber, style: TextStyle( - fontSize: 14, + fontSize: 12, fontFamily: 'Poppins')), new TextSpan( text: patientInfo.patientId.toString(), style: TextStyle( fontWeight: FontWeight.w700, fontFamily: 'Poppins', - fontSize: 15)), + fontSize: 13)), ], ), ), @@ -306,13 +296,13 @@ class PatientCard extends StatelessWidget { text: TranslationBase.of(context).age + " : ", - style: TextStyle(fontSize: 14)), + style: TextStyle(fontSize: 12)), new TextSpan( text: "${DateUtils.getAgeByBirthday(patientInfo.dateofBirth, context)}", style: TextStyle( fontWeight: FontWeight.w700, - fontSize: 15)), + fontSize: 13)), ], ), ), @@ -334,28 +324,35 @@ class PatientCard extends StatelessWidget { : TranslationBase.of(context) .admissionDate + " : ", - style: TextStyle(fontSize: 14)), + style: TextStyle(fontSize: 12)), new TextSpan( text: patientInfo.admissionDate == null ? "" : "${DateUtils.convertDateFromServerFormat(patientInfo.admissionDate.toString(), 'yyyy-MM-dd')}", style: TextStyle( fontWeight: FontWeight.w700, - fontSize: 15)), + fontSize: 13)), ]))), if (patientInfo.admissionDate != null) - Row( - children: [ - AppText( - "${TranslationBase.of(context).numOfDays}: ", - fontSize: 15, - ), - AppText( - "${DateTime.now().difference(DateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}", - fontSize: 15, - fontWeight: FontWeight.w700), - ], - ), + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: + 2.0 * SizeConfig.textMultiplier, + color: Colors.black, + fontFamily: 'Poppins', + ), + children: [ + new TextSpan( + text: TranslationBase.of(context).numOfDays + " : ", + style: TextStyle(fontSize: 12)), + new TextSpan( + text: "${DateTime.now().difference(DateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}", + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 13)), + ]))), ])) ]), @@ -395,7 +392,7 @@ class PatientCard extends StatelessWidget { ), onTap: onTap, )), - ])); + )); } diff --git a/lib/widgets/patients/profile/PatientProfileButton.dart b/lib/widgets/patients/profile/PatientProfileButton.dart index f7c60623..0c2fd2f9 100644 --- a/lib/widgets/patients/profile/PatientProfileButton.dart +++ b/lib/widgets/patients/profile/PatientProfileButton.dart @@ -24,31 +24,33 @@ class PatientProfileButton extends StatelessWidget { final Function onTap; final bool isDischargedPatient; final bool isSelectInpatient; - PatientProfileButton( - {Key key, - this.patient, - this.patientType, - this.arrivalType, - this.nameLine1, - this.nameLine2, - this.icon, - this.route, - this.isDisable = false, - this.onTap, - this.isLoading = false, - this.from, - this.to, - this.isInPatient = false, this.isDischargedPatient=false, this.isSelectInpatient = false, - }) - : super(key: key); + + PatientProfileButton({ + Key key, + this.patient, + this.patientType, + this.arrivalType, + this.nameLine1, + this.nameLine2, + this.icon, + this.route, + this.isDisable = false, + this.onTap, + this.isLoading = false, + this.from, + this.to, + this.isInPatient = false, + this.isDischargedPatient = false, + this.isSelectInpatient = false, + }) : super(key: key); @override Widget build(BuildContext context) { ProjectViewModel projectsProvider = Provider.of(context); - return new Container( - margin: new EdgeInsets.symmetric(horizontal: 4.0), - padding: EdgeInsets.fromLTRB(10, 10, 10, 5), + return Container( + margin: EdgeInsets.symmetric(horizontal: 0.0), + padding: EdgeInsets.symmetric(horizontal: 8, vertical: 16), child: InkWell( onTap: isDisable ? null @@ -59,25 +61,30 @@ class PatientProfileButton extends StatelessWidget { }, child: Column(children: [ Container( + padding: EdgeInsets.fromLTRB(8, 0, 8, 8), child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - child: new Image.asset( - url + icon, - width: 50, - height: 50, - ),) - ], - )), + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + child: new Image.asset( + url + icon, + width: 30, + height: 30, + fit: BoxFit.contain, + ), + ) + ], + )), Container( - alignment: projectsProvider.isArabic ? Alignment.topRight : Alignment.topLeft, - padding: EdgeInsets.all(5), + alignment: projectsProvider.isArabic + ? Alignment.topRight + : Alignment.topLeft, + padding: EdgeInsets.symmetric(horizontal: 8), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - !projectsProvider.isArabic?this.nameLine1: nameLine2, + !projectsProvider.isArabic ? this.nameLine1 : nameLine2, color: Colors.black, /*Color(0xFFB9382C),*/ fontWeight: FontWeight.w600, @@ -85,7 +92,7 @@ class PatientProfileButton extends StatelessWidget { fontSize: SizeConfig.textMultiplier * 1.5, ), AppText( - !projectsProvider.isArabic? this.nameLine2:nameLine1, + !projectsProvider.isArabic ? this.nameLine2 : nameLine1, color: Colors.black, fontWeight: FontWeight.w600, textAlign: TextAlign.left, @@ -118,8 +125,7 @@ class PatientProfileButton extends StatelessWidget { } void navigator(BuildContext context, route) { - if(route == null) - return; + if (route == null) return; if (from == null) { from = DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'); @@ -127,7 +133,7 @@ class PatientProfileButton extends StatelessWidget { if (to == null) { to = DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'); } - if(arrivalType == null){ + if (arrivalType == null) { arrivalType = "0"; } Navigator.of(context).pushNamed(route, arguments: { diff --git a/lib/widgets/shared/buttons/app_buttons_widget.dart b/lib/widgets/shared/buttons/app_buttons_widget.dart index 66aaac09..ed3e6e98 100644 --- a/lib/widgets/shared/buttons/app_buttons_widget.dart +++ b/lib/widgets/shared/buttons/app_buttons_widget.dart @@ -49,7 +49,7 @@ class _AppButtonState extends State { @override Widget build(BuildContext context) { return Container( - // height: 60,//MediaQuery.of(context).size.height * 0.075, + // height: MediaQuery.of(context).size.height * 0.075, child: IgnorePointer( ignoring: widget.loading ||widget.disabled, child: RawMaterialButton( diff --git a/lib/widgets/shared/card_with_bg_widget.dart b/lib/widgets/shared/card_with_bg_widget.dart index 3b65bba5..deeff358 100644 --- a/lib/widgets/shared/card_with_bg_widget.dart +++ b/lib/widgets/shared/card_with_bg_widget.dart @@ -3,27 +3,23 @@ import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; -/* - *@author: Mohammad Aljammal - *@Date:27/4/2020 - *@param: Widget - *@return: - *@desc: Card With Bg Widget - */ class CardWithBgWidget extends StatelessWidget { final Widget widget; final Color bgColor; final bool hasBorder; + final double padding; + final double marginLeft; + final double marginSymmetric; CardWithBgWidget( - {@required this.widget, this.bgColor, this.hasBorder = true}); + {@required this.widget, this.bgColor, this.hasBorder = true, this.padding = 15.0, this.marginLeft = 10.0, this.marginSymmetric=10.0}); @override Widget build(BuildContext context) { ProjectViewModel projectProvider = Provider.of(context); return Container( - margin: EdgeInsets.symmetric(vertical: 10.0), + margin: EdgeInsets.symmetric(vertical: marginSymmetric), // width: double.infinity, decoration: BoxDecoration( borderRadius: BorderRadius.all( @@ -61,15 +57,15 @@ class CardWithBgWidget extends StatelessWidget { borderRadius: BorderRadius.only( topLeft: Radius.circular(10), bottomLeft: Radius.circular(10),),), - width: 10, + width: 7, ), bottom: 1, top: 1, left: 1, ), Container( - padding: EdgeInsets.all(15.0), - margin: EdgeInsets.only(left: 10), + padding: EdgeInsets.all(padding), + margin: EdgeInsets.only(left: marginLeft), child: widget) ], ), diff --git a/pubspec.lock b/pubspec.lock index e9386145..ee31002d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -445,6 +445,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.11" + flutter_staggered_grid_view: + dependency: "direct main" + description: + name: flutter_staggered_grid_view + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.4" flutter_svg: dependency: transitive description: @@ -566,7 +573,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.3-nullsafety.1" + version: "0.6.2" json_annotation: dependency: transitive description: @@ -608,7 +615,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.4" + version: "1.3.0-nullsafety.3" mime: dependency: transitive description: @@ -900,7 +907,7 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.2" + version: "1.10.0-nullsafety.1" sticky_headers: dependency: "direct main" description: @@ -1091,5 +1098,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.10.0 <=2.11.0-213.1.beta" + dart: ">=2.10.0 <2.11.0" flutter: ">=1.22.0 <2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 58dd50be..b4532e42 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -41,6 +41,7 @@ dependencies: eva_icons_flutter: ^2.0.0 font_awesome_flutter: ^8.11.0 dropdown_search: ^0.4.8 + flutter_staggered_grid_view: ^0.3.2 expandable: ^4.1.4