You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
diplomatic-quarter/lib/pages/vaccine/my_vaccines_screen.dart

116 lines
5.0 KiB
Dart

import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_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/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/others/app_expandable_notifier.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../base/base_view.dart';
//TODO fix by jammal we have a static data
class MyVaccines extends StatefulWidget {
@override
_MyVaccinesState createState() => _MyVaccinesState();
}
class _MyVaccinesState extends State<MyVaccines> {
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<VaccineViewModel>(
onModelReady: (model) => model.getVaccine(),
builder: (BuildContext context, VaccineViewModel model, Widget child) => AppScaffold(
isShowAppBar: true,
showNewAppBar: true,
showNewAppBarTitle: true,
baseViewModel: model,
appBarTitle: TranslationBase.of(context).myVaccines,
description: TranslationBase.of(context).infoVaccines,
imagesInfo: [
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(
margin: EdgeInsets.only(top: 20.0),
child: Column(
children: <Widget>[
AppExpandableNotifier(
isExpand: true,
title: model.state == ViewState.Idle ? DateUtil.convertStringToDate(model.vaccineList[0].vaccinationDate).year.toString() : "",
bodyWidget: Container(
child: ListView.separated(
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: model.vaccineList == null ? 0 : model.vaccineList.length,
padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21),
separatorBuilder: (context, index) => SizedBox(height: 14),
itemBuilder: (BuildContext context, int index) {
return DoctorCard(
onTap: null,
isInOutPatient: true,
isShowInOutPatient: false,
name: TranslationBase.of(context).dr.toString() + " " + model.vaccineList[index].doctorName,
billNo: "",
vaccineName: model.vaccineList[index].vaccineName,
profileUrl: model.vaccineList[index].doctorImageURL,
subName: model.vaccineList[index].projectName,
isLiveCareAppointment: false,
date: DateUtil.convertStringToDate(model.vaccineList[index].vaccinationDate),
isSortByClinic: true,
);
},
),
),
),
// SpaceBetweenTexts(space: 165.0),
],
),
),
bottomSheet: Container(
color: Colors.white,
padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Expanded(
child: DefaultButton(
TranslationBase.of(context).availability,
() {
// Navigator.push(context, FadePage(page: MyVaccinesItemPage()));
},
color: Color(0xffEAEAEA),
textColor: Color(0xff000000),
),
),
SizedBox(width: 8),
Expanded(
child: DefaultButton(
TranslationBase.of(context).sendEmail,
() {
showDialog(
context: context,
child: ConfirmSendEmailDialog(
email: projectViewModel.user.emailAddress,
onTapSendEmail: () {
model.sendEmail(message: TranslationBase.of(context).emailSentSuccessfully);
},
),
);
},
),
),
],
),
),
),
);
}
}