design fixes

merge-requests/841/head
mosazaid 4 years ago
parent b2ce970195
commit 4663a65fd6

@ -32,6 +32,7 @@ class ListOfAllInPatient extends StatelessWidget {
patientSearchViewModel.filteredInPatientItems.length, patientSearchViewModel.filteredInPatientItems.length,
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
shrinkWrap: true, shrinkWrap: true,
physics: const AlwaysScrollableScrollPhysics (),
itemBuilder: (context, index) { itemBuilder: (context, index) {
return PatientCard( return PatientCard(
patientInfo: patientSearchViewModel patientInfo: patientSearchViewModel

@ -6,3 +6,17 @@ extension Extension on Object {
bool isNullEmptyZeroOrFalse() => bool isNullEmptyZeroOrFalse() =>
this == null || this == '' || !this || this == 0; this == null || this == '' || !this || this == 0;
} }
/// truncate the [String] without cutting words. The length is calculated with the suffix.
extension Truncate on String {
String truncate(int max, {String suffix = ''}) {
try {
return length <= max
? this
: '${substring(0, max - suffix.length)}$suffix';
} catch (e){
return this;
}
}
}

@ -10,6 +10,7 @@ import 'package:doctor_app_flutter/widgets/shared/user-guid/CusomRow.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import '../../../util/extenstions.dart';
import 'ShowTimer.dart'; import 'ShowTimer.dart';
@ -37,6 +38,15 @@ class PatientCard extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
String nationalityName = patientInfo.nationalityName != null
? patientInfo.nationalityName.trim()
: patientInfo.nationality != null
? patientInfo.nationality.trim()
: patientInfo.nationalityId !=
null
? patientInfo.nationalityId
: "";
return Container( return Container(
width: SizeConfig.screenWidth * 0.9, width: SizeConfig.screenWidth * 0.9,
margin: EdgeInsets.all(6), margin: EdgeInsets.all(6),
@ -82,7 +92,8 @@ class PatientCard extends StatelessWidget {
? Row( ? Row(
children: [ children: [
AppText( AppText(
TranslationBase.of(context).arrivedP, TranslationBase.of(context)
.arrivedP,
color: Colors.green, color: Colors.green,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
@ -102,8 +113,12 @@ class PatientCard extends StatelessWidget {
width: 8, width: 8,
), ),
AppText( AppText(
patientInfo.status == 2 ? 'Confirmed' : 'Booked', patientInfo.status == 2
color: patientInfo.status == 2 ? Colors.green : Colors.grey, ? 'Confirmed'
: 'Booked',
color: patientInfo.status == 2
? Colors.green
: Colors.grey,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: 10, fontSize: 10,
@ -114,7 +129,8 @@ class PatientCard extends StatelessWidget {
? Row( ? Row(
children: [ children: [
AppText( AppText(
TranslationBase.of(context).notArrived, TranslationBase.of(context)
.notArrived,
color: Colors.red[800], color: Colors.red[800],
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
@ -134,19 +150,27 @@ class PatientCard extends StatelessWidget {
width: 8, width: 8,
), ),
AppText( AppText(
patientInfo.status == 2 ? 'Confirmed' : 'Booked', patientInfo.status == 2
color: patientInfo.status == 2 ? Colors.green : Colors.grey, ? 'Confirmed'
: 'Booked',
color: patientInfo.status == 2
? Colors.green
: Colors.grey,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: 10, fontSize: 10,
), ),
], ],
) )
: !isFromSearch && !isFromLiveCare && patientInfo.patientStatusType == null : !isFromSearch &&
!isFromLiveCare &&
patientInfo.patientStatusType ==
null
? Row( ? Row(
children: [ children: [
AppText( AppText(
TranslationBase.of(context).notArrived, TranslationBase.of(context)
.notArrived,
color: Colors.red[800], color: Colors.red[800],
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
@ -166,8 +190,13 @@ class PatientCard extends StatelessWidget {
width: 8, width: 8,
), ),
AppText( AppText(
patientInfo.status == 2 ? 'Booked' : 'Confirmed', patientInfo.status == 2
color: patientInfo.status == 2 ? Colors.grey : Colors.green, ? 'Booked'
: 'Confirmed',
color:
patientInfo.status == 2
? Colors.grey
: Colors.green,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: 12, fontSize: 12,
@ -177,13 +206,17 @@ class PatientCard extends StatelessWidget {
: SizedBox(), : SizedBox(),
this.arrivalType == '1' this.arrivalType == '1'
? AppText( ? AppText(
patientInfo.startTime != null ? patientInfo.startTime : patientInfo.startTimes, patientInfo.startTime != null
? patientInfo.startTime
: patientInfo.startTimes,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
) )
: patientInfo.arrivedOn != null : patientInfo.arrivedOn != null
? AppText( ? AppText(
AppDateUtils.getDayMonthYearDate(AppDateUtils.convertStringToDate( AppDateUtils.getDayMonthYearDate(
AppDateUtils
.convertStringToDate(
patientInfo.arrivedOn, patientInfo.arrivedOn,
)) + )) +
" " + " " +
@ -192,8 +225,10 @@ class PatientCard extends StatelessWidget {
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
fontSize: 15, fontSize: 15,
) )
: (patientInfo.appointmentDate != null && : (patientInfo.appointmentDate !=
patientInfo.appointmentDate.isNotEmpty) null &&
patientInfo
.appointmentDate.isNotEmpty)
? AppText( ? AppText(
"${AppDateUtils.getDayMonthYearDate(AppDateUtils.convertStringToDate( "${AppDateUtils.getDayMonthYearDate(AppDateUtils.convertStringToDate(
patientInfo.appointmentDate, patientInfo.appointmentDate,
@ -224,18 +259,27 @@ class PatientCard extends StatelessWidget {
Padding( Padding(
padding: EdgeInsets.only(left: 12.0), padding: EdgeInsets.only(left: 12.0),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Expanded( Expanded(
child: Row(children: [ flex: 2,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Expanded( Expanded(
// width: MediaQuery.of(context).size.width*0.51, // width: MediaQuery.of(context).size.width*0.51,
child: AppText( child: AppText(
isFromLiveCare isFromLiveCare
? Helpers.capitalize(patientInfo.fullName) ? Helpers.capitalize(
: (Helpers.capitalize(patientInfo.firstName) + patientInfo.fullName)
: (Helpers.capitalize(
patientInfo.firstName) +
" " + " " +
Helpers.capitalize(patientInfo.lastName)), Helpers.capitalize(
patientInfo.lastName)),
fontSize: 16, fontSize: 16,
color: Color(0xff2e303a), color: Color(0xff2e303a),
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
@ -259,36 +303,45 @@ class PatientCard extends StatelessWidget {
), ),
]), ]),
), ),
Row( Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
AppText( Expanded(
patientInfo.nationalityName != null child: Container(
? patientInfo.nationalityName.trim() alignment: Alignment.centerRight,
: patientInfo.nationality != null child: AppText(
? patientInfo.nationality.trim() nationalityName.truncate(14),
: patientInfo.nationalityId != null
? patientInfo.nationalityId
: "",
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 14, fontSize: 14,
textOverflow: TextOverflow.ellipsis, textOverflow: TextOverflow.ellipsis,
), ),
patientInfo.nationality != null || patientInfo.nationalityId != null ),
),
patientInfo.nationality != null ||
patientInfo.nationalityId != null
? ClipRRect( ? ClipRRect(
borderRadius: BorderRadius.circular(20.0), borderRadius:
BorderRadius.circular(20.0),
child: CachedNetworkImage( child: CachedNetworkImage(
imageUrl: patientInfo.nationalityFlagURL != null imageUrl: patientInfo
.nationalityFlagURL !=
null
? patientInfo.nationalityFlagURL ? patientInfo.nationalityFlagURL
: '', : '',
height: 25, height: 25,
width: 30, width: 30,
errorWidget: (context, url, error) => AppText( errorWidget:
(context, url, error) =>
AppText(
'No Image', 'No Image',
fontSize: 10, fontSize: 10,
), ),
)) ))
: SizedBox() : SizedBox()
], ],
),
) )
], ],
)), )),
@ -336,8 +389,9 @@ class PatientCard extends StatelessWidget {
CustomRow( CustomRow(
label: patientInfo.admissionDate == null label: patientInfo.admissionDate == null
? "" ? ""
: TranslationBase.of(context).admissionDate + " : ", : TranslationBase.of(context)
.admissionDate +
" : ",
value: patientInfo.admissionDate == null value: patientInfo.admissionDate == null
? "" ? ""
: "${AppDateUtils.convertDateFromServerFormat(patientInfo.admissionDate.toString(), 'yyyy-MM-dd')}", : "${AppDateUtils.convertDateFromServerFormat(patientInfo.admissionDate.toString(), 'yyyy-MM-dd')}",
@ -352,8 +406,8 @@ class PatientCard extends StatelessWidget {
), ),
if (patientInfo.admissionDate != null) if (patientInfo.admissionDate != null)
CustomRow( CustomRow(
label: label: TranslationBase.of(context)
TranslationBase.of(context).clinicName + .clinicName +
" : ", " : ",
value: "${patientInfo.clinicDescription}", value: "${patientInfo.clinicDescription}",
), ),
@ -399,13 +453,18 @@ class PatientCard extends StatelessWidget {
], ],
) )
: !isInpatient && !isFromSearch : !isInpatient && !isFromSearch
? Row(mainAxisAlignment: MainAxisAlignment.end, children: [ ? Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Container( Container(
padding: EdgeInsets.all(4), padding: EdgeInsets.all(4),
child: Image.asset( child: Image.asset(
patientInfo.appointmentType == 'Regular' && patientInfo.visitTypeId == 100 patientInfo.appointmentType ==
'Regular' &&
patientInfo.visitTypeId == 100
? 'assets/images/livecare.png' ? 'assets/images/livecare.png'
: patientInfo.appointmentType == 'Walkin' : patientInfo.appointmentType ==
'Walkin'
? 'assets/images/walkin.png' ? 'assets/images/walkin.png'
: 'assets/images/booked.png', : 'assets/images/booked.png',
height: 25, height: 25,
@ -413,7 +472,9 @@ class PatientCard extends StatelessWidget {
)), )),
]) ])
: (isInpatient == true) : (isInpatient == true)
? Row(mainAxisAlignment: MainAxisAlignment.end, children: [ ? Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Container( Container(
padding: EdgeInsets.all(4), padding: EdgeInsets.all(4),
child: Image.asset( child: Image.asset(

@ -53,7 +53,7 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
), ),
height: height == 0 height: height == 0
? isInpatient ? isInpatient
? 215 ? 220
: 200 : 200
: height, : height,
child: Container( child: Container(
@ -245,15 +245,21 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
), ),
), ),
Row( Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
HeaderRow( HeaderRow(
label: TranslationBase.of(context).fileNumber, label: TranslationBase.of(context).fileNumber,
value: patient.patientId.toString(), value: patient.patientId.toString(),
), ),
Row( Expanded(
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
AppText( Expanded(
child: Container(
alignment: Alignment.centerRight,
child: AppText(
patient.nationalityName ?? patient.nationalityName ??
patient.nationality ?? patient.nationality ??
patient.nationalityId ?? patient.nationalityId ??
@ -261,6 +267,8 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 12, fontSize: 12,
), ),
),
),
patient.nationalityFlagURL != null patient.nationalityFlagURL != null
? ClipRRect( ? ClipRRect(
borderRadius: BorderRadius.circular(20.0), borderRadius: BorderRadius.circular(20.0),
@ -271,11 +279,12 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
errorBuilder: (BuildContext context, errorBuilder: (BuildContext context,
Object exception, Object exception,
StackTrace stackTrace) { StackTrace stackTrace) {
return Text('No Image'); return Text('');
}, },
)) ))
: SizedBox() : SizedBox()
], ],
),
) )
], ],
), ),

Loading…
Cancel
Save