diff --git a/lib/models/RequestDoctorReply.dart b/lib/models/RequestDoctorReply.dart new file mode 100644 index 00000000..17e1e225 --- /dev/null +++ b/lib/models/RequestDoctorReply.dart @@ -0,0 +1,60 @@ +class RequestDoctorReply { + int projectID; + int doctorID; + int transactionNo; + int languageID; + String stamp; + String iPAdress; + double versionID; + int channel; + String tokenID; + String sessionID; + bool isLoginForDoctorApp; + bool patientOutSA; + + RequestDoctorReply( + {this.projectID = 15, + this.doctorID = 70907, + this.transactionNo = 0, + this.languageID = 2, + this.stamp = '2020-04-27T12:17:17.721Z', + this.iPAdress = '11.11.11.11', + this.versionID = 1.2, + this.channel = 9, + this.tokenID = '@dm!n', + this.sessionID = '2Z7FX4Lokp', + this.isLoginForDoctorApp = true, + this.patientOutSA = false}); + + RequestDoctorReply.fromJson(Map json) { + projectID = json['ProjectID']; + doctorID = json['DoctorID']; + transactionNo = json['TransactionNo']; + languageID = json['LanguageID']; + stamp = json['stamp']; + iPAdress = json['IPAdress']; + versionID = json['VersionID']; + channel = json['Channel']; + tokenID = json['TokenID']; + sessionID = json['SessionID']; + isLoginForDoctorApp = json['IsLoginForDoctorApp']; + patientOutSA = json['PatientOutSA']; + } + + Map toJson() { + final Map data = new Map(); + data['ProjectID'] = this.projectID; + data['DoctorID'] = this.doctorID; + data['TransactionNo'] = this.transactionNo; + data['LanguageID'] = this.languageID; + data['stamp'] = this.stamp; + data['IPAdress'] = this.iPAdress; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['TokenID'] = this.tokenID; + data['SessionID'] = this.sessionID; + data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + data['PatientOutSA'] = this.patientOutSA; + return data; + } +} diff --git a/lib/models/list_doctor_working_hours_table_model.dart b/lib/models/list_doctor_working_hours_table_model.dart index 4a46e925..d8ca8a04 100644 --- a/lib/models/list_doctor_working_hours_table_model.dart +++ b/lib/models/list_doctor_working_hours_table_model.dart @@ -6,7 +6,7 @@ class ListDoctorWorkingHoursTable { ListDoctorWorkingHoursTable({this.date, this.dayName, this.workingHours}); ListDoctorWorkingHoursTable.fromJson(Map json) { - date = json['Date']; + date = json['Date'] ; dayName = json['DayName']; workingHours = json['WorkingHours']; } diff --git a/lib/models/list_gt_my_pationents_question_model.dart b/lib/models/list_gt_my_pationents_question_model.dart new file mode 100644 index 00000000..8e7eac9c --- /dev/null +++ b/lib/models/list_gt_my_pationents_question_model.dart @@ -0,0 +1,108 @@ +class ListGtMyPatientsQuestions { + String setupID; + int projectID; + int transactionNo; + int patientType; + int patientID; + int doctorID; + int requestType; + String requestDate; + String requestTime; + String remarks; + int status; + int createdBy; + String createdOn; + int editedBy; + String editedOn; + String patientName; + String patientNameN; + int gender; + String dateofBirth; + String mobileNumber; + String emailAddress; + String age; + String genderDescription; + bool isVidaCall; + + ListGtMyPatientsQuestions( + {this.setupID, + this.projectID, + this.transactionNo, + this.patientType, + this.patientID, + this.doctorID, + this.requestType, + this.requestDate, + this.requestTime, + this.remarks, + this.status, + this.createdBy, + this.createdOn, + this.editedBy, + this.editedOn, + this.patientName, + this.patientNameN, + this.gender, + this.dateofBirth, + this.mobileNumber, + this.emailAddress, + this.age, + this.genderDescription, + this.isVidaCall}); + + ListGtMyPatientsQuestions.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + transactionNo = json['TransactionNo']; + patientType = json['PatientType']; + patientID = json['PatientID']; + doctorID = json['DoctorID']; + requestType = json['RequestType']; + requestDate = json['RequestDate']; + requestTime = json['RequestTime']; + remarks = json['Remarks']; + status = json['Status']; + createdBy = json['CreatedBy']; + createdOn = json['CreatedOn']; + editedBy = json['EditedBy']; + editedOn = json['EditedOn']; + patientName = json['PatientName']; + patientNameN = json['PatientNameN']; + gender = json['Gender']; + dateofBirth = json['DateofBirth']; + mobileNumber = json['MobileNumber']; + emailAddress = json['EmailAddress']; + age = json['Age']; + genderDescription = json['GenderDescription']; + isVidaCall = json['IsVidaCall']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['TransactionNo'] = this.transactionNo; + data['PatientType'] = this.patientType; + data['PatientID'] = this.patientID; + data['DoctorID'] = this.doctorID; + data['RequestType'] = this.requestType; + data['RequestDate'] = this.requestDate; + data['RequestTime'] = this.requestTime; + data['Remarks'] = this.remarks; + data['Status'] = this.status; + data['CreatedBy'] = this.createdBy; + data['CreatedOn'] = this.createdOn; + data['EditedBy'] = this.editedBy; + data['EditedOn'] = this.editedOn; + data['PatientName'] = this.patientName; + data['PatientNameN'] = this.patientNameN; + data['Gender'] = this.gender; + data['DateofBirth'] = this.dateofBirth; + data['MobileNumber'] = this.mobileNumber; + data['EmailAddress'] = this.emailAddress; + data['Age'] = this.age; + data['GenderDescription'] = this.genderDescription; + data['IsVidaCall'] = this.isVidaCall; + return data; + } +} \ No newline at end of file diff --git a/lib/providers/doctor_reply_provider.dart b/lib/providers/doctor_reply_provider.dart new file mode 100644 index 00000000..1c977185 --- /dev/null +++ b/lib/providers/doctor_reply_provider.dart @@ -0,0 +1,61 @@ +import 'dart:convert'; + +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/models/RequestDoctorReply.dart'; +import 'package:doctor_app_flutter/models/list_gt_my_pationents_question_model.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:http/http.dart'; +import 'package:http_interceptor/http_client_with_interceptor.dart'; + +import '../interceptor/http_interceptor.dart'; + +class DoctorReplyProvider with ChangeNotifier { + Client client = + HttpClientWithInterceptor.build(interceptors: [HttpInterceptor()]); + + List listDoctorWorkingHoursTable = []; + bool isLoading = true; + bool isError = false; + String error = ''; + RequestDoctorReply _requestSchedule = RequestDoctorReply(); + + DoctorReplyProvider() { + getDoctorSchedule(); + } + + getDoctorSchedule() async { + const url = BASE_URL + 'DoctorApplication.svc/REST/GtMyPatientsQuestions'; + try { + if (await Helpers.checkConnection()) { + final response = await client.post(url, + body: json.encode(_requestSchedule.toJson())); + final int statusCode = response.statusCode; + if (statusCode < 200 || statusCode >= 400 || json == null) { + isLoading = false; + isError = true; + error = 'Error While Fetching data'; + } else { + var parsed = json.decode(response.body.toString()); + if (parsed['MessageStatus'] == 1) { + parsed['List_GtMyPatientsQuestions'].forEach((v) { + listDoctorWorkingHoursTable.add( ListGtMyPatientsQuestions.fromJson(v)); + }); + isError = false; + isLoading = false; + } else { + isError = true; + error = parsed['ErrorMessage'] ?? parsed['ErrorEndUserMessage']; + } + } + } else { + isLoading = false; + isError = true; + error = 'Please Check The Internet Connection'; + } + notifyListeners(); + } catch (error) { + throw error; + } + } +} diff --git a/lib/providers/schedule_provider.dart b/lib/providers/schedule_provider.dart index d9639da6..346175ec 100644 --- a/lib/providers/schedule_provider.dart +++ b/lib/providers/schedule_provider.dart @@ -35,10 +35,10 @@ class ScheduleProvider with ChangeNotifier { 1); ScheduleProvider() { - geDoctorSchedule(); + getDoctorSchedule(); } - geDoctorSchedule() async { + getDoctorSchedule() async { const url = BASE_URL + 'Doctors.svc/REST/GetDoctorWorkingHoursTable'; try { if (await Helpers.checkConnection()) { diff --git a/lib/routes.dart b/lib/routes.dart index be11ee52..6f131e66 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -6,7 +6,7 @@ import './screens/auth/verification_methods_screen.dart'; import './screens/auth/verify_account_screen.dart'; import './screens/blood_bank_screen.dart'; import './screens/dashboard_screen.dart'; -import './screens/doctor_reply_screen.dart'; +import 'screens/doctor/doctor_reply_screen.dart'; import './screens/medicine/medicine_search_screen.dart'; import './screens/my_schedule_screen.dart'; import './screens/patients/patient_profile_screen.dart'; @@ -16,7 +16,7 @@ import './screens/profile_screen.dart'; import './screens/settings/settings_screen.dart'; -const String INIT_ROUTE = LOGIN; +const String INIT_ROUTE = HOME; const String HOME = '/'; const String LOGIN = 'login'; const String PROFILE = 'profile'; diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index b6502760..0148af61 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -1,5 +1,7 @@ import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/providers/doctor_reply_provider.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:provider/provider.dart'; import '../routes.dart'; import '../widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; @@ -9,6 +11,7 @@ import '../presentation/doctor_app_icons.dart'; import '../widgets/dashboard/dashboard_item_icons_texts.dart'; import '../widgets/dashboard/dashboard_item_texts_widget.dart'; import '../widgets/shared/rounded_container_widget.dart'; +import 'doctor/doctor_reply_screen.dart'; class DashboardScreen extends StatefulWidget { DashboardScreen({Key key, this.title}) : super(key: key); @@ -23,217 +26,245 @@ class _DashboardScreenState extends State { @override Widget build(BuildContext context) { return AppScaffold( - appBarTitle:'Home', + appBarTitle: 'Home', body: Container( - - child: Column( - children: [ - Expanded( - flex: 1, - child: Container( - margin: EdgeInsets.all(10), - child: AppText( - "Today's Statistics", - fontWeight: FontWeight.bold, + child: Column( + children: [ + Expanded( + flex: 1, + child: Container( + margin: EdgeInsets.all(10), + child: AppText( + "Today's Statistics", + fontWeight: FontWeight.bold, + ), + alignment: Alignment.centerLeft, + ), + ), + Expanded( + flex: 3, + child: Row( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Expanded( + flex: 2, + child: RoundedContainer( + child: CircularPercentIndicator( + radius: 90.0, + animation: true, + animationDuration: 1200, + lineWidth: 7.0, + percent: .75, + center: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppText("38", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 4), + AppText("Out-Patients", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 1.5, + color: Colors.grey[800]), + ], + ), + circularStrokeCap: CircularStrokeCap.butt, + backgroundColor: Colors.blueGrey[100], + progressColor: Colors.red, ), - alignment: Alignment.centerLeft, - )), - Expanded( - flex: 3, - child: Row( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Expanded( - flex: 2, - child: RoundedContainer(child:CircularPercentIndicator( - radius: 90.0, - animation: true, - animationDuration: 1200, - lineWidth: 7.0, - percent: .75, - center: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - AppText( - "38", - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 4 - ), - AppText( - "Out-Patients", - fontWeight: FontWeight.normal, - fontSize: SizeConfig.textMultiplier * 1.5, - color: Colors.grey[800] - ), - ], - ), - circularStrokeCap: CircularStrokeCap.butt, - backgroundColor: Colors.blueGrey[100], - progressColor: Colors.red, - ))), - Expanded( - flex: 2, - child: Row( - children: [ - Expanded( - flex: 1, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.stretch, - children: [ - Expanded( - child: DashboardItemTexts( - "Arrived", - "23", - )), - Expanded( - child: DashboardItemTexts( - "Not Arrived", - "23", - )), - ], - )), - Expanded( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.stretch, - children: [ - Expanded( - child: DashboardItemTexts( - "ER", - "23", - )), - Expanded( - child: DashboardItemTexts( - "Walk-in", - "23", - )), - ], - )), - ], - )) - ])), - Expanded( + ), + ), + Expanded( flex: 2, child: Row( - crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Expanded( - flex: 2, - child: new DashboardItemIconText( - DoctorApp.home_icon, - "08", - "Lab Result", - backgroundColor: Colors.red, - )), - Expanded( - flex: 2, - child: new DashboardItemIconText( - DoctorApp.home_icon, - "10", - "Radiology", - backgroundColor: Colors.red, - )), - Expanded( - flex: 2, - child: new DashboardItemIconText( - DoctorApp.home_icon, - "05", - "Referral", - backgroundColor: Colors.red, - )), - ], - )), - Expanded( - flex: 2, - child: Row( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ + flex: 1, + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Expanded( + child: DashboardItemTexts( + "Arrived", + "23", + )), + Expanded( + child: DashboardItemTexts( + "Not Arrived", + "23", + ), + ), + ], + ), + ), Expanded( - flex: 2, - child: new DashboardItemIconText( - DoctorApp.home_icon, + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Expanded( + child: DashboardItemTexts( + "ER", "23", - "In-Patient", - showBorder: true, )), - Expanded( - flex: 2, - child: new DashboardItemIconText( - DoctorApp.home_icon, + Expanded( + child: DashboardItemTexts( + "Walk-in", "23", - "Operations", - showBorder: true, )), + ], + )), ], - )), - Expanded( - flex: 1, - child: Container( - margin: EdgeInsets.all(10), - child: AppText( - "Patient Services", - fontWeight: FontWeight.bold, + ), + ) + ], + ), + ), + Expanded( + flex: 2, + child: Row( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Expanded( + flex: 2, + child: new DashboardItemIconText( + DoctorApp.home_icon, + "08", + "Lab Result", + backgroundColor: Colors.red, + ), + ), + Expanded( + flex: 2, + child: new DashboardItemIconText( + DoctorApp.home_icon, + "10", + "Radiology", + backgroundColor: Colors.red, + )), + Expanded( + flex: 2, + child: new DashboardItemIconText( + DoctorApp.home_icon, + "05", + "Referral", + backgroundColor: Colors.red, + )), + ], + ), + ), + Expanded( + flex: 2, + child: Row( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Expanded( + flex: 2, + child: new DashboardItemIconText( + DoctorApp.home_icon, + "23", + "In-Patient", + showBorder: true, + ), + ), + Expanded( + flex: 2, + child: new DashboardItemIconText( + DoctorApp.home_icon, + "23", + "Operations", + showBorder: true, + )), + ], + ), + ), + Expanded( + flex: 1, + child: Container( + margin: EdgeInsets.all(10), + child: AppText( + "Patient Services", + fontWeight: FontWeight.bold, + ), + alignment: Alignment.centerLeft, + ), + ), + Expanded( + flex: 2, + child: Row( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Expanded( + flex: 2, + child: InkWell( + child: DashboardItemIconText( + DoctorApp.home_icon, + "", + "Search Patient", + showBorder: false, + backgroundColor: Colors.green[200], ), - alignment: Alignment.centerLeft, - )), - Expanded( + onTap: () { + Navigator.of(context).pushNamed(PATIENT_SEARCH); + }, + ), + ), + Expanded( flex: 2, - child: Row( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Expanded( - flex: 2, - child: InkWell( child: DashboardItemIconText( - DoctorApp.home_icon, - "", - "Search Patient", - showBorder: false, - backgroundColor: Colors.green[200], - ), - - onTap: () { - Navigator.of(context).pushNamed(PATIENT_SEARCH); - }, - - )), - Expanded( - flex: 2, - child: new DashboardItemIconText( - DoctorApp.home_icon, - "", - "Out Patient", - showBorder: false, - backgroundColor: Colors.deepPurple[300], - )), - ], - )), - Expanded( + child: InkWell( + onTap: () { + + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ChangeNotifierProvider( + create: (_) => DoctorReplyProvider(), + child: DoctorReplyScreen(), + ), + ), + ); + }, + child: DashboardItemIconText( + DoctorApp.home_icon, + "", + "Doctor Reply", + showBorder: false, + backgroundColor: Colors.deepPurple[300], + ), + ), + ), + ], + ), + ), + Expanded( + flex: 2, + child: Row( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Expanded( flex: 2, - child: Row( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Expanded( - flex: 2, - child: new DashboardItemIconText( - DoctorApp.home_icon, - "", - "In Patient", - showBorder: false, - backgroundColor: Colors.blueGrey[900], - )), - Expanded( - flex: 2, - child: new DashboardItemIconText( - DoctorApp.home_icon, - "", - "Discharge Patient", - showBorder: false, - backgroundColor: Colors.brown[400], - )), - ], - )), - ], - ))); + child: new DashboardItemIconText( + DoctorApp.home_icon, + "", + "In Patient", + showBorder: false, + backgroundColor: Colors.blueGrey[900], + ), + ), + Expanded( + flex: 2, + child: new DashboardItemIconText( + DoctorApp.home_icon, + "", + "Discharge Patient", + showBorder: false, + backgroundColor: Colors.brown[400], + ), + ), + ], + ), + ), + ], + ), + ), + ); } } diff --git a/lib/screens/doctor/doctor_reply_screen.dart b/lib/screens/doctor/doctor_reply_screen.dart new file mode 100644 index 00000000..ad200706 --- /dev/null +++ b/lib/screens/doctor/doctor_reply_screen.dart @@ -0,0 +1,125 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/providers/doctor_reply_provider.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/card_with_bg_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; +import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +/* + *@author: Mohammad Aljammal + *@Date:28/4/2020 + *@param: + *@return: + *@desc: Doctor Reply Screen display data from GtMyPatientsQuestions service + */ +class DoctorReplyScreen extends StatelessWidget { + + DoctorReplyProvider _doctorReplyProvider; + + @override + Widget build(BuildContext context) { + _doctorReplyProvider = Provider.of(context); + return AppScaffold( + appBarTitle: 'Doctor Reply', + showAppDrawer: false, + body:_doctorReplyProvider.isLoading? DrAppCircularProgressIndeicator(): + _doctorReplyProvider.isError? Center( + child: Text( + _doctorReplyProvider.error, + style: TextStyle(color: Theme.of(context).errorColor), + ), + ): + Container( + padding: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), + child: ListView( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: _doctorReplyProvider.listDoctorWorkingHoursTable.map((reply) { + return CardWithBgWidget( + widget: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + reply.patientName, + fontSize: 2.5 * SizeConfig.textMultiplier, + ), + SizedBox( + height: 8, + ), + AppText( + reply.remarks, + fontSize: 2.5 * SizeConfig.textMultiplier, + ), + SizedBox( + height: 5, + ), + Row( + children: [ + AppText( + 'Time', + fontSize: 2.5 * SizeConfig.textMultiplier, + ), + Container( + margin: EdgeInsets.only(left: 10), + child: AppText( + reply.requestTime, + fontSize: 2.5 * SizeConfig.textMultiplier, + ), + ), + ], + ), + SizedBox( + height: 5, + ), + Row( + children: [ + AppText( + 'File No', + fontSize: 2.5 * SizeConfig.textMultiplier, + ), + Container( + margin: EdgeInsets.only(left: 10), + child: AppText( + '${reply.patientID}', + fontSize: 2.5 * SizeConfig.textMultiplier, + ), + ), + ], + ), + SizedBox( + height: 5, + ), + Row( + children: [ + AppText( + 'Mobile No', + fontSize: 2.5 * SizeConfig.textMultiplier, + ), + Container( + margin: EdgeInsets.only(left: 10), + child: AppText( + reply.mobileNumber, + fontSize: 2.5 * SizeConfig.textMultiplier, + ), + ), + ], + ), + ], + ), + ), + ); + }).toList(), + ) + ], + ), + ), + ); + } + +} diff --git a/lib/screens/doctor_reply_screen.dart b/lib/screens/doctor_reply_screen.dart deleted file mode 100644 index 2233526b..00000000 --- a/lib/screens/doctor_reply_screen.dart +++ /dev/null @@ -1,9 +0,0 @@ -import 'package:flutter/material.dart'; -class DoctorReplyScreen extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar(title: Text('DoctorReply'),), - ); - } -} \ No newline at end of file diff --git a/lib/screens/my_schedule_screen.dart b/lib/screens/my_schedule_screen.dart index 0e0eebce..c4b82e23 100644 --- a/lib/screens/my_schedule_screen.dart +++ b/lib/screens/my_schedule_screen.dart @@ -1,4 +1,6 @@ import 'package:doctor_app_flutter/providers/schedule_provider.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -14,23 +16,23 @@ class MyScheduleScreen extends StatelessWidget { scheduleProvider = Provider.of(context); return AppScaffold( // pageOnly: false, + showBottomBar: false, + showAppDrawer: false, appBarTitle: 'My Schedule', body: scheduleProvider.isLoading - ? Center( - child: CircularProgressIndicator(), - ) + ? DrAppCircularProgressIndeicator() : scheduleProvider.isError ? Center( - child: Text( + child: AppText( scheduleProvider.error, - style: TextStyle(color: Theme.of(context).errorColor), + color: Theme.of(context).errorColor, ), ) : scheduleProvider.listDoctorWorkingHoursTable.length == 0 ? Center( - child: Text( + child: AppText( 'You don\'t have any Schedule', - style: TextStyle(color: Theme.of(context).errorColor), + color: Theme.of(context).errorColor, ), ) : Container( @@ -46,8 +48,9 @@ class MyScheduleScreen extends StatelessWidget { SizedBox( height: 20, ), - Text('My Schedule', - style: textStyle(2.5, FontWeight.w700)), + AppText('My Schedule', + fontSize: + 2.5 * SizeConfig.textMultiplier), scheduleListByDate(), // scheduleListByDate('Wednesday, 8 April '), ], @@ -71,10 +74,38 @@ class MyScheduleScreen extends StatelessWidget { child: Column( children: scheduleProvider.listDoctorWorkingHoursTable.map((item) { return CardWithBgWidget( - line1Text: item.dayName, - line2Text: item.workingHours, - heightPercentage: 0.18, - widthPercentage: 0.80, + widget: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText(item.dayName, + fontSize: 2.5 * SizeConfig.textMultiplier), + SizedBox( + height: 8, + ), + !item.workingHours.contains('and') + ? AppText(item.workingHours, + fontSize: 2.5 * SizeConfig.textMultiplier) + : Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + item.workingHours.substring( + 0, item.workingHours.indexOf('a')), + fontSize: 2.5 * SizeConfig.textMultiplier), + AppText( + item.workingHours.substring( + item.workingHours.indexOf('d') + 2, + ), + fontSize: 2.5 * SizeConfig.textMultiplier), + ], + ), + SizedBox( + width: 8, + ) + ], + ), + ), ); }).toList(), ), diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index f4b8516f..512ea915 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/routes.dart'; import 'package:flutter/material.dart'; @@ -10,6 +11,7 @@ class PatientsScreen extends StatelessWidget { "1", "1", ]; + @override Widget build(BuildContext context) { return AppScaffold( @@ -19,19 +21,40 @@ class PatientsScreen extends StatelessWidget { children: litems.map((item) { return InkWell( child: CardWithBgWidget( - line1Text: 'Fahad AlSlehm - 324599', - line2Text: '12/04/2020 - 02:00 PM', - heightPercentage: 0.15, - widthPercentage: 0.80), - onTap: (){ - Navigator.of(context).pushNamed(PATIENTS_PROFILE); - }, + widget: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Fahad AlSlehm - 324599', style: textStyle(2.5)), + SizedBox( + height: 8, + ), + Text('12/04/2020 - 02:00 PM', style: textStyle(2.5)), + SizedBox( + height: 8, + ), + Row( + children: [ + Icon(Icons.pin_drop), + Text("line3Text", style: textStyle(2.5)) + ], + ) + ], + ), + ), + onTap: () { + Navigator.of(context).pushNamed(PATIENTS_PROFILE); + }, ); }).toList(), ), ), ); } + + TextStyle textStyle(size, [FontWeight weight]) { + return TextStyle( + fontSize: size * SizeConfig.textMultiplier, fontWeight: weight); + } } class CustomShapeClipper extends CustomClipper { diff --git a/lib/widgets/shared/app_drawer_widget.dart b/lib/widgets/shared/app_drawer_widget.dart index d831ab7b..038af349 100644 --- a/lib/widgets/shared/app_drawer_widget.dart +++ b/lib/widgets/shared/app_drawer_widget.dart @@ -30,7 +30,7 @@ class _AppDrawerState extends State { Container( height: SizeConfig.heightMultiplier * 30, child: InkWell( - child: DrawerHeader( + child: DrawerHeader( child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ @@ -53,26 +53,37 @@ class _AppDrawerState extends State { ], ), ), - onTap: () { - Navigator.of(context).pushNamed(PROFILE); - }, ), + onTap: () { + Navigator.of(context).pushNamed(PROFILE); + }, + ), ), InkWell( child: DrawerItem("My Schedule", Icons.table_chart), onTap: () { - Navigator.push(context,MaterialPageRoute( - builder: (context) => ChangeNotifierProvider.value(value: ScheduleProvider(),child: MyScheduleScreen(),), - ),); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ChangeNotifierProvider( + create: (_) => ScheduleProvider(), + child: MyScheduleScreen(), + ), + ), + ); }, ), - InkWell(child: DrawerItem("Settings", Icons.settings), onTap: (){ + InkWell( + child: DrawerItem("Settings", Icons.settings), + onTap: () { Navigator.of(context).pushNamed(SETTINGS); - - },), - InkWell(child: DrawerItem("QR Reader", Icons.search),onTap:(){ + }, + ), + InkWell( + child: DrawerItem("QR Reader", Icons.search), + onTap: () { Navigator.of(context).pushNamed(QR_READER); - - } ,), + }, + ), ])), ), width: SizeConfig.realScreenWidth * 0.55, diff --git a/lib/widgets/shared/app_scaffold_widget.dart b/lib/widgets/shared/app_scaffold_widget.dart index 5fd84067..dda1333d 100644 --- a/lib/widgets/shared/app_scaffold_widget.dart +++ b/lib/widgets/shared/app_scaffold_widget.dart @@ -24,7 +24,7 @@ class AppScaffold extends StatelessWidget { this.appBarTitle, this.showAppBar, this.showBottomBar, - this.showAppDrawer, + this.showAppDrawer = true, this.body, this.showbg, this.showCurve, @@ -45,15 +45,10 @@ class AppScaffold extends StatelessWidget { color: Colors.black, fontWeight: FontWeight.bold)), title: Text(appBarTitle.toUpperCase()), leading: Builder(builder: (BuildContext context) { - return new GestureDetector( - onTap: () { - Scaffold.of(context).openDrawer(); - }, - child: IconButton( - icon: Icon(Icons.menu), - color: Colors.black, - onPressed: () => Scaffold.of(context).openDrawer(), - ), + return IconButton( + icon: showAppDrawer ? Icon(Icons.menu) : Icon(Icons.arrow_back_ios) , + color: Colors.black, + onPressed: () => showAppDrawer? Scaffold.of(context).openDrawer() : Navigator.pop(context), ); }), centerTitle: true, diff --git a/lib/widgets/shared/card_with_bg_widget.dart b/lib/widgets/shared/card_with_bg_widget.dart index e3151732..07562a5e 100644 --- a/lib/widgets/shared/card_with_bg_widget.dart +++ b/lib/widgets/shared/card_with_bg_widget.dart @@ -6,80 +6,47 @@ import 'package:hexcolor/hexcolor.dart'; /* *@author: Mohammad Aljammal *@Date:27/4/2020 - *@param: line1Text, line2Text, heightPercentage, widthPercentage + *@param: Widget *@return: - *@desc: Card Dr Schedule + *@desc: Card With Bg Widget */ class CardWithBgWidget extends StatelessWidget { - String line1Text; - String line2Text; - double heightPercentage; - double widthPercentage; - CardWithBgWidget( - {this.line1Text = '', - this.line2Text = '', - this.heightPercentage, - this.widthPercentage}); + final Widget widget; + + CardWithBgWidget({@required this.widget}); @override Widget build(BuildContext context) { - return Stack( - children: [ - RoundedContainer( - child:Container( - height: SizeConfig.screenHeight * heightPercentage, - width: SizeConfig.screenWidth * widthPercentage, - ), - raduis: 10, - backgroundColor: Hexcolor('#58434F'), - showBorder: true, - borderColor: Hexcolor('#707070'), - borderWidth: 0.5, + return Container( + margin: EdgeInsets.symmetric(vertical: 10.0), + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(10.0), ), - Positioned( - left: 10, - child: RoundedContainer( - child:Container( - padding: const EdgeInsets.all(15.0), - height: SizeConfig.screenHeight * heightPercentage, - width: SizeConfig.screenWidth * widthPercentage, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(line1Text, style: textStyle(2.5)) , - SizedBox( - height: 8, - ), - !line2Text.contains('and')? - Text(line2Text, style: textStyle(2.5)) : - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(line2Text.substring(0,line2Text.indexOf('a')), style: textStyle(2.5)) , - Text(line2Text.substring(line2Text.indexOf('d')+2,), style: textStyle(2.5)) , - ], - ), - - ], - ), + border: Border.all(color: Hexcolor('#707070'), width: 2.0), + ), + child: Material( + borderRadius: BorderRadius.all(Radius.circular(10.0)), + child: Stack( + children: [ + Positioned( + child: Container( + width: 10, + color: Hexcolor('#58434F'), ), - elevation: 0, - showBorder: true, - borderColor: Hexcolor('#707070'), - customCornerRaduis: true, - bottomLeft: 0, - topLeft: 0, - bottomRight: 10, - topRight: 10, - borderWidth: 0.5), + bottom: 0, + top: 0, + left: 0, + ), + Container( + padding: EdgeInsets.all(15.0), + margin: EdgeInsets.only(left: 10), + child: widget) + ], ), - ], + ), ); } - - TextStyle textStyle(size, [FontWeight weight]) { - return TextStyle( - fontSize: size * SizeConfig.textMultiplier, fontWeight: weight); - } }