Merge branch 'development' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into patient_app_services
Conflicts: lib/widgets/patients/profile/soap_update/update_soap_index.dartmerge-requests/457/head
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 579 B |
|
After Width: | Height: | Size: 1.2 KiB |
@ -0,0 +1,145 @@
|
|||||||
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:hexcolor/hexcolor.dart';
|
||||||
|
|
||||||
|
class PageStepperWidget extends StatelessWidget {
|
||||||
|
final int stepsCount;
|
||||||
|
final int currentStepIndex;
|
||||||
|
final Size screenSize;
|
||||||
|
|
||||||
|
PageStepperWidget({this.stepsCount, this.currentStepIndex, this.screenSize});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
double dividerWidth = (screenSize.width / stepsCount) - (10 * stepsCount);
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
margin: EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
for (int i = 1; i <= stepsCount; i++)
|
||||||
|
if (i == currentStepIndex)
|
||||||
|
StepWidget(i, true, i == stepsCount, i < currentStepIndex,
|
||||||
|
dividerWidth)
|
||||||
|
else
|
||||||
|
StepWidget(i, false, i == stepsCount, i < currentStepIndex,
|
||||||
|
dividerWidth)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class StepWidget extends StatelessWidget {
|
||||||
|
final int index;
|
||||||
|
final bool isInProgress;
|
||||||
|
final bool isFinalStep;
|
||||||
|
final bool isStepFinish;
|
||||||
|
final double dividerWidth;
|
||||||
|
|
||||||
|
StepWidget(this.index, this.isInProgress, this.isFinalStep, this.isStepFinish,
|
||||||
|
this.dividerWidth);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
StepStatus status;
|
||||||
|
if (isInProgress) {
|
||||||
|
status = StepStatus.InProgress;
|
||||||
|
} else {
|
||||||
|
if(isStepFinish){
|
||||||
|
status = StepStatus.Completed;
|
||||||
|
}else {
|
||||||
|
status = StepStatus.Locked;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.all(0.0),
|
||||||
|
margin: EdgeInsets.symmetric(horizontal: 1),
|
||||||
|
width: 25,
|
||||||
|
height: 25,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: isInProgress ? Color(0xFFCC9B14) : Color(0xFFC9C9C9),
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
border: Border.all(
|
||||||
|
color: isInProgress ? Color(0xFFCC9B14) : Color(0xFFC9C9C9),
|
||||||
|
width: 1),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Icon(
|
||||||
|
Icons.check,
|
||||||
|
size: 20,
|
||||||
|
color: status == StepStatus.InProgress ? Colors.white : status == StepStatus.Locked ? Colors.grey.shade800 : Color(0xFF359846),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
if (!isFinalStep)
|
||||||
|
Container(
|
||||||
|
width: dividerWidth,
|
||||||
|
height: 2,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
AppText(
|
||||||
|
"${TranslationBase.of(context).step} $index",
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: status == StepStatus.InProgress ? Colors.black : status == StepStatus.Locked ? Colors.grey : Color(0xFF359846),
|
||||||
|
fontFamily: 'Poppins',
|
||||||
|
fontSize: SizeConfig.textMultiplier * 1.6,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.symmetric(vertical: 4),
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 4, vertical: 2),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: status == StepStatus.InProgress
|
||||||
|
? Color(0xFFF1E9D3)
|
||||||
|
: status == StepStatus.Locked
|
||||||
|
? Color(0xFFD8E8DB)
|
||||||
|
: Color(0xFFCCCCCC),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(8.0),
|
||||||
|
),
|
||||||
|
border: Border.all(color: HexColor('#707070'), width: 0.30),
|
||||||
|
),
|
||||||
|
child: AppText(
|
||||||
|
status == StepStatus.InProgress
|
||||||
|
? "inProgress"
|
||||||
|
: status == StepStatus.Locked
|
||||||
|
? "Locked"
|
||||||
|
: "Completed",
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontFamily: 'Poppins',
|
||||||
|
fontSize: SizeConfig.textMultiplier * 1.4,
|
||||||
|
color: status == StepStatus.InProgress
|
||||||
|
? Color(0xFFCC9B14)
|
||||||
|
: status == StepStatus.Locked
|
||||||
|
? Color(0xFF969696)
|
||||||
|
: Color(0xFF359846),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum StepStatus {
|
||||||
|
InProgress,
|
||||||
|
Locked,
|
||||||
|
Completed,
|
||||||
|
}
|
||||||
@ -0,0 +1,619 @@
|
|||||||
|
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/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/util/translations_delegate_base.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/custom_validation_error.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart';
|
||||||
|
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import 'app_texts_widget.dart';
|
||||||
|
import 'dialogs/master_key_dailog.dart';
|
||||||
|
import 'expandable-widget-header-body.dart';
|
||||||
|
|
||||||
|
class MasterKeyCheckboxSearchAllergiesWidget extends StatefulWidget {
|
||||||
|
final SOAPViewModel model;
|
||||||
|
final Function () addSelectedAllergy;
|
||||||
|
final Function(MasterKeyModel) removeAllergy;
|
||||||
|
final Function(MySelectedAllergy mySelectedAllergy) addAllergy;
|
||||||
|
final bool Function(MasterKeyModel) isServiceSelected;
|
||||||
|
final MySelectedAllergy Function(MasterKeyModel) getServiceSelectedAllergy;
|
||||||
|
|
||||||
|
final List<MasterKeyModel> masterList;
|
||||||
|
final String buttonName;
|
||||||
|
final String hintSearchText;
|
||||||
|
|
||||||
|
MasterKeyCheckboxSearchAllergiesWidget(
|
||||||
|
{Key key,
|
||||||
|
this.model,
|
||||||
|
this.addSelectedAllergy,
|
||||||
|
this.removeAllergy,
|
||||||
|
this.masterList,
|
||||||
|
this.addAllergy,
|
||||||
|
this.isServiceSelected,
|
||||||
|
this.buttonName,
|
||||||
|
this.hintSearchText,
|
||||||
|
this.getServiceSelectedAllergy})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_MasterKeyCheckboxSearchAllergiesWidgetState createState() =>
|
||||||
|
_MasterKeyCheckboxSearchAllergiesWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MasterKeyCheckboxSearchAllergiesWidgetState
|
||||||
|
extends State<MasterKeyCheckboxSearchAllergiesWidget> {
|
||||||
|
List<MasterKeyModel> items = List();
|
||||||
|
MasterKeyModel _selectedAllergySeverity;
|
||||||
|
bool isSubmitted = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
items.addAll(widget.masterList);
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
ProjectViewModel projectViewModel = Provider.of(context);
|
||||||
|
return Container(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
height: MediaQuery.of(context).size.height * 0.62,
|
||||||
|
child: Center(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
color: Colors.white),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
TextFields(
|
||||||
|
hintText: widget.hintSearchText ??
|
||||||
|
TranslationBase.of(context).selectAllergy,
|
||||||
|
borderWidth: 0.0,
|
||||||
|
padding: EdgeInsets.all(20),
|
||||||
|
borderRadius: 0,
|
||||||
|
suffixIcon: EvaIcons.search,
|
||||||
|
onChanged: (value) {
|
||||||
|
filterSearchResults(value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: FractionallySizedBox(
|
||||||
|
widthFactor: 0.9,
|
||||||
|
child: Container(
|
||||||
|
height: MediaQuery.of(context).size.height * 0.60,
|
||||||
|
child: ListView.builder(
|
||||||
|
itemCount: items.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
bool isSelected =
|
||||||
|
widget.isServiceSelected(items[index]);
|
||||||
|
MySelectedAllergy mySelectedAllergy;
|
||||||
|
if (isSelected) {
|
||||||
|
mySelectedAllergy =
|
||||||
|
widget.getServiceSelectedAllergy(
|
||||||
|
items[index]);
|
||||||
|
}
|
||||||
|
TextEditingController remarkController =
|
||||||
|
TextEditingController(
|
||||||
|
text: isSelected
|
||||||
|
? mySelectedAllergy.remark
|
||||||
|
: null);
|
||||||
|
TextEditingController severityController =
|
||||||
|
TextEditingController(
|
||||||
|
text: isSelected
|
||||||
|
? mySelectedAllergy
|
||||||
|
.selectedAllergySeverity !=
|
||||||
|
null
|
||||||
|
? projectViewModel.isArabic
|
||||||
|
? mySelectedAllergy
|
||||||
|
.selectedAllergySeverity
|
||||||
|
.nameAr
|
||||||
|
: mySelectedAllergy
|
||||||
|
.selectedAllergySeverity
|
||||||
|
.nameEn
|
||||||
|
: null
|
||||||
|
: null);
|
||||||
|
return HeaderBodyExpandableNotifier(
|
||||||
|
headerWidget: Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Checkbox(
|
||||||
|
value:
|
||||||
|
widget.isServiceSelected(
|
||||||
|
items[index]),
|
||||||
|
activeColor: Colors.red[800],
|
||||||
|
onChanged: (bool newValue) {
|
||||||
|
// setState(() {
|
||||||
|
// if (widget
|
||||||
|
// .isServiceSelected(items[index])) {
|
||||||
|
// widget.removeHistory(items[index]);
|
||||||
|
// } else {
|
||||||
|
// widget.addHistory(items[index]);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
}),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
if (widget
|
||||||
|
.isServiceSelected(
|
||||||
|
items[index])) {
|
||||||
|
widget.removeAllergy(
|
||||||
|
items[index]);
|
||||||
|
} else {
|
||||||
|
// TODO add Allergy
|
||||||
|
|
||||||
|
MySelectedAllergy
|
||||||
|
mySelectedAllergy =
|
||||||
|
new MySelectedAllergy(
|
||||||
|
selectedAllergy:
|
||||||
|
items[index],
|
||||||
|
selectedAllergySeverity:
|
||||||
|
_selectedAllergySeverity,
|
||||||
|
remark: null,
|
||||||
|
isChecked: true,
|
||||||
|
isExpanded: true);
|
||||||
|
widget.addAllergy(
|
||||||
|
mySelectedAllergy);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets
|
||||||
|
.symmetric(
|
||||||
|
horizontal: 10,
|
||||||
|
vertical: 0),
|
||||||
|
child: Container(
|
||||||
|
|
||||||
|
child: AppText(
|
||||||
|
projectViewModel.isArabic
|
||||||
|
? items[index]
|
||||||
|
.nameAr !=
|
||||||
|
""
|
||||||
|
? items[index]
|
||||||
|
.nameAr
|
||||||
|
: items[index]
|
||||||
|
.nameEn
|
||||||
|
: items[index].nameEn,
|
||||||
|
color: Color(0xFF575757),
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight:
|
||||||
|
FontWeight.w600,
|
||||||
|
),
|
||||||
|
width: MediaQuery.of(context).size.width * 0.55,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
if (mySelectedAllergy != null) {
|
||||||
|
setState(() {
|
||||||
|
mySelectedAllergy
|
||||||
|
.isExpanded =
|
||||||
|
mySelectedAllergy
|
||||||
|
.isExpanded
|
||||||
|
? false
|
||||||
|
: true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Icon((mySelectedAllergy !=
|
||||||
|
null
|
||||||
|
? mySelectedAllergy
|
||||||
|
.isExpanded
|
||||||
|
: false)
|
||||||
|
? EvaIcons
|
||||||
|
.arrowIosUpwardOutline
|
||||||
|
: EvaIcons
|
||||||
|
.arrowIosDownwardOutline))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
bodyWidget: Column(
|
||||||
|
children: [
|
||||||
|
TextFields(
|
||||||
|
onTapTextFields: widget.model
|
||||||
|
.allergySeverityList !=
|
||||||
|
null
|
||||||
|
? () {
|
||||||
|
MasterKeyDailog dialog =
|
||||||
|
MasterKeyDailog(
|
||||||
|
list: widget.model
|
||||||
|
.allergySeverityList,
|
||||||
|
okText:
|
||||||
|
TranslationBase.of(
|
||||||
|
context)
|
||||||
|
.ok,
|
||||||
|
okFunction:
|
||||||
|
(selectedValue) {
|
||||||
|
setState(() {
|
||||||
|
mySelectedAllergy
|
||||||
|
.selectedAllergySeverity =
|
||||||
|
selectedValue;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
showDialog(
|
||||||
|
barrierDismissible:
|
||||||
|
false,
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext
|
||||||
|
context) {
|
||||||
|
return dialog;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
: null,
|
||||||
|
hasLabelText:
|
||||||
|
mySelectedAllergy != null &&
|
||||||
|
mySelectedAllergy
|
||||||
|
.selectedAllergySeverity !=
|
||||||
|
null
|
||||||
|
? true
|
||||||
|
: false,
|
||||||
|
showLabelText: true,
|
||||||
|
hintText:
|
||||||
|
TranslationBase
|
||||||
|
.of(context)
|
||||||
|
.selectSeverity,
|
||||||
|
fontSize: 13.5,
|
||||||
|
readOnly: true,
|
||||||
|
// hintColor: Colors.black,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
maxLines: 2,
|
||||||
|
minLines: 1,
|
||||||
|
controller: severityController,
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null)
|
||||||
|
return TranslationBase
|
||||||
|
.of(
|
||||||
|
context)
|
||||||
|
.emptyMessage;
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
SizedBox(
|
||||||
|
height: 5,
|
||||||
|
),
|
||||||
|
if(isSubmitted &&
|
||||||
|
mySelectedAllergy
|
||||||
|
.selectedAllergySeverity == null)
|
||||||
|
Row(
|
||||||
|
|
||||||
|
children: [
|
||||||
|
CustomValidationError(),
|
||||||
|
],
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
),
|
||||||
|
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(
|
||||||
|
left: 0, right: 0, top: 15),
|
||||||
|
child: TextFields(
|
||||||
|
hasLabelText:
|
||||||
|
remarkController.text !=
|
||||||
|
''
|
||||||
|
? true
|
||||||
|
: false,
|
||||||
|
showLabelText: true,
|
||||||
|
hintText: TranslationBase
|
||||||
|
.of(
|
||||||
|
context)
|
||||||
|
.remarks,
|
||||||
|
fontSize: 13.5,
|
||||||
|
// hintColor: Colors.black,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
maxLines: 25,
|
||||||
|
minLines: 10,
|
||||||
|
initialValue: isSelected
|
||||||
|
? mySelectedAllergy
|
||||||
|
.remark : '',
|
||||||
|
// controller: remarkControlle
|
||||||
|
|
||||||
|
onChanged: (value) {
|
||||||
|
if (isSelected) {
|
||||||
|
mySelectedAllergy
|
||||||
|
.remark = value;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null)
|
||||||
|
return TranslationBase
|
||||||
|
.of(
|
||||||
|
context)
|
||||||
|
.emptyMessage;
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
],),
|
||||||
|
isExpand: mySelectedAllergy != null
|
||||||
|
? mySelectedAllergy.isExpanded
|
||||||
|
: false,
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
if (widget.isServiceSelected(
|
||||||
|
items[index])) {
|
||||||
|
widget
|
||||||
|
.removeAllergy(
|
||||||
|
items[index]);
|
||||||
|
} else {
|
||||||
|
// TODO add Allergy
|
||||||
|
|
||||||
|
MySelectedAllergy
|
||||||
|
mySelectedAllergy =
|
||||||
|
new MySelectedAllergy(
|
||||||
|
selectedAllergy:
|
||||||
|
items[index],
|
||||||
|
selectedAllergySeverity:
|
||||||
|
_selectedAllergySeverity,
|
||||||
|
remark: null,
|
||||||
|
isChecked: true);
|
||||||
|
widget.addAllergy(
|
||||||
|
mySelectedAllergy);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Checkbox(
|
||||||
|
value: widget
|
||||||
|
.isServiceSelected(
|
||||||
|
items[index]),
|
||||||
|
activeColor:
|
||||||
|
Colors.red[800],
|
||||||
|
onChanged: (bool newValue) {
|
||||||
|
// setState(() {
|
||||||
|
// if (widget
|
||||||
|
// .isServiceSelected(items[index])) {
|
||||||
|
// widget.removeHistory(items[index]);
|
||||||
|
// } else {
|
||||||
|
// widget.addHistory(items[index]);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
}),
|
||||||
|
Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets
|
||||||
|
.symmetric(
|
||||||
|
horizontal: 10,
|
||||||
|
vertical: 0),
|
||||||
|
child: AppText(
|
||||||
|
projectViewModel.isArabic
|
||||||
|
? items[index]
|
||||||
|
.nameAr !=
|
||||||
|
""
|
||||||
|
? items[index]
|
||||||
|
.nameAr
|
||||||
|
: items[index]
|
||||||
|
.nameEn
|
||||||
|
: items[index].nameEn,
|
||||||
|
color: Color(0xFF575757),
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight:
|
||||||
|
FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
if(widget
|
||||||
|
.isServiceSelected(
|
||||||
|
items[index]))
|
||||||
|
Column(children: [
|
||||||
|
TextFields(
|
||||||
|
onTapTextFields: widget.model
|
||||||
|
.allergySeverityList !=
|
||||||
|
null
|
||||||
|
? () {
|
||||||
|
MasterKeyDailog dialog =
|
||||||
|
MasterKeyDailog(
|
||||||
|
list: widget.model
|
||||||
|
.allergySeverityList,
|
||||||
|
okText:
|
||||||
|
TranslationBase.of(
|
||||||
|
context)
|
||||||
|
.ok,
|
||||||
|
okFunction:
|
||||||
|
(selectedValue) {
|
||||||
|
setState(() {
|
||||||
|
mySelectedAllergy
|
||||||
|
.selectedAllergySeverity =
|
||||||
|
selectedValue;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
showDialog(
|
||||||
|
barrierDismissible:
|
||||||
|
false,
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext
|
||||||
|
context) {
|
||||||
|
return dialog;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
: null,
|
||||||
|
hasLabelText:
|
||||||
|
mySelectedAllergy
|
||||||
|
.selectedAllergySeverity !=
|
||||||
|
null
|
||||||
|
? true
|
||||||
|
: false,
|
||||||
|
showLabelText: true,
|
||||||
|
hintText:
|
||||||
|
TranslationBase
|
||||||
|
.of(context)
|
||||||
|
.selectSeverity,
|
||||||
|
fontSize: 13.5,
|
||||||
|
readOnly: true,
|
||||||
|
// hintColor: Colors.black,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
maxLines: 2,
|
||||||
|
minLines: 1,
|
||||||
|
controller: severityController,
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null)
|
||||||
|
return TranslationBase
|
||||||
|
.of(
|
||||||
|
context)
|
||||||
|
.emptyMessage;
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
SizedBox(
|
||||||
|
height: 5,
|
||||||
|
),
|
||||||
|
if(isSubmitted &&
|
||||||
|
mySelectedAllergy
|
||||||
|
.selectedAllergySeverity == null)
|
||||||
|
Row(
|
||||||
|
|
||||||
|
children: [
|
||||||
|
CustomValidationError(),
|
||||||
|
],
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
),
|
||||||
|
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(
|
||||||
|
left: 0, right: 0, top: 15),
|
||||||
|
child: TextFields(
|
||||||
|
hasLabelText:
|
||||||
|
remarkController.text !=
|
||||||
|
''
|
||||||
|
? true
|
||||||
|
: false,
|
||||||
|
showLabelText: true,
|
||||||
|
hintText: TranslationBase
|
||||||
|
.of(
|
||||||
|
context)
|
||||||
|
.remarks,
|
||||||
|
fontSize: 13.5,
|
||||||
|
// hintColor: Colors.black,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
maxLines: 25,
|
||||||
|
minLines: 10,
|
||||||
|
initialValue: isSelected
|
||||||
|
? mySelectedAllergy
|
||||||
|
.remark : '',
|
||||||
|
// controller: remarkControlle
|
||||||
|
|
||||||
|
onChanged: (value) {
|
||||||
|
if (isSelected) {
|
||||||
|
mySelectedAllergy
|
||||||
|
.remark = value;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null)
|
||||||
|
return TranslationBase
|
||||||
|
.of(
|
||||||
|
context)
|
||||||
|
.emptyMessage;
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
],)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// DividerWithSpacesAround(),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
if (widget.model.state == ViewState.Idle)
|
||||||
|
AppButton(
|
||||||
|
title: "Add Selected Allergy",
|
||||||
|
padding: 10,
|
||||||
|
color: Color(0xFF359846),
|
||||||
|
onPressed: () {
|
||||||
|
setState(() {
|
||||||
|
isSubmitted = true;
|
||||||
|
});
|
||||||
|
widget.addSelectedAllergy();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void filterSearchResults(String query) {
|
||||||
|
List<MasterKeyModel> dummySearchList = List();
|
||||||
|
dummySearchList.addAll(widget.masterList);
|
||||||
|
if (query.isNotEmpty) {
|
||||||
|
List<MasterKeyModel> dummyListData = List();
|
||||||
|
dummySearchList.forEach((items) {
|
||||||
|
if (items.nameAr.toLowerCase().contains(query.toLowerCase()) ||
|
||||||
|
items.nameEn.toLowerCase().contains(query.toLowerCase())) {
|
||||||
|
dummyListData.add(items);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
setState(() {
|
||||||
|
items.clear();
|
||||||
|
items.addAll(dummyListData);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
items.clear();
|
||||||
|
items.addAll(widget.masterList);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||