adding cashed network image

merge-requests/830/head
hussam al-habibeh 5 years ago
parent 696b8b89ec
commit 6eecb4a614

@ -82,8 +82,7 @@ class PatientCard extends StatelessWidget {
? Row( ? Row(
children: [ children: [
AppText( AppText(
TranslationBase.of(context) TranslationBase.of(context).arrivedP,
.arrivedP,
color: Colors.green, color: Colors.green,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
@ -135,27 +134,19 @@ class PatientCard extends StatelessWidget {
width: 8, width: 8,
), ),
AppText( AppText(
patientInfo.status == 2 patientInfo.status == 2 ? 'Confirmed' : 'Booked',
? 'Confirmed' color: patientInfo.status == 2 ? Colors.green : Colors.grey,
: 'Booked',
color: patientInfo.status == 2
? Colors.green
: Colors.grey,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: 10, fontSize: 10,
), ),
], ],
) )
: !isFromSearch && : !isFromSearch && !isFromLiveCare && patientInfo.patientStatusType == null
!isFromLiveCare &&
patientInfo.patientStatusType ==
null
? Row( ? Row(
children: [ children: [
AppText( AppText(
TranslationBase.of(context) TranslationBase.of(context).notArrived,
.notArrived,
color: Colors.red[800], color: Colors.red[800],
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
@ -175,13 +166,8 @@ class PatientCard extends StatelessWidget {
width: 8, width: 8,
), ),
AppText( AppText(
patientInfo.status == 2 patientInfo.status == 2 ? 'Booked' : 'Confirmed',
? 'Booked' color: patientInfo.status == 2 ? Colors.grey : Colors.green,
: 'Confirmed',
color:
patientInfo.status == 2
? Colors.grey
: Colors.green,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: 12, fontSize: 12,
@ -191,17 +177,13 @@ class PatientCard extends StatelessWidget {
: SizedBox(), : SizedBox(),
this.arrivalType == '1' this.arrivalType == '1'
? AppText( ? AppText(
patientInfo.startTime != null patientInfo.startTime != null ? patientInfo.startTime : patientInfo.startTimes,
? 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.getDayMonthYearDate(AppDateUtils.convertStringToDate(
AppDateUtils
.convertStringToDate(
patientInfo.arrivedOn, patientInfo.arrivedOn,
)) + )) +
" " + " " +
@ -210,10 +192,8 @@ class PatientCard extends StatelessWidget {
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
fontSize: 15, fontSize: 15,
) )
: (patientInfo.appointmentDate != : (patientInfo.appointmentDate != null &&
null && patientInfo.appointmentDate.isNotEmpty)
patientInfo
.appointmentDate.isNotEmpty)
? AppText( ? AppText(
"${AppDateUtils.getDayMonthYearDate(AppDateUtils.convertStringToDate( "${AppDateUtils.getDayMonthYearDate(AppDateUtils.convertStringToDate(
patientInfo.appointmentDate, patientInfo.appointmentDate,
@ -252,13 +232,10 @@ class PatientCard extends StatelessWidget {
// width: MediaQuery.of(context).size.width*0.51, // width: MediaQuery.of(context).size.width*0.51,
child: AppText( child: AppText(
isFromLiveCare isFromLiveCare
? Helpers.capitalize( ? Helpers.capitalize(patientInfo.fullName)
patientInfo.fullName) : (Helpers.capitalize(patientInfo.firstName) +
: (Helpers.capitalize(
patientInfo.firstName) +
" " + " " +
Helpers.capitalize( Helpers.capitalize(patientInfo.lastName)),
patientInfo.lastName)),
fontSize: 16, fontSize: 16,
color: Color(0xff2e303a), color: Color(0xff2e303a),
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
@ -296,25 +273,19 @@ class PatientCard extends StatelessWidget {
fontSize: 14, fontSize: 14,
textOverflow: TextOverflow.ellipsis, textOverflow: TextOverflow.ellipsis,
), ),
patientInfo.nationality != null || patientInfo.nationality != null || patientInfo.nationalityId != null
patientInfo.nationalityId != null
? ClipRRect( ? ClipRRect(
borderRadius: borderRadius: BorderRadius.circular(20.0),
BorderRadius.circular(20.0), child: CachedNetworkImage(
child: Image.network( imageUrl: patientInfo.nationalityFlagURL != null
patientInfo.nationalityFlagURL != null
? patientInfo.nationalityFlagURL ? patientInfo.nationalityFlagURL
: '', : '',
height: 25, height: 25,
width: 30, width: 30,
errorBuilder: (BuildContext context, errorWidget: (context, url, error) => AppText(
Object exception, 'No Image',
StackTrace stackTrace) { fontSize: 10,
return AppText( ),
'No Image',
fontSize: 10,
);
},
)) ))
: SizedBox() : SizedBox()
], ],
@ -345,54 +316,55 @@ class PatientCard extends StatelessWidget {
), ),
Expanded( Expanded(
child: Row( child: Row(
children: [ children: [
Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded(
CustomRow( child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
label: TranslationBase.of(context).fileNumber,
value: patientInfo.patientId.toString(),
),
CustomRow(
label: TranslationBase.of(context).age + " : ",
value:
"${AppDateUtils.getAgeByBirthday(patientInfo.dateofBirth, context, isServerFormat: !isFromLiveCare)}",
),
if (isInpatient)
CustomRow(
label: patientInfo.admissionDate == null
? ""
: TranslationBase.of(context).admissionDate + " : ",
value: patientInfo.admissionDate == null
? ""
: "${AppDateUtils.convertDateFromServerFormat(patientInfo.admissionDate.toString(), 'yyyy-MM-dd')}",
),
if (patientInfo.admissionDate != null)
CustomRow(
label: TranslationBase.of(context).numOfDays + " : ",
value:
"${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}",
),
if (patientInfo.admissionDate != null)
CustomRow(
label: TranslationBase.of(context).roomNo + " : ",
value: "${patientInfo.roomId}",
),
if (isFromLiveCare)
Column(
children: [
CustomRow( CustomRow(
label: TranslationBase.of(context).clinic + " : ", label: TranslationBase.of(context).fileNumber,
value: patientInfo.clinicName, value: patientInfo.patientId.toString(),
), ),
], CustomRow(
), label: TranslationBase.of(context).age + " : ",
]), value:
"${AppDateUtils.getAgeByBirthday(patientInfo.dateofBirth, context, isServerFormat: !isFromLiveCare)}",
), ),
Icon(Icons.arrow_forward, size: 24,), if (isInpatient)
], CustomRow(
)) label: patientInfo.admissionDate == null
? ""
: TranslationBase.of(context).admissionDate + " : ",
value: patientInfo.admissionDate == null
? ""
: "${AppDateUtils.convertDateFromServerFormat(patientInfo.admissionDate.toString(), 'yyyy-MM-dd')}",
),
if (patientInfo.admissionDate != null)
CustomRow(
label: TranslationBase.of(context).numOfDays + " : ",
value:
"${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}",
),
if (patientInfo.admissionDate != null)
CustomRow(
label: TranslationBase.of(context).roomNo + " : ",
value: "${patientInfo.roomId}",
),
if (isFromLiveCare)
Column(
children: [
CustomRow(
label: TranslationBase.of(context).clinic + " : ",
value: patientInfo.clinicName,
),
],
),
]),
),
Icon(
Icons.arrow_forward,
size: 24,
),
],
))
]), ]),
isFromLiveCare isFromLiveCare
? Row( ? Row(
@ -440,5 +412,3 @@ class PatientCard extends StatelessWidget {
)); ));
} }
} }

