|
|
|
|
@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/config/config.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/Text.dart';
|
|
|
|
|
@ -16,6 +17,10 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|
|
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
|
|
|
|
|
|
|
|
class AddHistoryWidget extends StatefulWidget {
|
|
|
|
|
final List<MasterKeyModel> myHistoryList;
|
|
|
|
|
|
|
|
|
|
const AddHistoryWidget({Key key, this.myHistoryList}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_AddHistoryWidgetState createState() => _AddHistoryWidgetState();
|
|
|
|
|
}
|
|
|
|
|
@ -69,54 +74,63 @@ class _AddHistoryWidgetState extends State<AddHistoryWidget>
|
|
|
|
|
margin:
|
|
|
|
|
EdgeInsets.only(left: 15, right: 15, top: 15),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Texts('Abdomen Pain',
|
|
|
|
|
variant: "bodyText",
|
|
|
|
|
bold: true,
|
|
|
|
|
color: Colors.black),
|
|
|
|
|
Icon(
|
|
|
|
|
FontAwesomeIcons.trash,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
size: 20,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: widget.myHistoryList.map((myHistory) {
|
|
|
|
|
return Column(
|
|
|
|
|
children: [
|
|
|
|
|
Texts('Back Pain',
|
|
|
|
|
variant: "bodyText",
|
|
|
|
|
bold: true,
|
|
|
|
|
color: Colors.black),
|
|
|
|
|
Icon(
|
|
|
|
|
FontAwesomeIcons.trash,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
size: 20,
|
|
|
|
|
)
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Texts(myHistory.nameEn,
|
|
|
|
|
variant: "bodyText", bold: true, color: Colors.black),
|
|
|
|
|
InkWell(
|
|
|
|
|
child: Icon(
|
|
|
|
|
FontAwesomeIcons.trash,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
size: 20,
|
|
|
|
|
),
|
|
|
|
|
onTap: () => removeHistory(myHistory),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
removeHistory(MasterKeyModel masterKey) {
|
|
|
|
|
Iterable<MasterKeyModel> history = widget.myHistoryList.where((element) =>
|
|
|
|
|
masterKey.id == element.id && masterKey.typeId == element.typeId);
|
|
|
|
|
|
|
|
|
|
if (history.length > 0)
|
|
|
|
|
setState(() {
|
|
|
|
|
widget.myHistoryList.remove(history.first);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
openHistoryList(BuildContext context) {
|
|
|
|
|
showModalBottomSheet(
|
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
|
isScrollControlled: true,
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (context) {
|
|
|
|
|
return AddHistoryDialog(changePageViewIndex:changePageViewIndex, controller: _controller,);
|
|
|
|
|
return AddHistoryDialog(
|
|
|
|
|
changePageViewIndex: changePageViewIndex,
|
|
|
|
|
controller: _controller,
|
|
|
|
|
myHistoryList: widget.myHistoryList,
|
|
|
|
|
addSelectedHistories: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
removeHistory: (masterKey) => removeHistory(masterKey),
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -203,8 +217,12 @@ class _PriorityBarState extends State<PriorityBar> {
|
|
|
|
|
class AddHistoryDialog extends StatefulWidget {
|
|
|
|
|
final Function changePageViewIndex;
|
|
|
|
|
final PageController controller;
|
|
|
|
|
final List<MasterKeyModel> myHistoryList;
|
|
|
|
|
final Function addSelectedHistories;
|
|
|
|
|
final Function (MasterKeyModel) removeHistory;
|
|
|
|
|
|
|
|
|
|
const AddHistoryDialog({Key key, this.changePageViewIndex, this.controller})
|
|
|
|
|
const AddHistoryDialog(
|
|
|
|
|
{Key key, this.changePageViewIndex, this.controller, this.myHistoryList, this.addSelectedHistories, this.removeHistory})
|
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
@ -286,12 +304,28 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Checkbox(
|
|
|
|
|
value: true,
|
|
|
|
|
value: isServiceSelected(
|
|
|
|
|
historyInfo),
|
|
|
|
|
activeColor:
|
|
|
|
|
Colors.red[800],
|
|
|
|
|
Colors.red[800],
|
|
|
|
|
onChanged:
|
|
|
|
|
(bool newValue) {
|
|
|
|
|
setState(() {});
|
|
|
|
|
setState(() {
|
|
|
|
|
if (isServiceSelected(
|
|
|
|
|
historyInfo
|
|
|
|
|
)) {
|
|
|
|
|
widget
|
|
|
|
|
.removeHistory(
|
|
|
|
|
historyInfo
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
widget
|
|
|
|
|
.myHistoryList
|
|
|
|
|
.add(
|
|
|
|
|
historyInfo);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Padding(
|
|
|
|
|
@ -325,8 +359,11 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
|
|
|
|
|
),
|
|
|
|
|
if (model.state == ViewState.Idle)
|
|
|
|
|
AppButton(
|
|
|
|
|
title: "Add SELECTED HISTORIES".toUpperCase(),
|
|
|
|
|
onPressed: () {},
|
|
|
|
|
title: "Add SELECTED HISTORIES"
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
widget.addSelectedHistories();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -355,12 +392,29 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Checkbox(
|
|
|
|
|
value: true,
|
|
|
|
|
value: isServiceSelected(
|
|
|
|
|
historyInfo),
|
|
|
|
|
activeColor:
|
|
|
|
|
Colors.red[800],
|
|
|
|
|
onChanged:
|
|
|
|
|
(bool newValue) {
|
|
|
|
|
setState(() {});
|
|
|
|
|
(
|
|
|
|
|
bool newValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
if (isServiceSelected(
|
|
|
|
|
historyInfo
|
|
|
|
|
)) {
|
|
|
|
|
widget
|
|
|
|
|
.removeHistory(
|
|
|
|
|
historyInfo
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
widget
|
|
|
|
|
.myHistoryList
|
|
|
|
|
.add(
|
|
|
|
|
historyInfo);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Padding(
|
|
|
|
|
@ -394,8 +448,11 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
|
|
|
|
|
),
|
|
|
|
|
if (model.state == ViewState.Idle)
|
|
|
|
|
AppButton(
|
|
|
|
|
title: "Add SELECTED HISTORIES".toUpperCase(),
|
|
|
|
|
onPressed: () {},
|
|
|
|
|
title: "Add SELECTED HISTORIES"
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
widget.addSelectedHistories();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -424,12 +481,29 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Checkbox(
|
|
|
|
|
value: true,
|
|
|
|
|
value: isServiceSelected(
|
|
|
|
|
historyInfo),
|
|
|
|
|
activeColor:
|
|
|
|
|
Colors.red[800],
|
|
|
|
|
onChanged:
|
|
|
|
|
(bool newValue) {
|
|
|
|
|
setState(() {});
|
|
|
|
|
(
|
|
|
|
|
bool newValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
if (isServiceSelected(
|
|
|
|
|
historyInfo
|
|
|
|
|
)) {
|
|
|
|
|
widget
|
|
|
|
|
.removeHistory(
|
|
|
|
|
historyInfo
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
widget
|
|
|
|
|
.myHistoryList
|
|
|
|
|
.add(
|
|
|
|
|
historyInfo);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Padding(
|
|
|
|
|
@ -463,8 +537,13 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
|
|
|
|
|
),
|
|
|
|
|
if (model.state == ViewState.Idle)
|
|
|
|
|
AppButton(
|
|
|
|
|
title: "Add SELECTED HISTORIES".toUpperCase(),
|
|
|
|
|
onPressed: () {},
|
|
|
|
|
title: "Add SELECTED HISTORIES"
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
widget.addSelectedHistories();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -474,9 +553,22 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
isServiceSelected(MasterKeyModel masterKey) {
|
|
|
|
|
Iterable<MasterKeyModel> history =
|
|
|
|
|
widget
|
|
|
|
|
.myHistoryList
|
|
|
|
|
.where((element) =>
|
|
|
|
|
masterKey.id == element.id && masterKey.typeId == element.typeId);
|
|
|
|
|
if (history.length > 0) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|