My Vaccines design revamped

merge-update-with-lab-changes
haroon amjad 4 years ago
parent dfeb249a54
commit c91b8ce777

@ -15,6 +15,10 @@ class VaccineService extends BaseService {
Map<String, dynamic> body = Map(); Map<String, dynamic> body = Map();
body['To'] = "0"; body['To'] = "0";
body['From'] = "0"; body['From'] = "0";
// body['PatientID'] = 1018977;
// body['TokenID'] = "@dm!n";
hasError = false; hasError = false;
_vaccineList.clear(); _vaccineList.clear();
await baseAppClient.post(GET_VACCINES, await baseAppClient.post(GET_VACCINES,

@ -1,21 +1,18 @@
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/vaccine_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/vaccine_view_model.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart';
import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/rounded_container.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../base/base_view.dart'; import '../base/base_view.dart';
import 'my_vaccines_item_screen.dart';
//TODO fix by jammal we have a static data //TODO fix by jammal we have a static data
class MyVaccines extends StatefulWidget { class MyVaccines extends StatefulWidget {
@ -40,191 +37,71 @@ class _MyVaccinesState extends State<MyVaccines> {
ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vacceines/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vacceines/ar/0.png') ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vacceines/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vacceines/ar/0.png')
], ],
body: Container( body: Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(top: 20.0),
left: SizeConfig.screenWidth * 0.004,
right: SizeConfig.screenWidth * 0.004,
top: SizeConfig.screenWidth * 0.04,
),
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
RoundedContainer( AppExpandableNotifier(
backgroundColor: Colors.white, isExpand: true,
child: ExpansionTile( title: "2013",
title: Container( bodyWidget: Container(
height: 65.0, child: ListView.separated(
child: Text('2018'), scrollDirection: Axis.vertical,
), shrinkWrap: true,
children: <Widget>[ itemCount: model.vaccineList == null ? 0 : model.vaccineList.length,
Container( padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21),
child: ListView.builder( separatorBuilder: (context, index) => SizedBox(height: 14),
scrollDirection: Axis.vertical, itemBuilder: (BuildContext context, int index) {
shrinkWrap: true, return DoctorCard(
itemCount: model.vaccineList == null ? 0 : model.vaccineList.length, onTap: () {},
itemBuilder: (BuildContext context, int index) { isInOutPatient: true,
return Column( isShowInOutPatient: false,
children: <Widget>[ name: TranslationBase.of(context).dr.toString() + " " + model.vaccineList[index].doctorName,
RoundedContainer( billNo: "",
child: Column( vaccineName: model.vaccineList[index].vaccineName,
children: <Widget>[ profileUrl: model.vaccineList[index].doctorImageURL,
Row( subName: model.vaccineList[index].projectName,
children: <Widget>[ isLiveCareAppointment: false,
Expanded( date: DateUtil.convertStringToDate(model.vaccineList[index].vaccinationDate),
child: Column( isSortByClinic: true,
children: <Widget>[ );
Padding( }),
padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 20.0), )),
child: Image.network(
model.vaccineList[index].doctorImageURL,
height: SizeConfig.imageSizeMultiplier * 23,
width: SizeConfig.imageSizeMultiplier * 20,
fit: BoxFit.fill,
),
),
],
),
flex: 2,
),
Expanded(
child: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
model.vaccineList[index].doctorTitle + model.vaccineList[index].doctorName,
style: TextStyle(
fontWeight: FontWeight.w900,
fontSize: 16.6,
),
),
SizedBox(height: 7.0),
Text(
model.vaccineList[index].projectName,
style: TextStyle(
fontSize: 17.0,
letterSpacing: 0.5,
),
),
SizedBox(height: 7.0),
Text(
model.vaccineList[index].vaccineName,
style: TextStyle(
fontSize: 17.0,
),
),
SizedBox(height: 7.0),
Text(
'Date Taken ' + convertDateFormat(model.vaccineList[index].invoiceDate),
style: TextStyle(fontSize: 17.0),
),
],
),
),
flex: 5,
),
],
),
],
),
),
],
);
}),
)
],
),
),
// SpaceBetweenTexts(space: 165.0), // SpaceBetweenTexts(space: 165.0),
], ],
), ),
), ),
bottomSheet: model.state == ViewState.Busy bottomSheet: Container(
? Container( color: Colors.white,
height: 0, padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21),
) child: Row(mainAxisSize: MainAxisSize.min, children: [
: model.vaccineList.length > 0 Expanded(
? Container( child: DefaultButton(
color: Theme.of(context).scaffoldBackgroundColor, TranslationBase.of(context).availability,
padding: EdgeInsets.all(12), () {
height: MediaQuery.of(context).size.height * 0.25, // Navigator.push(context, FadePage(page: MyVaccinesItemPage()));
width: double.infinity, },
child: Column( color: Color(0xffEAEAEA),
children: [ textColor: Color(0xff000000),
Divider( ),
height: 2, ),
thickness: 1, SizedBox(width: 8),
), Expanded(
SizedBox( child: DefaultButton(
height: 6, TranslationBase.of(context).sendEmail,
), () {
Container( showDialog(
width: double.infinity, context: context,
// height: 80.0, child: ConfirmSendEmailDialog(
child: Button( email: projectViewModel.user.emailAddress,
disabled: true, onTapSendEmail: () {
label: TranslationBase.of(context).checkVaccineAvailability, model.sendEmail(message: TranslationBase.of(context).emailSentSuccessfully);
backgroundColor: Color(0xff9EA3A4), },
onTap: () => Navigator.push(context, FadePage(page: MyVaccinesItemPage())),
),
),
if (projectViewModel.havePrivilege(27))
Container(
width: double.infinity,
child: DefaultButton(
TranslationBase.of(context).sendEmail,
() {
showDialog(
context: context,
child: ConfirmSendEmailDialog(
email: projectViewModel.user.emailAddress,
onTapSendEmail: () {
model.sendEmail(message: TranslationBase.of(context).emailSentSuccessfully);
},
),
);
},
),
// SecondaryButton(
// label: TranslationBase.of(context).sendEmail,
// color: Color(0xffF62426),
// textColor: Colors.white,
// disabled: model.vaccineList.length == 0,
// loading: model.state == ViewState.BusyLocal,
// onTap: () async {
// showDialog(
// context: context,
// child: ConfirmSendEmailDialog(
// email: projectViewModel.user.emailAddress,
// onTapSendEmail: () {
// // generateCovidCertificate(context, isOutsideKSA);
// model.sendEmail(message: TranslationBase.of(context).emailSentSuccessfully);
// },
// ),
// );
// // model.sendEmail(message: TranslationBase.of(context).emailSentSuccessfully);
// },
// ),
),
],
), ),
) );
: Container( },
height: 0, ))
), ])),
), ),
); );
} }
convertDateFormat(String Date) {
const start = "/Date(";
const end = "+0300)";
final startIndex = Date.indexOf(start);
final endIndex = Date.indexOf(end, startIndex + start.length);
var date = new DateTime.fromMillisecondsSinceEpoch(int.parse(Date.substring(startIndex + start.length, endIndex)));
String newDate = date.year.toString() + "-" + date.month.toString().padLeft(2, '0') + "-" + date.day.toString().padLeft(2, '0');
return newDate.toString();
}
} }