@ -1,13 +1,14 @@
import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:cached_network_image/cached_network_image.dart';
class ProfileWelcomeWidget extends StatelessWidget { class ProfileWelcomeWidget extends StatelessWidget {
final Widget clinicWidget; final Widget clinicWidget;
final double height; final double height;
final bool isClinic; final bool isClinic;
ProfileWelcomeWidget(this.clinicWidget,
{this.height = 150, this.isClinic = false}); ProfileWelcomeWidget(this.clinicWidget, {this.height = 150, this.isClinic = false});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -27,24 +28,23 @@ class ProfileWelcomeWidget extends StatelessWidget {
SizedBox( SizedBox(
width: 20, width: 20,
), ),
if(authenticationViewModel.doctorProfile!=null) if (authenticationViewModel.doctorProfile != null)
CircleAvatar( CircleAvatar(
// radius: (52) // radius: (52)
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(20),
child: Image.network( child: CachedNetworkImage(
authenticationViewModel.doctorProfile.doctorImageURL, imageUrl: authenticationViewModel.doctorProfile.doctorImageURL,
fit: BoxFit.fill, fit: BoxFit.fill,
width: 75, width: 75,
height: 75, height: 75,
),
), ),
backgroundColor: Colors.transparent,
), ),
backgroundColor: Colors.transparent,
),
SizedBox( SizedBox(
height: 20, height: 20,
), ),
], ],
)), )),
); );

Loading…
Cancel
Save