|
|
|
import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart';
|
|
|
|
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/ChildVaccines/add_newchild_page.dart';
|
|
|
|
import 'package:diplomaticquarterapp/pages/ChildVaccines/vaccinationtable_page.dart';
|
|
|
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.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:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
|
|
|
|
|
|
|
import 'dialogs/delete_child.dart';
|
|
|
|
|
|
|
|
class ChildPage extends StatefulWidget {
|
|
|
|
@override
|
|
|
|
_ChildPageState createState() => _ChildPageState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _ChildPageState extends State<ChildPage>
|
|
|
|
with SingleTickerProviderStateMixin {
|
|
|
|
|
|
|
|
DeleteBaby deleteBaby = DeleteBaby();
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
var checkedValue = true;
|
|
|
|
return BaseView<ChildVaccinesViewModel>(
|
|
|
|
onModelReady: (model) => model.getNewUserOrders(),
|
|
|
|
builder: (_, model, widget) => AppScaffold(
|
|
|
|
isShowAppBar: true,
|
|
|
|
appBarTitle: " Vaccination",
|
|
|
|
baseViewModel: model,
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(left: 15, right: 15, top: 70),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
...List.generate(
|
|
|
|
model.babyInformationModelList.length,
|
|
|
|
(index) => 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),
|
|
|
|
width: 200,//double.infinity,
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Row(children: [
|
|
|
|
Texts("CHILD NAME"),
|
|
|
|
]),
|
|
|
|
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(),
|
|
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
);
|
|
|
|
|
|
|
|
},
|
|
|
|
)
|
|
|
|
]),
|
|
|
|
Row(children: [
|
|
|
|
Texts("Birthday"),
|
|
|
|
]),
|
|
|
|
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: "Record Deleted");
|
|
|
|
Navigator.pop(context,model.isDeleted);
|
|
|
|
}else{
|
|
|
|
|
|
|
|
//TODO handling error
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
),
|
|
|
|
Texts("Delete"),
|
|
|
|
]),
|
|
|
|
SizedBox(
|
|
|
|
height: 12,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
],
|
|
|
|
))
|
|
|
|
),
|
|
|
|
bottomSheet: Container(
|
|
|
|
height: MediaQuery.of(context).size.height * 0.12,
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.all(15),
|
|
|
|
child: SecondaryButton(
|
|
|
|
textColor: Colors.white,
|
|
|
|
color: checkedValue == false
|
|
|
|
? Colors.white24
|
|
|
|
: Color.fromRGBO(
|
|
|
|
63,
|
|
|
|
72,
|
|
|
|
74,
|
|
|
|
1,
|
|
|
|
),
|
|
|
|
label: "ADD NEW CHILD ",
|
|
|
|
//
|
|
|
|
onTap: () {
|
|
|
|
Navigator.push(
|
|
|
|
context,
|
|
|
|
MaterialPageRoute(
|
|
|
|
builder: (context) => AddNewChildPage(),
|
|
|
|
),
|
|
|
|
).then((value) {
|
|
|
|
if (value) model.getNewUserOrders();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|