adding cashed network image

merge-requests/830/head
hussam al-habibeh 3 years ago
parent 763686fc76
commit ba275eaed4

@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/user-guid/CusomRow.dart'; 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 'ShowTimer.dart'; import 'ShowTimer.dart';
@ -81,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',
@ -102,12 +102,8 @@ 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,
@ -118,8 +114,7 @@ class PatientCard extends StatelessWidget {
? 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',
@ -139,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',
@ -179,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,
@ -195,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,
)) + )) +
" " + " " +
@ -214,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,
@ -256,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,
@ -300,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: 7.5,
return AppText( ),
'No Image',
fontSize: 10,
);
},
)) ))
: SizedBox() : SizedBox()
], ],
@ -348,58 +315,51 @@ class PatientCard extends StatelessWidget {
width: 10, width: 10,
), ),
Expanded( Expanded(
child: Column( child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
crossAxisAlignment: CrossAxisAlignment.start, CustomRow(
children: [ label: TranslationBase.of(context).fileNumber,
CustomRow( value: patientInfo.patientId.toString(),
label: TranslationBase.of(context).fileNumber, ),
value: patientInfo.patientId.toString(),
),
//if (isInpatient) //if (isInpatient)
CustomRow( CustomRow(
label: TranslationBase.of(context).age + " : ", label: TranslationBase.of(context).age + " : ",
value: value:
"${AppDateUtils.getAgeByBirthday(patientInfo.dateofBirth, context, isServerFormat: !isFromLiveCare)}", "${AppDateUtils.getAgeByBirthday(patientInfo.dateofBirth, context, isServerFormat: !isFromLiveCare)}",
), ),
if (isInpatient) if (isInpatient)
CustomRow( CustomRow(
label: patientInfo.admissionDate == null label: patientInfo.admissionDate == null
? "" ? ""
: TranslationBase.of(context) : TranslationBase.of(context).admissionDate + " : ",
.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')}", if (patientInfo.admissionDate != null)
), CustomRow(
if (patientInfo.admissionDate != null) label: TranslationBase.of(context).numOfDays + " : ",
CustomRow( value:
label: TranslationBase.of(context).numOfDays + "${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}",
" : ", ),
value: if (patientInfo.admissionDate != null)
"${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}", CustomRow(
), label: TranslationBase.of(context).roomNo + " : ",
if (patientInfo.admissionDate != null) value: "${patientInfo.roomId}",
CustomRow( ),
label:
TranslationBase.of(context).roomNo + " : ",
value: "${patientInfo.roomId}",
),
if (isFromLiveCare) if (isFromLiveCare)
Column( Column(
children: [ children: [
CustomRow( CustomRow(
label: TranslationBase.of(context).clinic + label: TranslationBase.of(context).clinic + " : ",
" : ", value: patientInfo.clinicName,
value: patientInfo.clinicName,
),
],
), ),
])) ],
),
]))
]), ]),
isFromLiveCare isFromLiveCare
? Row( ? Row(
@ -416,36 +376,29 @@ class PatientCard extends StatelessWidget {
], ],
) )
: !isInpatient && !isFromSearch : !isInpatient && !isFromSearch
? Row( ? Row(mainAxisAlignment: MainAxisAlignment.end, children: [
mainAxisAlignment: MainAxisAlignment.end, Container(
children: [ 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: [
Container( Container(
padding: EdgeInsets.all(4), padding: EdgeInsets.all(4),
child: Image.asset( child: Image.asset(
patientInfo.appointmentType == 'assets/images/inpatient.png',
'Regular' &&
patientInfo.visitTypeId == 100
? 'assets/images/livecare.png'
: patientInfo.appointmentType ==
'Walkin'
? 'assets/images/walkin.png'
: 'assets/images/booked.png',
height: 25, height: 25,
width: 35, 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() : SizedBox()
], ],
), ),
@ -454,5 +407,3 @@ class PatientCard extends StatelessWidget {
)); ));
} }
} }

@ -141,6 +141,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "7.1.0" version: "7.1.0"
cached_network_image:
dependency: "direct main"
description:
name: cached_network_image
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.1"
characters: characters:
dependency: transitive dependency: transitive
description: description:
@ -433,6 +440,20 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_blurhash:
dependency: transitive
description:
name: flutter_blurhash
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.0"
flutter_cache_manager:
dependency: transitive
description:
name: flutter_cache_manager
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
flutter_device_type: flutter_device_type:
dependency: "direct main" dependency: "direct main"
description: description:
@ -595,6 +616,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.1.4" version: "3.1.4"
image:
dependency: transitive
description:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.19"
imei_plugin: imei_plugin:
dependency: "direct main" dependency: "direct main"
description: description:
@ -664,7 +692,7 @@ packages:
name: meta name: meta
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0-nullsafety.3" version: "1.3.0-nullsafety.4"
mime: mime:
dependency: transitive dependency: transitive
description: description:
@ -693,6 +721,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.2.0"
octo_image:
dependency: transitive
description:
name: octo_image
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0"
open_iconic_flutter: open_iconic_flutter:
dependency: transitive dependency: transitive
description: description:
@ -728,6 +763,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.4" version: "0.1.4"
path_provider:
dependency: transitive
description:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.28"
path_provider_linux: path_provider_linux:
dependency: transitive dependency: transitive
description: description:
@ -735,6 +777,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.0.1+2" version: "0.0.1+2"
path_provider_macos:
dependency: transitive
description:
name: path_provider_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.4+8"
path_provider_platform_interface: path_provider_platform_interface:
dependency: transitive dependency: transitive
description: description:
@ -854,6 +903,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.5" version: "2.1.5"
rxdart:
dependency: transitive
description:
name: rxdart
url: "https://pub.dartlang.org"
source: hosted
version: "0.25.0"
scratch_space: scratch_space:
dependency: transitive dependency: transitive
description: description:
@ -950,13 +1006,27 @@ packages:
relative: true relative: true
source: path source: path
version: "0.0.0" version: "0.0.0"
sqflite:
dependency: transitive
description:
name: sqflite
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.2+4"
sqflite_common:
dependency: transitive
description:
name: sqflite_common
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3+3"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
name: stack_trace name: stack_trace
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.10.0-nullsafety.1" version: "1.10.0-nullsafety.2"
sticky_headers: sticky_headers:
dependency: "direct main" dependency: "direct main"
description: description:
@ -985,6 +1055,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0-nullsafety.1" version: "1.1.0-nullsafety.1"
synchronized:
dependency: transitive
description:
name: synchronized
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0+2"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
@ -1154,5 +1231,5 @@ packages:
source: hosted source: hosted
version: "2.2.1" version: "2.2.1"
sdks: sdks:
dart: ">=2.10.0 <2.11.0" dart: ">=2.10.2 <=2.11.0-213.1.beta"
flutter: ">=1.22.0 <2.0.0" flutter: ">=1.22.2 <2.0.0"

@ -96,6 +96,10 @@ dependencies:
# Html Editor Enhanced # Html Editor Enhanced
html_editor_enhanced: ^1.3.0 html_editor_enhanced: ^1.3.0
#Network Image
cached_network_image: ^2.5.0
# Badges # Badges
badges: ^1.1.4 badges: ^1.1.4

Loading…
Cancel
Save