From 9aae4b8650d1b2900d2f2234f0eea73b506098a7 Mon Sep 17 00:00:00 2001 From: Amjad Amireh Date: Wed, 27 May 2020 13:16:55 +0300 Subject: [PATCH 1/6] amjad modified to expand list --- lib/routes.dart | 5 ++ .../patients/patient_search_screen.dart | 18 ++++ .../patients/patients_referred_screen.dart | 20 +++++ lib/screens/patients/patients_screen.dart | 8 +- lib/widgets/patients/list_item.dart | 87 +++++++++++++++++++ 5 files changed, 134 insertions(+), 4 deletions(-) create mode 100644 lib/screens/patients/patients_referred_screen.dart create mode 100644 lib/widgets/patients/list_item.dart diff --git a/lib/routes.dart b/lib/routes.dart index f2f5f6bb..cb194c5b 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -1,3 +1,5 @@ + + import './screens/patients/profile/vital_sign/body_measurements_screen.dart'; import './screens/QR_reader_screen.dart'; @@ -13,6 +15,7 @@ import './screens/doctor/services_screen.dart'; import './screens/medicine/medicine_search_screen.dart'; import './screens/medicine/pharmacies_list_screen.dart'; import './screens/patients/patient_search_screen.dart'; +import './screens/patients/patients_referred_screen.dart'; import './screens/patients/patients_screen.dart'; import './screens/patients/profile/lab_result/lab_orders_screen.dart'; import './screens/patients/profile/patient_profile_screen.dart'; @@ -36,6 +39,7 @@ const String QR_READER = 'qr-reader'; const String PATIENT_SEARCH = 'patients/patient-search'; const String PATIENTS = 'patients/patients'; const String PATIENTS_PROFILE = 'patients/patients-profile'; +const String PATIENTS_REFERRED = 'patients/patients-referred'; const String BLOOD_BANK = 'blood-bank'; const String DOCTOR_REPLY = 'doctor-reply'; const String MEDICINE_SEARCH = 'medicine/medicine-search'; @@ -56,6 +60,7 @@ var routes = { PROFILE: (_) => ProfileScreen(), MY_SCHEDULE: (_) => MyScheduleScreen(), PATIENT_SEARCH: (_) => PatientSearchScreen(), + PATIENTS_REFERRED:(_)=>PatientReferredScreen(), PATIENTS: (_) => PatientsScreen(), QR_READER: (_) => QrReaderScreen(), BLOOD_BANK: (_) => BloodBankScreen(), diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index d5bfd7be..2eab35c1 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -58,7 +58,16 @@ class _PatientSearchScreenState extends State { PatientOutSA: false); void _validateInputs() async { + + if(_selectedType=='2') + { try { + + //==================== + //_selectedType=='3'? + //===================== + + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile); @@ -93,6 +102,15 @@ class _PatientSearchScreenState extends State { } catch (err) { handelCatchErrorCase(err); } + } + else + { + Navigator.of(context).pushNamed(PATIENTS_REFERRED, arguments: { + "patientSearchForm": _patientSearchFormValues, + "selectedType": _selectedType + }); + + } } handelCatchErrorCase(err) { diff --git a/lib/screens/patients/patients_referred_screen.dart b/lib/screens/patients/patients_referred_screen.dart new file mode 100644 index 00000000..c0ba5dfe --- /dev/null +++ b/lib/screens/patients/patients_referred_screen.dart @@ -0,0 +1,20 @@ +import 'package:flutter/material.dart'; + +class PatientReferredScreen extends StatefulWidget { + PatientReferredScreen({Key key}) : super(key: key); + + @override + _PatientReferredScreenState createState() => _PatientReferredScreenState(); +} + +class _PatientReferredScreenState extends State { + + String patientType; + String patientTypetitle; + @override + Widget build(BuildContext context) { + return Container( + child: Text("Refferrd Patiant"),//child, + ); + } +} \ No newline at end of file diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 68f01fd8..d945e38d 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -374,8 +374,7 @@ class _PatientsScreenState extends State { .start, children: [ Image.network( - "https://p.kindpng.com/picc/s/404-4042774_profile-photo-circle-circle-profile-picture-png-transparent.png", - + "https://p.kindpng.com/picc/s/404-4042774_profile-photo-circle-circle-profile-picture-png-transparent.png", height: 100, width: 100), ], @@ -472,8 +471,9 @@ class _PatientsScreenState extends State { ), ), SizedBox( - width:60, - ), + width: + 60, + ), Container( child: AppText( diff --git a/lib/widgets/patients/list_item.dart b/lib/widgets/patients/list_item.dart new file mode 100644 index 00000000..d400d3c4 --- /dev/null +++ b/lib/widgets/patients/list_item.dart @@ -0,0 +1,87 @@ +/* + *@author: Amjad Amireh + *@Date:27/5/2020 + *@param: + *@return:Create Expand list with snakebar notification + + *@desc: + */ + + +import 'package:flutter/material.dart'; + +class ListItem extends StatefulWidget{ + + ListlistItems; + String headerTitle; + + ListItem(this.headerTitle,this.listItems); + + @override + StatecreateState() + { + return ListItemState(); + } +} +class ListItemState extends State +{ + bool isExpand=false; + @override + void initState() { + // TODO: implement initState + super.initState(); + isExpand=false; + } + @override + Widget build(BuildContext context) { + ListlistItem=this.widget.listItems; + return Padding( + padding: (isExpand==true)?const EdgeInsets.all(8.0):const EdgeInsets.all(12.0), + child: Container( + decoration:BoxDecoration( + color: Colors.white, + borderRadius: (isExpand!=true)?BorderRadius.all(Radius.circular(8)):BorderRadius.all(Radius.circular(22)), + border: Border.all(color: Colors.white) + ), + child: ExpansionTile( + key: PageStorageKey(this.widget.headerTitle), + title: Container( + width: double.infinity, + + child: Text(this.widget.headerTitle,style: TextStyle(fontSize: (isExpand!=true)?18:22),)), + trailing: (isExpand==true)?Icon(Icons.keyboard_arrow_up,size: 32,color: Colors.black,):Icon(Icons.keyboard_arrow_down,size: 32,color: Colors.black), + onExpansionChanged: (value){ + setState(() { + isExpand=value; + }); + }, + children: [ + for(final item in listItem) + Padding( + padding: const EdgeInsets.all(8.0), + child: InkWell( + onTap: (){ + Scaffold.of(context).showSnackBar(SnackBar(backgroundColor: Colors.black,duration:Duration(microseconds: 500),content: Text("Selected Item $item "+this.widget.headerTitle ))); + }, + child: Container( + width: double.infinity, + decoration:BoxDecoration( + color: Colors.grey, + borderRadius: BorderRadius.all(Radius.circular(4)), + border: Border.all(color: Colors.grey) + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text(item,style: TextStyle(color: Colors.white),), + )), + ), + ) + + + ], + + ), + ), + ); + } +} \ No newline at end of file From f41da183fb2c880e234d3163171b3d81a63065fc Mon Sep 17 00:00:00 2001 From: Amjad Amireh Date: Wed, 27 May 2020 14:47:39 +0300 Subject: [PATCH 2/6] fix --- lib/routes.dart | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/routes.dart b/lib/routes.dart index 048f9ecd..9c87ff2f 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -1,11 +1,8 @@ -<<<<<<< HEAD -======= import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/screens/patients/profile/insurance_approvals_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/patient_orders_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/progress_note_screen.dart'; ->>>>>>> 7f5831335b1fac9625ba368a5bca916aaa9b9d74 import './screens/patients/profile/vital_sign/body_measurements_screen.dart'; From 64f13bf8a7e584c79588557806a0ad128d37fafd Mon Sep 17 00:00:00 2001 From: Amjad Amireh Date: Wed, 27 May 2020 16:16:25 +0300 Subject: [PATCH 3/6] checkDate (today tommorow ,next week) --- lib/util/helpers.dart | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index 45ad043d..b8e86e16 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -165,6 +165,37 @@ class Helpers { ), ); } + /* + *@author: Amjad Amireh + *@Date:5/5/2020 + *@param: checkDate + *@return: DateTime + *@desc: convert String to DateTime + */ +static String checkDate(String dateString) { + DateTime checkedTime = DateTime.parse(dateString); + DateTime currentTime = DateTime.now(); + + if ((currentTime.year == checkedTime.year) && + (currentTime.month == checkedTime.month) && + (currentTime.day == checkedTime.day)) { + return "Today"; + } else if ((currentTime.year == checkedTime.year) && + (currentTime.month == checkedTime.month)) { + if ((currentTime.day - checkedTime.day) == 1) { + return "YESTERDAY"; + } else if ((currentTime.day - checkedTime.day) == -1) { + return "Tomorrow"; + } + + if ((currentTime.day - checkedTime.day) <= -2) { + return "Next Week"; + } else { + return "Old Date"; + } + } + return "Old Date"; + } /* *@author: Mohammad Aljammal @@ -268,6 +299,9 @@ class Helpers { return myWorkingHours; } + + + /* *@author: Elham Rababah *@Date:12/5/2020 From be603839168f0d88b7c00189ef66ce854a92eabd Mon Sep 17 00:00:00 2001 From: Amjad Amireh Date: Thu, 28 May 2020 11:19:17 +0300 Subject: [PATCH 4/6] ListItem Expand --- .../patients/patient_search_screen.dart | 6 +- .../patients/patients_referred_screen.dart | 85 ++++++++++++++++++- lib/widgets/patients/list_item.dart | 34 ++++---- 3 files changed, 105 insertions(+), 20 deletions(-) diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index 8b6467b1..2c0963cd 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -58,8 +58,8 @@ class _PatientSearchScreenState extends State { PatientOutSA: false); void _validateInputs() async { - - if(_selectedType=='2') +print("============== _selectedType============"+ _selectedType); + if(_selectedType!='3') { try { @@ -102,7 +102,7 @@ class _PatientSearchScreenState extends State { } catch (err) { handelCatchErrorCase(err); } - } + } else { Navigator.of(context).pushNamed(PATIENTS_REFERRED, arguments: { diff --git a/lib/screens/patients/patients_referred_screen.dart b/lib/screens/patients/patients_referred_screen.dart index c0ba5dfe..9b03adcb 100644 --- a/lib/screens/patients/patients_referred_screen.dart +++ b/lib/screens/patients/patients_referred_screen.dart @@ -1,3 +1,12 @@ +/* + *@author: Amjad Amireh Modified Referred Patients + *@Date:27/5/2020 + + + *@desc: + */ +import 'package:doctor_app_flutter/widgets/patients/list_item.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; class PatientReferredScreen extends StatefulWidget { @@ -11,10 +20,82 @@ class _PatientReferredScreenState extends State { String patientType; String patientTypetitle; + + List>list_product; + @override + void initState() { + super.initState(); + list_product=new List(); + for(var k=1;k<=5;k++) + { + Map map=Map(); + map.putIfAbsent(getName(k), ()=>getContent()); + list_product.add(map); + + } + list_product.map((s){ + + }).map((list)=>list).toList();} + + + @override Widget build(BuildContext context) { - return Container( - child: Text("Refferrd Patiant"),//child, + + Listlist=List(); + + return AppScaffold( + appBarTitle: "My Referred Patients",//patientTypetitle, + body: Center( + + child: ListView( + children: [ + for(final map in list_product) + for(final keys in map.keys) + ListItem(keys,map[keys].toList()) + , + ], + ) + ), + ); } + + + String getName(int month) + { + switch(month) + { + case 1: + return "Mahmoud Shrouf"; + case 2: + return "Mahmoud Shrouf"; + case 3: + return "Mahmoud Shrouf"; + case 4: + return "Mahmoud Shrouf"; + case 5: + return "Mahmoud Shrouf"; + case 6: + return "Mahmoud Shrouf"; + case 7: + return "Mahmoud Shrouf"; + case 8: + return "Mahmoud Shrouf"; + case 9: + return "Mahmoud Shrouf"; + case 10: + return "Mahmoud Shrouf"; + case 11: + return "Mahmoud Shrouf"; + case 12: + return "Mahmoud Shrouf"; + } + } + + List getContent() + { + + return ["1","2","3","4","5","6"].toList(); + } } \ No newline at end of file diff --git a/lib/widgets/patients/list_item.dart b/lib/widgets/patients/list_item.dart index d400d3c4..069e2fa5 100644 --- a/lib/widgets/patients/list_item.dart +++ b/lib/widgets/patients/list_item.dart @@ -1,13 +1,11 @@ /* *@author: Amjad Amireh *@Date:27/5/2020 - *@param: - *@return:Create Expand list with snakebar notification + *@param:listItems , headerTitle + *@return:ListItem Expand *@desc: */ - - import 'package:flutter/material.dart'; class ListItem extends StatefulWidget{ @@ -28,7 +26,6 @@ class ListItemState extends State bool isExpand=false; @override void initState() { - // TODO: implement initState super.initState(); isExpand=false; } @@ -40,16 +37,21 @@ class ListItemState extends State child: Container( decoration:BoxDecoration( color: Colors.white, - borderRadius: (isExpand!=true)?BorderRadius.all(Radius.circular(8)):BorderRadius.all(Radius.circular(22)), - border: Border.all(color: Colors.white) + borderRadius: (isExpand!=true)?BorderRadius.all(Radius.circular(50)):BorderRadius.all(Radius.circular(25)), + + + + + ), child: ExpansionTile( key: PageStorageKey(this.widget.headerTitle), title: Container( width: double.infinity, - - child: Text(this.widget.headerTitle,style: TextStyle(fontSize: (isExpand!=true)?18:22),)), - trailing: (isExpand==true)?Icon(Icons.keyboard_arrow_up,size: 32,color: Colors.black,):Icon(Icons.keyboard_arrow_down,size: 32,color: Colors.black), + + child: Text(this.widget.headerTitle,style: TextStyle(fontSize: (isExpand!=true)?18:22,color: Colors.black,fontWeight: FontWeight.bold),)), + + trailing: (isExpand==true)?Icon(Icons.keyboard_arrow_up,color: Colors.black,):Icon(Icons.keyboard_arrow_down,color: Colors.black), onExpansionChanged: (value){ setState(() { isExpand=value; @@ -61,18 +63,20 @@ class ListItemState extends State padding: const EdgeInsets.all(8.0), child: InkWell( onTap: (){ - Scaffold.of(context).showSnackBar(SnackBar(backgroundColor: Colors.black,duration:Duration(microseconds: 500),content: Text("Selected Item $item "+this.widget.headerTitle ))); + print(Text("Selected Item $item "+this.widget.headerTitle )); + //========Stop Snak bar=========== Scaffold.of(context).showSnackBar(SnackBar(backgroundColor: Colors.black,duration:Duration(microseconds: 500),content: Text("Selected Item $item "+this.widget.headerTitle ))); }, child: Container( width: double.infinity, decoration:BoxDecoration( - color: Colors.grey, - borderRadius: BorderRadius.all(Radius.circular(4)), - border: Border.all(color: Colors.grey) + color: Colors.white, + + border: Border(top: BorderSide(color: Theme.of(context).dividerColor)) ), child: Padding( padding: const EdgeInsets.all(8.0), - child: Text(item,style: TextStyle(color: Colors.white),), + child: Text(item,style: TextStyle(color: Colors.black),), + )), ), ) From fff2b32deec48c0269843f79e8fa8511b9d0822b Mon Sep 17 00:00:00 2001 From: Amjad Amireh Date: Thu, 28 May 2020 12:31:09 +0300 Subject: [PATCH 5/6] ExpandableItem widget --- .../patients/patients_referred_screen.dart | 5 +- .../shared/expandable_item_widget.dart | 91 +++++++++++++++++++ 2 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 lib/widgets/shared/expandable_item_widget.dart diff --git a/lib/screens/patients/patients_referred_screen.dart b/lib/screens/patients/patients_referred_screen.dart index 9b03adcb..70a84f03 100644 --- a/lib/screens/patients/patients_referred_screen.dart +++ b/lib/screens/patients/patients_referred_screen.dart @@ -5,8 +5,9 @@ *@desc: */ -import 'package:doctor_app_flutter/widgets/patients/list_item.dart'; + import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/expandable_item_widget.dart'; import 'package:flutter/material.dart'; class PatientReferredScreen extends StatefulWidget { @@ -52,7 +53,7 @@ class _PatientReferredScreenState extends State { children: [ for(final map in list_product) for(final keys in map.keys) - ListItem(keys,map[keys].toList()) + ExpandableItem(keys,map[keys].toList()) , ], ) diff --git a/lib/widgets/shared/expandable_item_widget.dart b/lib/widgets/shared/expandable_item_widget.dart new file mode 100644 index 00000000..d369e72a --- /dev/null +++ b/lib/widgets/shared/expandable_item_widget.dart @@ -0,0 +1,91 @@ +/* + *@author: Amjad Amireh + *@Date:27/5/2020 + *@param:listItems , headerTitle + *@return:ListItem Expand + + *@desc: + */ +import 'package:flutter/material.dart'; + +class ExpandableItem extends StatefulWidget{ + + final ListlistItems; + final String headerTitle; + + ExpandableItem(this.headerTitle,this.listItems); + + @override + _ExpandableItemState createState() => _ExpandableItemState(); + +} +class _ExpandableItemState extends State +{ + bool isExpand=false; + @override + void initState() { + super.initState(); + isExpand=false; + } + @override + Widget build(BuildContext context) { + ListlistItem=this.widget.listItems; + return Container( + child: Padding( + padding: (isExpand==true)?const EdgeInsets.all(6.0):const EdgeInsets.all(8.0), + child: Container( + decoration:BoxDecoration( + color: Colors.white, + borderRadius: (isExpand!=true)?BorderRadius.all(Radius.circular(50)):BorderRadius.all(Radius.circular(25)), + + + + + + ), + child: ExpansionTile( + key: PageStorageKey(this.widget.headerTitle), + title: Container( + width: double.infinity, + + child: Text(this.widget.headerTitle,style: TextStyle(fontSize: (isExpand!=true)?18:22,color: Colors.black,fontWeight: FontWeight.bold),)), + + trailing: (isExpand==true)?Icon(Icons.keyboard_arrow_up,color: Colors.black,):Icon(Icons.keyboard_arrow_down,color: Colors.black), + onExpansionChanged: (value){ + setState(() { + isExpand=value; + }); + }, + children: [ + for(final item in listItem) + Padding( + padding: const EdgeInsets.all(8.0), + child: InkWell( + onTap: (){ + print(Text("Selected Item $item "+this.widget.headerTitle )); + //========Stop Snak bar=========== Scaffold.of(context).showSnackBar(SnackBar(backgroundColor: Colors.black,duration:Duration(microseconds: 500),content: Text("Selected Item $item "+this.widget.headerTitle ))); + }, + child: Container( + width: double.infinity, + decoration:BoxDecoration( + color: Colors.white, + + border: Border(top: BorderSide(color: Theme.of(context).dividerColor)) + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text(item,style: TextStyle(color: Colors.black),), + + )), + ), + ) + + + ], + + ), + ), + ), + ); + } +} \ No newline at end of file From 903eaba132fab844ec8bdd4ee0e60f288293fc0a Mon Sep 17 00:00:00 2001 From: Amjad Amireh Date: Thu, 28 May 2020 12:34:10 +0300 Subject: [PATCH 6/6] deete --- lib/widgets/patients/list_item.dart | 91 ----------------------------- 1 file changed, 91 deletions(-) delete mode 100644 lib/widgets/patients/list_item.dart diff --git a/lib/widgets/patients/list_item.dart b/lib/widgets/patients/list_item.dart deleted file mode 100644 index 069e2fa5..00000000 --- a/lib/widgets/patients/list_item.dart +++ /dev/null @@ -1,91 +0,0 @@ -/* - *@author: Amjad Amireh - *@Date:27/5/2020 - *@param:listItems , headerTitle - *@return:ListItem Expand - - *@desc: - */ -import 'package:flutter/material.dart'; - -class ListItem extends StatefulWidget{ - - ListlistItems; - String headerTitle; - - ListItem(this.headerTitle,this.listItems); - - @override - StatecreateState() - { - return ListItemState(); - } -} -class ListItemState extends State -{ - bool isExpand=false; - @override - void initState() { - super.initState(); - isExpand=false; - } - @override - Widget build(BuildContext context) { - ListlistItem=this.widget.listItems; - return Padding( - padding: (isExpand==true)?const EdgeInsets.all(8.0):const EdgeInsets.all(12.0), - child: Container( - decoration:BoxDecoration( - color: Colors.white, - borderRadius: (isExpand!=true)?BorderRadius.all(Radius.circular(50)):BorderRadius.all(Radius.circular(25)), - - - - - - ), - child: ExpansionTile( - key: PageStorageKey(this.widget.headerTitle), - title: Container( - width: double.infinity, - - child: Text(this.widget.headerTitle,style: TextStyle(fontSize: (isExpand!=true)?18:22,color: Colors.black,fontWeight: FontWeight.bold),)), - - trailing: (isExpand==true)?Icon(Icons.keyboard_arrow_up,color: Colors.black,):Icon(Icons.keyboard_arrow_down,color: Colors.black), - onExpansionChanged: (value){ - setState(() { - isExpand=value; - }); - }, - children: [ - for(final item in listItem) - Padding( - padding: const EdgeInsets.all(8.0), - child: InkWell( - onTap: (){ - print(Text("Selected Item $item "+this.widget.headerTitle )); - //========Stop Snak bar=========== Scaffold.of(context).showSnackBar(SnackBar(backgroundColor: Colors.black,duration:Duration(microseconds: 500),content: Text("Selected Item $item "+this.widget.headerTitle ))); - }, - child: Container( - width: double.infinity, - decoration:BoxDecoration( - color: Colors.white, - - border: Border(top: BorderSide(color: Theme.of(context).dividerColor)) - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text(item,style: TextStyle(color: Colors.black),), - - )), - ), - ) - - - ], - - ), - ), - ); - } -} \ No newline at end of file