From 5342d26c86ff9673ddb0da86376c6a7fc6370aec Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Sun, 4 Apr 2021 14:35:57 +0300 Subject: [PATCH] AppBar Design update&Design Fixes --- .../medical-file/medical_file_details.dart | 117 +++--- .../medical-file/medical_file_page.dart | 387 ++++++++++-------- lib/widgets/shared/app_scaffold_widget.dart | 56 +-- 3 files changed, 311 insertions(+), 249 deletions(-) diff --git a/lib/screens/medical-file/medical_file_details.dart b/lib/screens/medical-file/medical_file_details.dart index b52fabed..42c584cd 100644 --- a/lib/screens/medical-file/medical_file_details.dart +++ b/lib/screens/medical-file/medical_file_details.dart @@ -5,6 +5,7 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/patient_profile_screen.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/profile/patient-profile-header-new-design-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -73,6 +74,8 @@ class _MedicalFileDetailsState extends State { builder: (BuildContext context, MedicalFileViewModel model, Widget child) => AppScaffold( + appBar: PatientProfileHeaderNewDesignAppBar( + patient, patient.patientType.toString(), patient.arrivedOn), isShowAppBar: true, appBarTitle: TranslationBase.of(context).medicalReport.toUpperCase(), body: NetworkBaseView( @@ -82,8 +85,8 @@ class _MedicalFileDetailsState extends State { child: Container( child: Column( children: [ - PatientProfileHeaderNewDesign(patient, - patient.patientType.toString(), patient.arrivedOn), + // PatientProfileHeaderNewDesign(patient, + // patient.patientType.toString(), patient.arrivedOn), model.medicalFileList.length != 0 && model .medicalFileList[0] @@ -488,28 +491,62 @@ class _MedicalFileDetailsState extends State { FontWeight .w700, ), - AppText( - model - .medicalFileList[ - 0] - .entityList[0] - .timelines[ - encounterNumber] - .timeLineEvents[ - 0] - .consulations[ - 0] - .lstAssessments[ - index] - .condition - .trim(), + Expanded( + child: AppText( + model + .medicalFileList[ + 0] + .entityList[ + 0] + .timelines[ + encounterNumber] + .timeLineEvents[ + 0] + .consulations[ + 0] + .lstAssessments[ + index] + .condition + .trim(), + ), ), ], ), + Row( + children: [ + Expanded( + child: AppText( + model + .medicalFileList[ + 0] + .entityList[ + 0] + .timelines[ + encounterNumber] + .timeLineEvents[ + 0] + .consulations[ + 0] + .lstAssessments[ + index] + .description, + fontWeight: + FontWeight + .w700, + ), + ) + ], + ), Row( children: [ AppText( - model + 'Type: ', + fontWeight: + FontWeight + .w700, + ), + Expanded( + child: AppText(model .medicalFileList[ 0] .entityList[0] @@ -521,22 +558,16 @@ class _MedicalFileDetailsState extends State { 0] .lstAssessments[ index] - .description, - fontWeight: - FontWeight - .w700, - ) + .type), + ), ], ), - Row( - children: [ - AppText( - 'Type: ', - fontWeight: - FontWeight - .w700, - ), - AppText(model + SizedBox( + height: 15.0, + ), + Expanded( + child: AppText( + model .medicalFileList[ 0] .entityList[0] @@ -547,25 +578,9 @@ class _MedicalFileDetailsState extends State { .consulations[0] .lstAssessments[ index] - .type), - ], - ), - SizedBox( - height: 15.0, - ), - AppText( - model - .medicalFileList[ - 0] - .entityList[0] - .timelines[ - encounterNumber] - .timeLineEvents[0] - .consulations[0] - .lstAssessments[ - index] - .remarks - .trim(), + .remarks + .trim(), + ), ), Divider( height: 1, diff --git a/lib/screens/medical-file/medical_file_page.dart b/lib/screens/medical-file/medical_file_page.dart index 5f53c2b9..c5ef8bf8 100644 --- a/lib/screens/medical-file/medical_file_page.dart +++ b/lib/screens/medical-file/medical_file_page.dart @@ -10,9 +10,12 @@ 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/patients/profile/patient-page-header-widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.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/doctor_card.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -36,6 +39,8 @@ class _MedicalFilePageState extends State { builder: (BuildContext context, MedicalFileViewModel model, Widget child) => AppScaffold( + appBar: PatientProfileHeaderNewDesignAppBar( + patient, patientType.toString() ?? "0", patientType), isShowAppBar: true, appBarTitle: TranslationBase.of(context).medicalReport.toUpperCase(), body: NetworkBaseView( @@ -48,8 +53,8 @@ class _MedicalFilePageState extends State { // ? MainAxisAlignment.start // : MainAxisAlignment.center, children: [ - PatientProfileHeaderNewDesign( - patient, patient.patientType.toString(), arrivalType), + // PatientProfileHeaderNewDesign( + // patient, patient.patientType.toString(), arrivalType), Padding( padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0), @@ -92,181 +97,215 @@ class _MedicalFilePageState extends State { itemCount: model.medicalFileList[0].entityList[0] .timelines.length, itemBuilder: (BuildContext ctxt, int index) { - return Padding( - padding: EdgeInsets.symmetric( - horizontal: 12.0, vertical: 8.0), - child: InkWell( - child: Container( - width: double.infinity, - margin: EdgeInsets.only( - top: 10, left: 10, right: 10), - padding: EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - border: Border.all( - color: Colors.grey[200], width: 0.5), - ), - child: Column( - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - AppText( - model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .doctorName, - fontWeight: FontWeight.w700, - fontSize: 17.0, - fontFamily: 'Poppins', - ) - ], - ), - Row( - children: [ - AppText( - Helpers.convertStringToDate(model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .date) - .day - .toString() + - "/", - ), - AppText( - Helpers.convertStringToDate(model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .date) - .month - .toString() + - "/", - ), - AppText( - Helpers.convertStringToDate( - model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .date) - .year - .toString(), - ), - ], - ) - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - children: [ - ClipRRect( - borderRadius: - BorderRadius.all( - Radius.circular(30)), - child: Image.network( - 'https://previews.123rf.com/images/yupiramos/yupiramos1705/yupiramos170524444/78443570-a-female-doctor-avatar-character-vector-illustration-design.jpg', - fit: BoxFit.cover, - width: 60, - height: 70, - ), - ), - ], - ), - ), - Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Row( - children: [ - AppText( - TranslationBase.of(context) - .clinic + - ": ", - ), - AppText( - model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .clinicName, - fontWeight: FontWeight.w600, - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: [ - AppText( - TranslationBase.of(context) - .branch + - ": ", - ), - AppText( - model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .projectName, - fontWeight: FontWeight.w600, - ), - ], - ), - ], - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.end, - children: [ - Column( - children: [ - Icon( - Icons.remove_red_eye, - size: 30.0, - ) - ], - ) - ], - ), - ], - ), + return InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MedicalFileDetails( + age: patient.age, + firstName: patient.firstName, + lastName: patient.lastName, + gender: patient.genderDescription, + encounterNumber: index, + pp: patient.patientId, + patient: patient, + )), + ); + }, + child: DoctorCard( + doctorName: model.medicalFileList[0] + .entityList[0].timelines[index].doctorName, + clinic: model.medicalFileList[0].entityList[0] + .timelines[index].clinicName, + branch: model.medicalFileList[0].entityList[0] + .timelines[index].projectName, + profileUrl: + 'https://previews.123rf.com/images/yupiramos/yupiramos1705/yupiramos170524444/78443570-a-female-doctor-avatar-character-vector-illustration-design.jpg', + appointmentDate: + DateUtils.getDateTimeFromServerFormat( + model.medicalFileList[0].entityList[0] + .timelines[index].date, ), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - MedicalFileDetails( - age: patient.age, - firstName: patient.firstName, - lastName: patient.lastName, - gender: patient.genderDescription, - encounterNumber: index, - pp: patient.patientId, - patient: patient, - )), - ); - }, + isPrescriptions: true, ), ); + + // return Padding( + // padding: EdgeInsets.symmetric( + // horizontal: 12.0, vertical: 8.0), + // child: InkWell( + // child: Container( + // width: double.infinity, + // margin: EdgeInsets.only( + // top: 10, left: 10, right: 10), + // padding: EdgeInsets.all(8.0), + // decoration: BoxDecoration( + // color: Colors.white, + // borderRadius: BorderRadius.all( + // Radius.circular(10.0), + // ), + // border: Border.all( + // color: Colors.grey[200], width: 0.5), + // ), + // child: Column( + // children: [ + // Row( + // mainAxisAlignment: + // MainAxisAlignment.spaceBetween, + // children: [ + // Row( + // children: [ + // AppText( + // model + // .medicalFileList[0] + // .entityList[0] + // .timelines[index] + // .doctorName, + // fontWeight: FontWeight.w700, + // fontSize: 17.0, + // fontFamily: 'Poppins', + // ) + // ], + // ), + // Row( + // children: [ + // AppText( + // Helpers.convertStringToDate(model + // .medicalFileList[0] + // .entityList[0] + // .timelines[index] + // .date) + // .day + // .toString() + + // "/", + // ), + // AppText( + // Helpers.convertStringToDate(model + // .medicalFileList[0] + // .entityList[0] + // .timelines[index] + // .date) + // .month + // .toString() + + // "/", + // ), + // AppText( + // Helpers.convertStringToDate( + // model + // .medicalFileList[0] + // .entityList[0] + // .timelines[index] + // .date) + // .year + // .toString(), + // ), + // ], + // ) + // ], + // ), + // Row( + // mainAxisAlignment: + // MainAxisAlignment.start, + // children: [ + // Padding( + // padding: const EdgeInsets.all(8.0), + // child: Column( + // children: [ + // ClipRRect( + // borderRadius: + // BorderRadius.all( + // Radius.circular(30)), + // child: Image.network( + // 'https://previews.123rf.com/images/yupiramos/yupiramos1705/yupiramos170524444/78443570-a-female-doctor-avatar-character-vector-illustration-design.jpg', + // fit: BoxFit.cover, + // width: 60, + // height: 70, + // ), + // ), + // ], + // ), + // ), + // Column( + // crossAxisAlignment: + // CrossAxisAlignment.start, + // children: [ + // Row( + // children: [ + // AppText( + // TranslationBase.of(context) + // .clinic + + // ": ", + // ), + // AppText( + // model + // .medicalFileList[0] + // .entityList[0] + // .timelines[index] + // .clinicName, + // fontWeight: FontWeight.w600, + // ), + // ], + // ), + // Row( + // mainAxisAlignment: + // MainAxisAlignment + // .spaceBetween, + // children: [ + // AppText( + // TranslationBase.of(context) + // .branch + + // ": ", + // ), + // AppText( + // model + // .medicalFileList[0] + // .entityList[0] + // .timelines[index] + // .projectName, + // fontWeight: FontWeight.w600, + // ), + // ], + // ), + // ], + // ), + // ], + // ), + // Row( + // mainAxisAlignment: + // MainAxisAlignment.end, + // children: [ + // Column( + // children: [ + // Icon( + // Icons.remove_red_eye, + // size: 30.0, + // ) + // ], + // ) + // ], + // ), + // ], + // ), + // ), + // onTap: () { + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => + // MedicalFileDetails( + // age: patient.age, + // firstName: patient.firstName, + // lastName: patient.lastName, + // gender: patient.genderDescription, + // encounterNumber: index, + // pp: patient.patientId, + // patient: patient, + // )), + // ); + // }, + // ), + // ); }) : Column( children: [ diff --git a/lib/widgets/shared/app_scaffold_widget.dart b/lib/widgets/shared/app_scaffold_widget.dart index 81fc59e8..60aa5415 100644 --- a/lib/widgets/shared/app_scaffold_widget.dart +++ b/lib/widgets/shared/app_scaffold_widget.dart @@ -25,7 +25,10 @@ class AppScaffold extends StatelessWidget { this.body, this.isLoading = false, this.isShowAppBar = true, - this.baseViewModel, this.bottomSheet, this.backgroundColor, this.appBar}); + this.baseViewModel, + this.bottomSheet, + this.backgroundColor, + this.appBar}); @override Widget build(BuildContext context) { @@ -36,30 +39,35 @@ class AppScaffold extends StatelessWidget { FocusScope.of(context).requestFocus(new FocusNode()); }, child: Scaffold( - backgroundColor: backgroundColor??Colors.white, + backgroundColor: backgroundColor ?? Colors.white, appBar: isShowAppBar - ? appBar ?? AppBar( - elevation: 0, - backgroundColor: HexColor('#515B5D'), - textTheme: TextTheme(headline6: TextStyle(color: Colors.white)), - title: Text(appBarTitle.toUpperCase()), - leading: Builder(builder: (BuildContext context) { - return IconButton( - icon: Icon(Icons.arrow_back_ios), - color: Colors.white, //Colors.black, - onPressed: () => Navigator.pop(context), - ); - }), - centerTitle: true, - actions: [ - IconButton( - icon: Icon(DoctorApp.home_icon_active), - color: Colors.white, //Colors.black, - onPressed: () => Navigator.pushNamedAndRemoveUntil( - context, HOME, (r) => false), - ), - ], - ) + ? appBar ?? + AppBar( + elevation: 0, + backgroundColor: Colors.white, //HexColor('#515B5D'), + textTheme: TextTheme( + headline6: TextStyle( + color: Colors.black87, + fontSize: 16.8, + )), + title: Text(appBarTitle.toUpperCase()), + leading: Builder(builder: (BuildContext context) { + return IconButton( + icon: Icon(Icons.arrow_back_ios), + color: Colors.black, //Colors.black, + onPressed: () => Navigator.pop(context), + ); + }), + centerTitle: true, + actions: [ + IconButton( + icon: Icon(DoctorApp.home_icon_active), + color: Colors.black, //Colors.black, + onPressed: () => Navigator.pushNamedAndRemoveUntil( + context, HOME, (r) => false), + ), + ], + ) : null, bottomSheet: bottomSheet, body: projectProvider.isInternetConnection