@ -21,11 +21,13 @@ class DoctorCard extends StatelessWidget {
final Function onTap; final Function onTap;
final Function onEmailTap; final Function onEmailTap;
final bool isInOutPatient; final bool isInOutPatient;
final bool isShowInOutPatient;
final bool isLiveCareAppointment; final bool isLiveCareAppointment;
final bool isSortByClinic; final bool isSortByClinic;
final String appointmentTime; final String appointmentTime;
final bool isParentAppointment; final bool isParentAppointment;
final int remainingTimeInMinutes; final int remainingTimeInMinutes;
final String vaccineName;
DoctorCard( DoctorCard(
{this.name, {this.name,
@ -41,6 +43,8 @@ class DoctorCard extends StatelessWidget {
this.isLiveCareAppointment = false, this.isLiveCareAppointment = false,
this.appointmentTime, this.appointmentTime,
this.remainingTimeInMinutes, this.remainingTimeInMinutes,
this.isShowInOutPatient = true,
this.vaccineName = "",
this.isParentAppointment = false}); this.isParentAppointment = false});
ProjectViewModel projectViewModel; ProjectViewModel projectViewModel;
@ -54,10 +58,7 @@ class DoctorCard extends StatelessWidget {
borderRadius: BorderRadius.all( borderRadius: BorderRadius.all(
Radius.circular(10.0), Radius.circular(10.0),
), ),
border: Border.all( border: Border.all(width: 1, color: Color(0xffEFEFEF)),
width: 1,
color: Color(0xffEFEFEF)
),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: Color(0xff000000).withOpacity(.05), color: Color(0xff000000).withOpacity(.05),
@ -77,21 +78,23 @@ class DoctorCard extends StatelessWidget {
height: double.infinity, height: double.infinity,
alignment: Alignment.center, alignment: Alignment.center,
padding: EdgeInsets.only(left: 2, right: 2), padding: EdgeInsets.only(left: 2, right: 2),
decoration: BoxDecoration( decoration: isShowInOutPatient
//Colors.red[900] Color(0xff404545) ? BoxDecoration(
color: isLiveCareAppointment //Colors.red[900] Color(0xff404545)
? Color(0xff2E303A) color: isLiveCareAppointment
: !isInOutPatient ? Color(0xff2E303A)
? Color(0xffD02127) : !isInOutPatient
: Color(0xffa9a089), ? Color(0xffD02127)
borderRadius: BorderRadius.only( : Color(0xffa9a089),
topLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10), borderRadius: BorderRadius.only(
bottomLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10), topLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10),
topRight: projectViewModel.isArabic ? Radius.circular(10) : Radius.circular(0), bottomLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10),
bottomRight: projectViewModel.isArabic ? Radius.circular(10) : Radius.circular(0), topRight: projectViewModel.isArabic ? Radius.circular(10) : Radius.circular(0),
), bottomRight: projectViewModel.isArabic ? Radius.circular(10) : Radius.circular(0),
), ),
child: RotatedBox( )
: BoxDecoration(),
child: isShowInOutPatient ? RotatedBox(
quarterTurns: 3, quarterTurns: 3,
child: Text( child: Text(
isLiveCareAppointment isLiveCareAppointment
@ -101,7 +104,7 @@ class DoctorCard extends StatelessWidget {
: TranslationBase.of(context).outpatient.toLowerCase().capitalizeFirstofEach, : TranslationBase.of(context).outpatient.toLowerCase().capitalizeFirstofEach,
style: TextStyle(fontSize: 10, fontWeight: FontWeight.w700, color: Colors.white, letterSpacing: -0.2, height: 16 / 10), style: TextStyle(fontSize: 10, fontWeight: FontWeight.w700, color: Colors.white, letterSpacing: -0.2, height: 16 / 10),
), ),
), ) : Container(),
), ),
Expanded( Expanded(
child: Padding( child: Padding(
@ -162,7 +165,8 @@ class DoctorCard extends StatelessWidget {
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
if (rating == null) myRichText(TranslationBase.of(context).invoiceNo, billNo ?? "", projectViewModel.isArabic), if (rating == null && billNo != "") myRichText(TranslationBase.of(context).invoiceNo, billNo ?? "", projectViewModel.isArabic),
if (vaccineName != "") myRichText("", vaccineName ?? "", projectViewModel.isArabic),
if (rating != null) if (rating != null)
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,

Loading…
Cancel
Save