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/ChildVaccines/vaccinationtable_page.dart

180 lines
7.5 KiB
Dart

import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/vaccination_table_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/reports_monthly_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'dialogs/SelectGenderDialog.dart';
class VaccinationTablePage extends StatelessWidget {
final List_BabyInformationModel babyInfo;
VaccinationTablePage(this.babyInfo);
@override
Widget build(BuildContext context) {
var size = MediaQuery.of(context).size;
final double height = (size.height - kToolbarHeight - 60);
var checkedValue;
return BaseView<VaccinationTableViewModel>(
onModelReady: (model) => model.getCreateVaccinationTable(babyInfo, false),
builder: (_, model, w) => AppScaffold(
isShowAppBar: true,
baseViewModel: model,
appBarTitle: TranslationBase.of(context).vaccination,
body: Container(
height: height * 0.85,
child: SingleChildScrollView(
child: Container(
margin: EdgeInsets.only(left: 16, right: 16, top: 16),
child: Column(
children: [
Row(
children: [
Expanded(
child: Texts(TranslationBase.of(context).childName),
),
Expanded(
child: Texts(TranslationBase.of(context).dob),
),
],
),
SizedBox(
height: 10,
),
Row(
children: [
Expanded(
child: Texts(babyInfo.babyName),
),
Expanded(
child: Texts(DateUtil.getFormattedDate(
babyInfo.dOB, "MMM dd,yyyy")),
),
],
),
SizedBox(
height: 10,
),
Divider(
color: Colors.black,
),
Row(
children: [
Text(TranslationBase.of(context).visit),
SizedBox(
width: 25,
),
Expanded(
child: Text(TranslationBase.of(context).description)),
Text(TranslationBase.of(context).dueDate),
],
),
...List.generate(
model.creteVaccinationTableModelList.length,
(index) => Container(
decoration: BoxDecoration(
shape: BoxShape.rectangle,
// border: Border.all(color: Colors.white, width: 0.5),
borderRadius: BorderRadius.all(Radius.circular(5)),
// color: Colors.white,
),
padding: EdgeInsets.all(12),
width: double.infinity,
child: Column(
children: [
Row(
children: [
Text(model
.creteVaccinationTableModelList[index]
.visit),
SizedBox(
width: 10,
),
Expanded(
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Html(
// data:"<html><head><style type='text/css'>.Test {list-style-image:url('http://10.50.100.198:4444/Images/Bullet_List_Small.png');}</style></head><body><table><tr align='left'><td align='left'>BCG</td></tr><tr align='left'><td align='left'>HEPATITIS B</td></tr></table></body></html>"//model.creteVaccinationTableModelList[index].vaccinesDescription
data: model
.creteVaccinationTableModelList[
index]
.vaccinesDescription,
),
],
),
),
Text(model
.creteVaccinationTableModelList[index]
.givenAt),
],
),
Divider(
color: Colors.black,
),
],
)))
],
),
),
),
),
bottomSheet: Container(
height: height * 0.15,
width: double.infinity,
padding: EdgeInsets.all(12),
child: SecondaryButton(
textColor: Colors.white,
color: checkedValue == false
? Colors.white24
: Color.fromRGBO(
63,
72,
74,
1,
),
label: TranslationBase.of(context).sendEmail,
//
onTap: () {
//SelectGenderDialog();
//===============
showDialog(
context: context,
child: SelectGenderDialog(
okFunction: () async {
await model.getCreateVaccinationTable(babyInfo, true);
if (model.state == ViewState.Idle) {
AppToast.showSuccessToast(
message: TranslationBase.of(context)
.emailSentSuccessfully);
} else {
AppToast.showErrorToast(
message: TranslationBase.of(context)
.EmailSentError);
}
},
),
);
//=========
}),
),
),
);
}
}