refactor code in subjective
parent
9a8ca00eec
commit
3e7bf817f3
@ -0,0 +1,203 @@
|
|||||||
|
import 'package:autocomplete_textfield/autocomplete_textfield.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.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/app_scaffold_widget.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/master_key_checkbox_search_allergies_widget.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../bottom_sheet_title.dart';
|
||||||
|
|
||||||
|
class AddAllergies extends StatefulWidget {
|
||||||
|
final Function addAllergiesFun;
|
||||||
|
final List<MySelectedAllergy> myAllergiesList;
|
||||||
|
|
||||||
|
const AddAllergies({Key key, this.addAllergiesFun, this.myAllergiesList})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_AddAllergiesState createState() => _AddAllergiesState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AddAllergiesState extends State<AddAllergies> {
|
||||||
|
List<MasterKeyModel> allergiesList;
|
||||||
|
List<MasterKeyModel> allergySeverityList;
|
||||||
|
MasterKeyModel _selectedAllergySeverity;
|
||||||
|
MasterKeyModel _selectedAllergy;
|
||||||
|
TextEditingController remarkController = TextEditingController();
|
||||||
|
TextEditingController severityController = TextEditingController();
|
||||||
|
TextEditingController allergyController = TextEditingController();
|
||||||
|
List<MySelectedAllergy> myAllergiesListLocal;
|
||||||
|
|
||||||
|
@override
|
||||||
|
initState() {
|
||||||
|
super.initState();
|
||||||
|
myAllergiesListLocal = [...widget.myAllergiesList];
|
||||||
|
}
|
||||||
|
|
||||||
|
GlobalKey key = new GlobalKey<AutoCompleteTextFieldState<MasterKeyModel>>();
|
||||||
|
bool isFormSubmitted = false;
|
||||||
|
|
||||||
|
InputDecoration textFieldSelectorDecoration(
|
||||||
|
String hintText, String selectedText, bool isDropDown,
|
||||||
|
{IconData icon}) {
|
||||||
|
return InputDecoration(
|
||||||
|
contentPadding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Colors.grey, width: 1.0),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Colors.grey, width: 1.0),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
disabledBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Colors.grey, width: 1.0),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
hintText: selectedText != null ? selectedText : hintText,
|
||||||
|
suffixIcon: isDropDown ? Icon(icon ?? Icons.arrow_drop_down) : null,
|
||||||
|
hintStyle: TextStyle(
|
||||||
|
fontSize: 10,
|
||||||
|
color: Theme.of(context).hintColor,
|
||||||
|
fontWeight: FontWeight.w700),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
ProjectViewModel projectViewModel = Provider.of(context);
|
||||||
|
final screenSize = MediaQuery.of(context).size;
|
||||||
|
return FractionallySizedBox(
|
||||||
|
heightFactor: 1,
|
||||||
|
child: BaseView<SOAPViewModel>(
|
||||||
|
onModelReady: (model) async {
|
||||||
|
if (model.allergiesList.length == 0) {
|
||||||
|
await model.getMasterLookup(MasterKeysService.Allergies);
|
||||||
|
}
|
||||||
|
if (model.allergySeverityList.length == 0) {
|
||||||
|
await model.getMasterLookup(MasterKeysService.AllergySeverity);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
builder: (_, model, w) => AppScaffold(
|
||||||
|
baseViewModel: model,
|
||||||
|
isShowAppBar: false,
|
||||||
|
body: Center(
|
||||||
|
child: Container(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
BottomSheetTitle(
|
||||||
|
title: TranslationBase.of(context).addAllergies,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 16,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Center(
|
||||||
|
child: FractionallySizedBox(
|
||||||
|
widthFactor: 0.9,
|
||||||
|
child: Center(
|
||||||
|
child: NetworkBaseView(
|
||||||
|
baseViewModel: model,
|
||||||
|
child: MasterKeyCheckboxSearchAllergiesWidget(
|
||||||
|
model: model,
|
||||||
|
masterList: model.allergiesList,
|
||||||
|
removeAllergy: (master) {
|
||||||
|
setState(() {
|
||||||
|
removeAllergyFromLocalList(master);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addAllergy:
|
||||||
|
(MySelectedAllergy mySelectedAllergy) {
|
||||||
|
AddAllergyLocally(mySelectedAllergy);
|
||||||
|
},
|
||||||
|
addSelectedAllergy: () => widget
|
||||||
|
.addAllergiesFun(myAllergiesListLocal),
|
||||||
|
isServiceSelected: (master) =>
|
||||||
|
isServiceSelected(master),
|
||||||
|
getServiceSelectedAllergy: (master) =>
|
||||||
|
getSelectedAllergy(master),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
isServiceSelected(MasterKeyModel masterKey) {
|
||||||
|
Iterable<MySelectedAllergy> allergy = myAllergiesListLocal.where(
|
||||||
|
(element) =>
|
||||||
|
masterKey.id == element.selectedAllergy.id &&
|
||||||
|
masterKey.typeId == element.selectedAllergy.typeId &&
|
||||||
|
element.isChecked);
|
||||||
|
if (allergy.length > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
removeAllergyFromLocalList(MasterKeyModel masterKey) {
|
||||||
|
myAllergiesListLocal
|
||||||
|
.removeWhere((element) => element.selectedAllergy.id == masterKey.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
MySelectedAllergy getSelectedAllergy(MasterKeyModel masterKey) {
|
||||||
|
Iterable<MySelectedAllergy> allergy = myAllergiesListLocal.where(
|
||||||
|
(element) =>
|
||||||
|
masterKey.id == element.selectedAllergy.id &&
|
||||||
|
masterKey.typeId == element.selectedAllergy.typeId &&
|
||||||
|
element.isChecked);
|
||||||
|
if (allergy.length > 0) {
|
||||||
|
return allergy.first;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
AddAllergyLocally(MySelectedAllergy mySelectedAllergy) {
|
||||||
|
if (mySelectedAllergy.selectedAllergy == null) {
|
||||||
|
helpers.showErrorToast(TranslationBase.of(context).requiredMsg);
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
List<MySelectedAllergy> allergy =
|
||||||
|
// ignore: missing_return
|
||||||
|
myAllergiesListLocal
|
||||||
|
.where((element) =>
|
||||||
|
mySelectedAllergy.selectedAllergy.id ==
|
||||||
|
element.selectedAllergy.id)
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
if (allergy.isEmpty) {
|
||||||
|
myAllergiesListLocal.add(mySelectedAllergy);
|
||||||
|
// Navigator.of(context).pop();
|
||||||
|
} else {
|
||||||
|
allergy.first.selectedAllergy = mySelectedAllergy.selectedAllergy;
|
||||||
|
allergy.first.selectedAllergySeverity =
|
||||||
|
mySelectedAllergy.selectedAllergySeverity;
|
||||||
|
allergy.first.remark = mySelectedAllergy.remark;
|
||||||
|
allergy.first.isChecked = mySelectedAllergy.isChecked;
|
||||||
|
// Navigator.of(context).pop();
|
||||||
|
|
||||||
|
// helpers.showErrorToast(TranslationBase
|
||||||
|
// .of(context)
|
||||||
|
// .itemExist);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
|
||||||
|
class BottomSheetTitle extends StatelessWidget {
|
||||||
|
const BottomSheetTitle({
|
||||||
|
Key key, this.title,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
final String title;
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
left: 0, right: 5, bottom: 5, top: 5),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
height: 115,
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
left: 10, right: 10),
|
||||||
|
margin: EdgeInsets.only(top: 60),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
RichText(
|
||||||
|
text: TextSpan(
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize:20,
|
||||||
|
color: Colors.black),
|
||||||
|
children: <TextSpan>[
|
||||||
|
new TextSpan(
|
||||||
|
|
||||||
|
text: title,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Color(0xFF2B353E),
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontFamily: 'Poppins',
|
||||||
|
fontSize: 20)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Icon(DoctorApp.close_1,
|
||||||
|
size:20,
|
||||||
|
color: Color(0xFF2B353E)))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,193 @@
|
|||||||
|
import 'package:doctor_app_flutter/core/enum/master_lookup_key.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/models/SOAP/my_selected_history.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/app_scaffold_widget.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/master_key_checkbox_search_widget.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../PriorityBar.dart';
|
||||||
|
import '../bottom_sheet_title.dart';
|
||||||
|
|
||||||
|
class AddHistoryDialog extends StatefulWidget {
|
||||||
|
final Function changePageViewIndex;
|
||||||
|
final PageController controller;
|
||||||
|
final List<MySelectedHistory> myHistoryList;
|
||||||
|
final Function addSelectedHistories;
|
||||||
|
final Function (MasterKeyModel) removeHistory;
|
||||||
|
|
||||||
|
const AddHistoryDialog(
|
||||||
|
{Key key, this.changePageViewIndex, this.controller, this.myHistoryList, this.addSelectedHistories, this.removeHistory})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_AddHistoryDialogState createState() => _AddHistoryDialogState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AddHistoryDialogState extends State<AddHistoryDialog> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return FractionallySizedBox(
|
||||||
|
heightFactor: 1,
|
||||||
|
child: BaseView<SOAPViewModel>(
|
||||||
|
onModelReady: (model) async {
|
||||||
|
if (model.historyFamilyList.length == 0) {
|
||||||
|
await model.getMasterLookup(MasterKeysService.HistoryFamily);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model.historySurgicalList.length == 0) {
|
||||||
|
await model.getMasterLookup(MasterKeysService.HistorySurgical);
|
||||||
|
await model.getMasterLookup(MasterKeysService.HistorySports);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model.historyMedicalList.length == 0) {
|
||||||
|
await model.getMasterLookup(MasterKeysService.HistoryMedical);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
builder: (_, model, w) => AppScaffold(
|
||||||
|
baseViewModel: model,
|
||||||
|
isShowAppBar: false,
|
||||||
|
body: Center(
|
||||||
|
child: Container(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
BottomSheetTitle(title:TranslationBase.of(context).addHistory),
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
PriorityBar(onTap: (activePriority) async {
|
||||||
|
widget.changePageViewIndex(activePriority);
|
||||||
|
}),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: FractionallySizedBox(
|
||||||
|
widthFactor: 0.9,
|
||||||
|
child: PageView(
|
||||||
|
physics: NeverScrollableScrollPhysics(),
|
||||||
|
controller: widget.controller,
|
||||||
|
onPageChanged: (index) {
|
||||||
|
setState(() {
|
||||||
|
// currentIndex = index;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
children: <Widget>[
|
||||||
|
NetworkBaseView(
|
||||||
|
baseViewModel: model,
|
||||||
|
child: MasterKeyCheckboxSearchWidget(
|
||||||
|
model: model,
|
||||||
|
masterList: model.historyFamilyList,
|
||||||
|
removeHistory: (history){
|
||||||
|
setState(() {
|
||||||
|
widget.removeHistory(history);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addHistory: (history){
|
||||||
|
setState(() {
|
||||||
|
createAndAddHistory(
|
||||||
|
history);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addSelectedHistories: (){
|
||||||
|
widget.addSelectedHistories();
|
||||||
|
},
|
||||||
|
isServiceSelected: (master) =>isServiceSelected(master),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
NetworkBaseView(
|
||||||
|
baseViewModel: model,
|
||||||
|
child: MasterKeyCheckboxSearchWidget(
|
||||||
|
model: model,
|
||||||
|
masterList: model.mergeHistorySurgicalWithHistorySportList,
|
||||||
|
removeHistory: (history){
|
||||||
|
setState(() {
|
||||||
|
widget.removeHistory(history);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addHistory: (history){
|
||||||
|
setState(() {
|
||||||
|
createAndAddHistory(
|
||||||
|
history);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addSelectedHistories: (){
|
||||||
|
widget.addSelectedHistories();
|
||||||
|
},
|
||||||
|
isServiceSelected: (master) =>isServiceSelected(master),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
NetworkBaseView(
|
||||||
|
baseViewModel: model,
|
||||||
|
child: MasterKeyCheckboxSearchWidget(
|
||||||
|
model: model,
|
||||||
|
masterList: model.historyMedicalList,
|
||||||
|
removeHistory: (history){
|
||||||
|
setState(() {
|
||||||
|
widget.removeHistory(history);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addHistory: (history){
|
||||||
|
setState(() {
|
||||||
|
createAndAddHistory(
|
||||||
|
history);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addSelectedHistories: (){
|
||||||
|
widget.addSelectedHistories();
|
||||||
|
},
|
||||||
|
isServiceSelected: (master) =>isServiceSelected(master),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
createAndAddHistory(MasterKeyModel history) {
|
||||||
|
List<MySelectedHistory> myhistory = widget.myHistoryList.where((element) =>
|
||||||
|
history.id ==
|
||||||
|
element.selectedHistory.id &&
|
||||||
|
history.typeId ==
|
||||||
|
element.selectedHistory.typeId
|
||||||
|
).toList();
|
||||||
|
|
||||||
|
if (myhistory.isEmpty) {
|
||||||
|
setState(() {
|
||||||
|
MySelectedHistory mySelectedHistory = MySelectedHistory(
|
||||||
|
remark: history.remarks ?? "",
|
||||||
|
selectedHistory: history,
|
||||||
|
isChecked: true);
|
||||||
|
widget.myHistoryList.add(mySelectedHistory);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
myhistory.first.isChecked = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
isServiceSelected(MasterKeyModel masterKey) {
|
||||||
|
Iterable<MySelectedHistory> history =
|
||||||
|
widget
|
||||||
|
.myHistoryList
|
||||||
|
.where((element) =>
|
||||||
|
masterKey.id == element.selectedHistory.id &&
|
||||||
|
masterKey.typeId == element.selectedHistory.typeId &&
|
||||||
|
element.isChecked);
|
||||||
|
if (history.length > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,223 @@
|
|||||||
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/models/SOAP/my_selected_history.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';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/master_key_checkbox_search_widget.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
|
||||||
|
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:hexcolor/hexcolor.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../PriorityBar.dart';
|
||||||
|
import '../bottom_sheet_title.dart';
|
||||||
|
import 'add_history_dialog.dart';
|
||||||
|
|
||||||
|
class UpdateHistoryWidget extends StatefulWidget {
|
||||||
|
final List<MySelectedHistory> myHistoryList;
|
||||||
|
|
||||||
|
const UpdateHistoryWidget({Key key, this.myHistoryList}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_UpdateHistoryWidgetState createState() => _UpdateHistoryWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _UpdateHistoryWidgetState extends State<UpdateHistoryWidget>
|
||||||
|
with TickerProviderStateMixin {
|
||||||
|
PageController _controller;
|
||||||
|
int _currentIndex = 0;
|
||||||
|
|
||||||
|
changePageViewIndex(pageIndex) {
|
||||||
|
_controller.jumpToPage(pageIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
_controller = new PageController();
|
||||||
|
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
ProjectViewModel projectViewModel = Provider.of(context);
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
openHistoryList(context);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
vertical: 8, horizontal: 8.0),
|
||||||
|
margin:
|
||||||
|
EdgeInsets.symmetric(vertical: 8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(
|
||||||
|
color: Colors.grey.shade400,
|
||||||
|
width: 0.5),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(8),
|
||||||
|
),
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
AppText(
|
||||||
|
"${TranslationBase.of(context).addHistory}",
|
||||||
|
fontSize: SizeConfig
|
||||||
|
.textMultiplier *
|
||||||
|
1.8,
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
AppText(
|
||||||
|
"${TranslationBase.of(context).searchHere}",
|
||||||
|
fontSize: SizeConfig
|
||||||
|
.textMultiplier *
|
||||||
|
1.8,
|
||||||
|
color: Colors.grey.shade700,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
Icon(
|
||||||
|
Icons.add_box_rounded,
|
||||||
|
size: 25,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin:
|
||||||
|
EdgeInsets.only(left: 15, right: 15, top: 15),
|
||||||
|
child: Column(
|
||||||
|
children: widget.myHistoryList.map((myHistory) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: Texts(
|
||||||
|
projectViewModel.isArabic
|
||||||
|
? myHistory.selectedHistory.nameAr
|
||||||
|
: myHistory.selectedHistory.nameEn,
|
||||||
|
fontSize: 15,
|
||||||
|
textDecoration: myHistory.isChecked
|
||||||
|
? null
|
||||||
|
: TextDecoration.lineThrough,
|
||||||
|
// bold: true,
|
||||||
|
color: Colors.black),
|
||||||
|
width: MediaQuery
|
||||||
|
.of(context)
|
||||||
|
.size
|
||||||
|
.width * 0.5,
|
||||||
|
),
|
||||||
|
if (myHistory.isChecked)
|
||||||
|
InkWell(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: Texts(
|
||||||
|
TranslationBase
|
||||||
|
.of(context)
|
||||||
|
.remove,
|
||||||
|
fontSize: 15,
|
||||||
|
variant: "bodyText",
|
||||||
|
textDecoration: myHistory.isChecked
|
||||||
|
? null
|
||||||
|
: TextDecoration.lineThrough,
|
||||||
|
// bold: true,
|
||||||
|
color: HexColor("#B8382C"),),
|
||||||
|
// width: MediaQuery.of(context).size.width * 0.3,
|
||||||
|
),
|
||||||
|
Icon(
|
||||||
|
FontAwesomeIcons.times,
|
||||||
|
color: HexColor("#B8382C"),
|
||||||
|
size: 17,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
onTap: () => removeHistory(myHistory.selectedHistory),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
removeHistory(MasterKeyModel historyKey) {
|
||||||
|
List<MySelectedHistory> history =
|
||||||
|
// ignore: missing_return
|
||||||
|
widget.myHistoryList.where((element) =>
|
||||||
|
historyKey.id ==
|
||||||
|
element.selectedHistory.id &&
|
||||||
|
historyKey.typeId ==
|
||||||
|
element.selectedHistory.typeId
|
||||||
|
).toList();
|
||||||
|
|
||||||
|
|
||||||
|
if (history.length > 0)
|
||||||
|
setState(() {
|
||||||
|
history[0].isChecked = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
openHistoryList(BuildContext context) {
|
||||||
|
showModalBottomSheet(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
isDismissible: false,
|
||||||
|
isScrollControlled: true,
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return FractionallySizedBox(
|
||||||
|
heightFactor: 1,
|
||||||
|
child: AddHistoryDialog(
|
||||||
|
changePageViewIndex: changePageViewIndex,
|
||||||
|
controller: _controller,
|
||||||
|
myHistoryList: widget.myHistoryList,
|
||||||
|
addSelectedHistories: () {
|
||||||
|
setState(() {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
removeHistory: (masterKey) => removeHistory(masterKey),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,444 +0,0 @@
|
|||||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/models/SOAP/my_selected_history.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';
|
|
||||||
import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/shared/master_key_checkbox_search_widget.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
|
|
||||||
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|
||||||
import 'package:hexcolor/hexcolor.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
|
|
||||||
import 'PriorityBar.dart';
|
|
||||||
|
|
||||||
class UpdateHistoryWidget extends StatefulWidget {
|
|
||||||
final List<MySelectedHistory> myHistoryList;
|
|
||||||
|
|
||||||
const UpdateHistoryWidget({Key key, this.myHistoryList}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
_UpdateHistoryWidgetState createState() => _UpdateHistoryWidgetState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _UpdateHistoryWidgetState extends State<UpdateHistoryWidget>
|
|
||||||
with TickerProviderStateMixin {
|
|
||||||
PageController _controller;
|
|
||||||
int _currentIndex = 0;
|
|
||||||
|
|
||||||
changePageViewIndex(pageIndex) {
|
|
||||||
_controller.jumpToPage(pageIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
_controller = new PageController();
|
|
||||||
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
ProjectViewModel projectViewModel = Provider.of(context);
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
InkWell(
|
|
||||||
onTap: () {
|
|
||||||
openHistoryList(context);
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
padding: EdgeInsets.symmetric(
|
|
||||||
vertical: 8, horizontal: 8.0),
|
|
||||||
margin:
|
|
||||||
EdgeInsets.symmetric(vertical: 8),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border.all(
|
|
||||||
color: Colors.grey.shade400,
|
|
||||||
width: 0.5),
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(8),
|
|
||||||
),
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment:
|
|
||||||
MainAxisAlignment.spaceBetween,
|
|
||||||
crossAxisAlignment:
|
|
||||||
CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment:
|
|
||||||
CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
AppText(
|
|
||||||
"${TranslationBase.of(context).addHistory}",
|
|
||||||
fontSize: SizeConfig
|
|
||||||
.textMultiplier *
|
|
||||||
1.8,
|
|
||||||
color: Colors.black,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
AppText(
|
|
||||||
"${TranslationBase.of(context).searchHere}",
|
|
||||||
fontSize: SizeConfig
|
|
||||||
.textMultiplier *
|
|
||||||
1.8,
|
|
||||||
color: Colors.grey.shade700,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
Icon(
|
|
||||||
Icons.add_box_rounded,
|
|
||||||
size: 25,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
margin:
|
|
||||||
EdgeInsets.only(left: 15, right: 15, top: 15),
|
|
||||||
child: Column(
|
|
||||||
children: widget.myHistoryList.map((myHistory) {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
child: Texts(
|
|
||||||
projectViewModel.isArabic
|
|
||||||
? myHistory.selectedHistory.nameAr
|
|
||||||
: myHistory.selectedHistory.nameEn,
|
|
||||||
fontSize: 15,
|
|
||||||
textDecoration: myHistory.isChecked
|
|
||||||
? null
|
|
||||||
: TextDecoration.lineThrough,
|
|
||||||
// bold: true,
|
|
||||||
color: Colors.black),
|
|
||||||
width: MediaQuery
|
|
||||||
.of(context)
|
|
||||||
.size
|
|
||||||
.width * 0.5,
|
|
||||||
),
|
|
||||||
if (myHistory.isChecked)
|
|
||||||
InkWell(
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
child: Texts(
|
|
||||||
TranslationBase
|
|
||||||
.of(context)
|
|
||||||
.remove,
|
|
||||||
fontSize: 15,
|
|
||||||
variant: "bodyText",
|
|
||||||
textDecoration: myHistory.isChecked
|
|
||||||
? null
|
|
||||||
: TextDecoration.lineThrough,
|
|
||||||
// bold: true,
|
|
||||||
color: HexColor("#B8382C"),),
|
|
||||||
// width: MediaQuery.of(context).size.width * 0.3,
|
|
||||||
),
|
|
||||||
Icon(
|
|
||||||
FontAwesomeIcons.times,
|
|
||||||
color: HexColor("#B8382C"),
|
|
||||||
size: 17,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
onTap: () => removeHistory(myHistory.selectedHistory),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}).toList(),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
removeHistory(MasterKeyModel historyKey) {
|
|
||||||
List<MySelectedHistory> history =
|
|
||||||
// ignore: missing_return
|
|
||||||
widget.myHistoryList.where((element) =>
|
|
||||||
historyKey.id ==
|
|
||||||
element.selectedHistory.id &&
|
|
||||||
historyKey.typeId ==
|
|
||||||
element.selectedHistory.typeId
|
|
||||||
).toList();
|
|
||||||
|
|
||||||
|
|
||||||
if (history.length > 0)
|
|
||||||
setState(() {
|
|
||||||
history[0].isChecked = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
openHistoryList(BuildContext context) {
|
|
||||||
showModalBottomSheet(
|
|
||||||
backgroundColor: Colors.white,
|
|
||||||
isDismissible: false,
|
|
||||||
isScrollControlled: true,
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return FractionallySizedBox(
|
|
||||||
heightFactor: 1,
|
|
||||||
child: AddHistoryDialog(
|
|
||||||
changePageViewIndex: changePageViewIndex,
|
|
||||||
controller: _controller,
|
|
||||||
myHistoryList: widget.myHistoryList,
|
|
||||||
addSelectedHistories: () {
|
|
||||||
setState(() {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
removeHistory: (masterKey) => removeHistory(masterKey),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class AddHistoryDialog extends StatefulWidget {
|
|
||||||
final Function changePageViewIndex;
|
|
||||||
final PageController controller;
|
|
||||||
final List<MySelectedHistory> myHistoryList;
|
|
||||||
final Function addSelectedHistories;
|
|
||||||
final Function (MasterKeyModel) removeHistory;
|
|
||||||
|
|
||||||
const AddHistoryDialog(
|
|
||||||
{Key key, this.changePageViewIndex, this.controller, this.myHistoryList, this.addSelectedHistories, this.removeHistory})
|
|
||||||
: super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
_AddHistoryDialogState createState() => _AddHistoryDialogState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _AddHistoryDialogState extends State<AddHistoryDialog> {
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return FractionallySizedBox(
|
|
||||||
heightFactor: 1,
|
|
||||||
child: BaseView<SOAPViewModel>(
|
|
||||||
onModelReady: (model) async {
|
|
||||||
if (model.historyFamilyList.length == 0) {
|
|
||||||
await model.getMasterLookup(MasterKeysService.HistoryFamily);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (model.historySurgicalList.length == 0) {
|
|
||||||
await model.getMasterLookup(MasterKeysService.HistorySurgical);
|
|
||||||
await model.getMasterLookup(MasterKeysService.HistorySports);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (model.historyMedicalList.length == 0) {
|
|
||||||
await model.getMasterLookup(MasterKeysService.HistoryMedical);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
builder: (_, model, w) => AppScaffold(
|
|
||||||
baseViewModel: model,
|
|
||||||
isShowAppBar: false,
|
|
||||||
body: Center(
|
|
||||||
child: Container(
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
left: 0, right: 5, bottom: 5, top: 5),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
height: 115,
|
|
||||||
child: Container(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
left: 10, right: 10),
|
|
||||||
margin: EdgeInsets.only(top: 40),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment:
|
|
||||||
MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
RichText(
|
|
||||||
text: TextSpan(
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize:20,
|
|
||||||
color: Colors.black),
|
|
||||||
children: <TextSpan>[
|
|
||||||
new TextSpan(
|
|
||||||
text: TranslationBase.of(context).addHistory,
|
|
||||||
style: TextStyle(
|
|
||||||
color: Color(0xFF2B353E),
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
fontFamily: 'Poppins',
|
|
||||||
fontSize: 20)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
InkWell(
|
|
||||||
onTap: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
child: Icon(FontAwesomeIcons.times,
|
|
||||||
size: 30,
|
|
||||||
color: Color(0xFF2B353E)))
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
PriorityBar(onTap: (activePriority) async {
|
|
||||||
widget.changePageViewIndex(activePriority);
|
|
||||||
}),
|
|
||||||
SizedBox(
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: FractionallySizedBox(
|
|
||||||
widthFactor: 0.9,
|
|
||||||
child: PageView(
|
|
||||||
physics: NeverScrollableScrollPhysics(),
|
|
||||||
controller: widget.controller,
|
|
||||||
onPageChanged: (index) {
|
|
||||||
setState(() {
|
|
||||||
// currentIndex = index;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
scrollDirection: Axis.horizontal,
|
|
||||||
children: <Widget>[
|
|
||||||
NetworkBaseView(
|
|
||||||
baseViewModel: model,
|
|
||||||
child: MasterKeyCheckboxSearchWidget(
|
|
||||||
model: model,
|
|
||||||
masterList: model.historyFamilyList,
|
|
||||||
removeHistory: (history){
|
|
||||||
setState(() {
|
|
||||||
widget.removeHistory(history);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
addHistory: (history){
|
|
||||||
setState(() {
|
|
||||||
createAndAddHistory(
|
|
||||||
history);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
addSelectedHistories: (){
|
|
||||||
widget.addSelectedHistories();
|
|
||||||
},
|
|
||||||
isServiceSelected: (master) =>isServiceSelected(master),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
NetworkBaseView(
|
|
||||||
baseViewModel: model,
|
|
||||||
child: MasterKeyCheckboxSearchWidget(
|
|
||||||
model: model,
|
|
||||||
masterList: model.mergeHistorySurgicalWithHistorySportList,
|
|
||||||
removeHistory: (history){
|
|
||||||
setState(() {
|
|
||||||
widget.removeHistory(history);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
addHistory: (history){
|
|
||||||
setState(() {
|
|
||||||
createAndAddHistory(
|
|
||||||
history);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
addSelectedHistories: (){
|
|
||||||
widget.addSelectedHistories();
|
|
||||||
},
|
|
||||||
isServiceSelected: (master) =>isServiceSelected(master),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
NetworkBaseView(
|
|
||||||
baseViewModel: model,
|
|
||||||
child: MasterKeyCheckboxSearchWidget(
|
|
||||||
model: model,
|
|
||||||
masterList: model.historyMedicalList,
|
|
||||||
removeHistory: (history){
|
|
||||||
setState(() {
|
|
||||||
widget.removeHistory(history);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
addHistory: (history){
|
|
||||||
setState(() {
|
|
||||||
createAndAddHistory(
|
|
||||||
history);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
addSelectedHistories: (){
|
|
||||||
widget.addSelectedHistories();
|
|
||||||
},
|
|
||||||
isServiceSelected: (master) =>isServiceSelected(master),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
createAndAddHistory(MasterKeyModel history) {
|
|
||||||
List<MySelectedHistory> myhistory = widget.myHistoryList.where((element) =>
|
|
||||||
history.id ==
|
|
||||||
element.selectedHistory.id &&
|
|
||||||
history.typeId ==
|
|
||||||
element.selectedHistory.typeId
|
|
||||||
).toList();
|
|
||||||
|
|
||||||
if (myhistory.isEmpty) {
|
|
||||||
setState(() {
|
|
||||||
MySelectedHistory mySelectedHistory = MySelectedHistory(
|
|
||||||
remark: history.remarks ?? "",
|
|
||||||
selectedHistory: history,
|
|
||||||
isChecked: true);
|
|
||||||
widget.myHistoryList.add(mySelectedHistory);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
myhistory.first.isChecked = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
isServiceSelected(MasterKeyModel masterKey) {
|
|
||||||
Iterable<MySelectedHistory> history =
|
|
||||||
widget
|
|
||||||
.myHistoryList
|
|
||||||
.where((element) =>
|
|
||||||
masterKey.id == element.selectedHistory.id &&
|
|
||||||
masterKey.typeId == element.selectedHistory.typeId &&
|
|
||||||
element.isChecked);
|
|
||||||
if (history.length > 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue