|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/childvaccines/delete_baby_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/child_vaccines_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/theme/colors.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
@ -10,6 +11,7 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter/rendering.dart';
|
|
|
|
|
|
|
|
|
|
import '../add_newchild_page.dart';
|
|
|
|
|
import '../vaccinationtable_page.dart';
|
|
|
|
@ -31,274 +33,175 @@ class _ChildPageState extends State<ChildVaccinePage> with SingleTickerProviderS
|
|
|
|
|
|
|
|
|
|
var checkedValue = true;
|
|
|
|
|
return BaseView<ChildVaccinesViewModel>(
|
|
|
|
|
onModelReady: (model) => model.getNewUserOrders(),
|
|
|
|
|
builder: (_, model, widget) => AppScaffold(
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
appBarTitle: TranslationBase.of(context).vaccination,
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
showNewAppBarTitle: true,
|
|
|
|
|
showNewAppBar: true,
|
|
|
|
|
body: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
return InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: VaccinationTablePage(model.babyInformationModelList[index]),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
margin: EdgeInsets.only(left: 0, right: 0, bottom: 20),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
shape: BoxShape.rectangle,
|
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(12)),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
gradient: LinearGradient(
|
|
|
|
|
colors: model.babyInformationModelList[index].gender == 1
|
|
|
|
|
? [
|
|
|
|
|
Color(0xFFFDA4B0),
|
|
|
|
|
Color(0xFFFBC8CC),
|
|
|
|
|
]
|
|
|
|
|
: [
|
|
|
|
|
Color(0xFF6EA8FF),
|
|
|
|
|
Color(0xFF7AB8FD),
|
|
|
|
|
],
|
|
|
|
|
begin: Alignment.centerLeft,
|
|
|
|
|
end: Alignment.centerRight,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
padding: EdgeInsets.all(12),
|
|
|
|
|
//double.infinity,
|
|
|
|
|
onModelReady: (model) => model.getNewUserOrders(),
|
|
|
|
|
builder: (_, model, widget) => AppScaffold(
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
appBarTitle: TranslationBase.of(context).vaccination,
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
showNewAppBarTitle: true,
|
|
|
|
|
showNewAppBar: true,
|
|
|
|
|
body: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
Color selectedColor = model.babyInformationModelList[index].gender == 1 ? Color(0xFF5A282E) : Colors.white;
|
|
|
|
|
return InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: VaccinationTablePage(model.babyInformationModelList[index]),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
margin: EdgeInsets.only(left: 16, right: 16),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
shape: BoxShape.rectangle,
|
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(12)),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
gradient: LinearGradient(
|
|
|
|
|
colors: model.babyInformationModelList[index].gender == 1
|
|
|
|
|
? [
|
|
|
|
|
Color(0xFFFDA4B0),
|
|
|
|
|
Color(0xFFFBC8CC),
|
|
|
|
|
]
|
|
|
|
|
: [
|
|
|
|
|
Color(0xFF6EA8FF),
|
|
|
|
|
Color(0xFF7AB8FD),
|
|
|
|
|
],
|
|
|
|
|
begin: Alignment.centerLeft,
|
|
|
|
|
end: Alignment.centerRight,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
padding: EdgeInsets.all(12),
|
|
|
|
|
//double.infinity,
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Texts(model.babyInformationModelList[index].babyName.trim()),
|
|
|
|
|
Row(children: [
|
|
|
|
|
IconButton(
|
|
|
|
|
icon: Image.asset(model.babyInformationModelList[index].gender == 1 ? 'assets/images/new-design/male.png' : 'assets/images/new-design/female.png'),
|
|
|
|
|
tooltip: '',
|
|
|
|
|
onPressed: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
// _volume += 10;
|
|
|
|
|
// launch("tel://" +model.FindusHospitalModelList[index].phoneNumber);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
Text(
|
|
|
|
|
model.babyInformationModelList[index].babyName.trim(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
letterSpacing: -0.46,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
color: selectedColor,
|
|
|
|
|
),
|
|
|
|
|
Texts(model.babyInformationModelList[index].genderDescription),
|
|
|
|
|
IconButton(
|
|
|
|
|
icon: Icon(
|
|
|
|
|
Icons.remove_red_eye,
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
),
|
|
|
|
|
tooltip: '',
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: VaccinationTablePage(model.babyInformationModelList[index]),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
]),
|
|
|
|
|
Row(children: [
|
|
|
|
|
Texts(TranslationBase.of(context).dob),
|
|
|
|
|
]),
|
|
|
|
|
Row(children: [
|
|
|
|
|
IconButton(
|
|
|
|
|
icon: new Image.asset('assets/images/new-design/calender-secondary.png'),
|
|
|
|
|
tooltip: '',
|
|
|
|
|
onPressed: () {
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
model.babyInformationModelList[index].gender == 1 ? TranslationBase.of(context).female : TranslationBase.of(context).male,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 11,
|
|
|
|
|
color: selectedColor,
|
|
|
|
|
),
|
|
|
|
|
Texts(DateUtil.yearMonthDay(model.babyInformationModelList[index].dOB)),
|
|
|
|
|
]),
|
|
|
|
|
Row(children: [
|
|
|
|
|
IconButton(
|
|
|
|
|
icon: new Image.asset('assets/images/new-design/garbage.png'),
|
|
|
|
|
tooltip: '',
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
//=====================
|
|
|
|
|
await model.deleteBabyOrders(newChild: deleteBaby);
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).dob,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 11,
|
|
|
|
|
color: selectedColor,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Text(DateUtil.yearMonthDay(model.babyInformationModelList[index].dOB),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 11,
|
|
|
|
|
color: selectedColor,
|
|
|
|
|
)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
mHeight(20),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () async {
|
|
|
|
|
await model.deleteBabyOrders(newChild: deleteBaby);
|
|
|
|
|
|
|
|
|
|
deleteBaby.babyID = model.babyInformationModelList[index].babyID;
|
|
|
|
|
deleteBaby.babyID = model.babyInformationModelList[index].babyID;
|
|
|
|
|
|
|
|
|
|
await model.deleteBabyOrders(newChild: deleteBaby);
|
|
|
|
|
if (model.isDeleted) {
|
|
|
|
|
AppToast.showSuccessToast(message: TranslationBase.of(context).recordDeleted);
|
|
|
|
|
Navigator.pop(context, model.isDeleted);
|
|
|
|
|
} else {
|
|
|
|
|
//TODO handling error
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
await model.deleteBabyOrders(newChild: deleteBaby);
|
|
|
|
|
if (model.isDeleted) {
|
|
|
|
|
AppToast.showSuccessToast(message: TranslationBase.of(context).recordDeleted);
|
|
|
|
|
Navigator.pop(context, model.isDeleted);
|
|
|
|
|
} else {
|
|
|
|
|
//TODO handling error
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
decoration: containerRadius(Colors.black.withOpacity(0.2), 2000),
|
|
|
|
|
padding: EdgeInsets.only(left: 12, right: 12, top: 8, bottom: 8),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Image.asset(
|
|
|
|
|
'assets/images/new-design/garbage.png',
|
|
|
|
|
width: 16,
|
|
|
|
|
color: selectedColor,
|
|
|
|
|
),
|
|
|
|
|
Texts(TranslationBase.of(context).deleteView),
|
|
|
|
|
]),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 12,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
mWidth(8),
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).deleteView,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 11,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
letterSpacing: -0.33,
|
|
|
|
|
color: selectedColor,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (BuildContext context, int index) {
|
|
|
|
|
return mHeight(12);
|
|
|
|
|
},
|
|
|
|
|
itemCount: model.babyInformationModelList.length,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
// Container(
|
|
|
|
|
// height: height * 0.85,
|
|
|
|
|
// child: SingleChildScrollView(
|
|
|
|
|
// child: Container(
|
|
|
|
|
// margin: EdgeInsets.only(left: 8, right: 8, top: 16),
|
|
|
|
|
// child: GridView.count(
|
|
|
|
|
// crossAxisCount: 2,
|
|
|
|
|
// childAspectRatio: (itemWidth / (itemHeight + 0)),
|
|
|
|
|
// crossAxisSpacing: 10,
|
|
|
|
|
// mainAxisSpacing: 10,
|
|
|
|
|
// controller: ScrollController(keepScrollOffset: true),
|
|
|
|
|
// shrinkWrap: true,
|
|
|
|
|
// padding: const EdgeInsets.all(4.0),
|
|
|
|
|
// children: [
|
|
|
|
|
// ...List.generate(
|
|
|
|
|
// model.babyInformationModelList.length,
|
|
|
|
|
// (index) => InkWell(
|
|
|
|
|
// onTap: () {
|
|
|
|
|
// Navigator.push(
|
|
|
|
|
// context,
|
|
|
|
|
// FadePage(
|
|
|
|
|
// page: VaccinationTablePage(model.babyInformationModelList[index]),
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
// },
|
|
|
|
|
// child: Container(
|
|
|
|
|
// margin: EdgeInsets.only(left: 0, right: 0, bottom: 20),
|
|
|
|
|
// 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),
|
|
|
|
|
// //double.infinity,
|
|
|
|
|
// child: Column(
|
|
|
|
|
// children: [
|
|
|
|
|
// Row(children: [
|
|
|
|
|
// Texts(TranslationBase.of(context).childName),
|
|
|
|
|
// ]),
|
|
|
|
|
// Row(children: [
|
|
|
|
|
// Texts(model.babyInformationModelList[index].babyName.trim()),
|
|
|
|
|
// ]),
|
|
|
|
|
// Row(children: [
|
|
|
|
|
// IconButton(
|
|
|
|
|
// icon: Image.asset(model.babyInformationModelList[index].gender == 1 ? 'assets/images/new-design/male.png' : 'assets/images/new-design/female.png'),
|
|
|
|
|
// tooltip: '',
|
|
|
|
|
// onPressed: () {
|
|
|
|
|
// setState(() {
|
|
|
|
|
// // _volume += 10;
|
|
|
|
|
// // launch("tel://" +model.FindusHospitalModelList[index].phoneNumber);
|
|
|
|
|
// });
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// Texts(model.babyInformationModelList[index].genderDescription),
|
|
|
|
|
// IconButton(
|
|
|
|
|
// icon: Icon(
|
|
|
|
|
// Icons.remove_red_eye,
|
|
|
|
|
// color: Colors.red,
|
|
|
|
|
// ),
|
|
|
|
|
// tooltip: '',
|
|
|
|
|
// onPressed: () {
|
|
|
|
|
// Navigator.push(
|
|
|
|
|
// context,
|
|
|
|
|
// FadePage(
|
|
|
|
|
// page: VaccinationTablePage(model.babyInformationModelList[index]),
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
// },
|
|
|
|
|
// )
|
|
|
|
|
// ]),
|
|
|
|
|
// Row(children: [
|
|
|
|
|
// Texts(TranslationBase.of(context).dob),
|
|
|
|
|
// ]),
|
|
|
|
|
// Row(children: [
|
|
|
|
|
// IconButton(
|
|
|
|
|
// icon: new Image.asset('assets/images/new-design/calender-secondary.png'),
|
|
|
|
|
// tooltip: '',
|
|
|
|
|
// onPressed: () {
|
|
|
|
|
// setState(() {});
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// Texts(DateUtil.yearMonthDay(model.babyInformationModelList[index].dOB)),
|
|
|
|
|
// ]),
|
|
|
|
|
// Row(children: [
|
|
|
|
|
// IconButton(
|
|
|
|
|
// icon: new Image.asset('assets/images/new-design/garbage.png'),
|
|
|
|
|
// tooltip: '',
|
|
|
|
|
// onPressed: () async {
|
|
|
|
|
// //=====================
|
|
|
|
|
// await model.deleteBabyOrders(newChild: deleteBaby);
|
|
|
|
|
//
|
|
|
|
|
// deleteBaby.babyID = model.babyInformationModelList[index].babyID;
|
|
|
|
|
//
|
|
|
|
|
// await model.deleteBabyOrders(newChild: deleteBaby);
|
|
|
|
|
// if (model.isDeleted) {
|
|
|
|
|
// AppToast.showSuccessToast(message: TranslationBase.of(context).recordDeleted);
|
|
|
|
|
// Navigator.pop(context, model.isDeleted);
|
|
|
|
|
// } else {
|
|
|
|
|
// //TODO handling error
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// Texts(TranslationBase.of(context).deleteView),
|
|
|
|
|
// ]),
|
|
|
|
|
// SizedBox(
|
|
|
|
|
// height: 12,
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// )
|
|
|
|
|
// ],
|
|
|
|
|
// ))),
|
|
|
|
|
// ),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (BuildContext context, int index) {
|
|
|
|
|
return mHeight(12);
|
|
|
|
|
},
|
|
|
|
|
itemCount: model.babyInformationModelList.length,
|
|
|
|
|
),
|
|
|
|
|
bottomSheet: Container(
|
|
|
|
|
height: height * 0.15,
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
padding: EdgeInsets.all(16),
|
|
|
|
|
child: SecondaryButton(
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
color: checkedValue == false
|
|
|
|
|
? Colors.white24
|
|
|
|
|
: Color.fromRGBO(
|
|
|
|
|
63,
|
|
|
|
|
72,
|
|
|
|
|
74,
|
|
|
|
|
1,
|
|
|
|
|
),
|
|
|
|
|
label: TranslationBase.of(context).addNewChild,
|
|
|
|
|
//
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: AddNewChildPage(),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
padding: EdgeInsets.all(16),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: SecondaryButton(
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
color: checkedValue
|
|
|
|
|
? CustomColors.accentColor
|
|
|
|
|
: Color.fromRGBO(
|
|
|
|
|
63,
|
|
|
|
|
72,
|
|
|
|
|
74,
|
|
|
|
|
1,
|
|
|
|
|
),
|
|
|
|
|
).then((value) {
|
|
|
|
|
if (value) model.getNewUserOrders();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
label: TranslationBase.of(context).addNewChild,
|
|
|
|
|
//
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: AddNewChildPage(),
|
|
|
|
|
),
|
|
|
|
|
).then((value) {
|
|
|
|
|
if (value) model.getNewUserOrders();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
));
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|