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,
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: const AlwaysScrollableScrollPhysics (),
itemBuilder: (context, index) {
return PatientCard(
patientInfo: patientSearchViewModel

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

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

Loading…
Cancel
Save