Merge branch 'sultan' into 'development'

Sultan

See merge request Cloud_Solution/doctor_app_flutter!295
merge-requests/296/merge
Mohammad Aljammal 5 years ago
commit 63878281b3

@ -639,68 +639,153 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
model2.coveringDoctors.length > 0
? Expanded(
// add Expanded to have your dropdown button fill remaining space
child:
DropdownButtonHideUnderline(
child: DropdownButton(
focusColor: Colors.grey,
isExpanded: true,
value: doctorID == null
? model2
.coveringDoctors[0]
['doctorID']
.toString()
: doctorID,
iconSize: 40,
elevation: 16,
selectedItemBuilder:
(BuildContext context) {
return model2
.coveringDoctors
.map((item) {
return Row(
mainAxisSize:
MainAxisSize.max,
children: <Widget>[
AppText(
projectsProvider
.isArabic
? item[
'doctorNameN']
: item[
'doctorName'],
fontSize: SizeConfig
.textMultiplier *
2.1,
),
],
);
}).toList();
},
onChanged: (newValue) => {
setState(() {
doctorID = newValue;
})
},
child: DropdownSearch(
mode: Mode.BOTTOM_SHEET,
dropdownSearchDecoration:
InputDecoration(
contentPadding:
EdgeInsets.all(
0),
border: InputBorder
.none),
//maxHeight: 300,
items: model2
.coveringDoctors
.map((item) {
return DropdownMenuItem<
String>(
value: item['doctorID']
.toString(),
return projectsProvider
.isArabic
? item['doctorNameN']
: item['doctorName'];
}).toList(),
// label: "Doctor List",
onChanged: (item) {
model2.coveringDoctors
.forEach((newVal) => {
if (newVal['doctorName'] ==
item ||
newVal['doctorName'] ==
item)
{
doctorID =
newVal[
'DoctorID']
}
});
},
selectedItem:
getSelectedDoctor(
model2),
showSearchBox: true,
searchBoxDecoration:
InputDecoration(
border:
OutlineInputBorder(),
contentPadding:
EdgeInsets.fromLTRB(
12, 12, 8, 0),
labelText:
"Search Doctor",
),
popupTitle: Container(
height: 50,
decoration: BoxDecoration(
color: Theme.of(context)
.primaryColorDark,
borderRadius:
BorderRadius.only(
topLeft:
Radius.circular(
20),
topRight:
Radius.circular(
20),
),
),
child: Center(
child: Text(
projectsProvider
.isArabic
? item[
'doctorNameN']
: item[
'doctorName'],
textAlign:
TextAlign.start,
'',
style: TextStyle(
fontSize: 24,
fontWeight:
FontWeight.bold,
color: Colors.white,
),
),
);
}).toList(),
)),
),
),
popupShape:
RoundedRectangleBorder(
borderRadius:
BorderRadius.only(
topLeft:
Radius.circular(24),
topRight:
Radius.circular(24),
),
),
),
// DropdownButtonHideUnderline(
// child: DropdownButton(
// focusColor: Colors.grey,
// isExpanded: true,
// value: doctorID == null
// ? model2
// .coveringDoctors[0]
// ['doctorID']
// .toString()
// : doctorID,
// iconSize: 40,
// elevation: 16,
// selectedItemBuilder:
// (BuildContext context) {
// return model2
// .coveringDoctors
// .map((item) {
// return Row(
// mainAxisSize:
// MainAxisSize.max,
// children: <Widget>[
// AppText(
// projectsProvider
// .isArabic
// ? item[
// 'doctorNameN']
// : item[
// 'doctorName'],
// fontSize: SizeConfig
// .textMultiplier *
// 2.1,
// ),
// ],
// );
// }).toList();
// },
// onChanged: (newValue) => {
// setState(() {
// doctorID = newValue;
// })
// },
// items: model2
// .coveringDoctors
// .map((item) {
// return DropdownMenuItem<
// String>(
// value: item['doctorID']
// .toString(),
// child: Text(
// projectsProvider
// .isArabic
// ? item[
// 'doctorNameN']
// : item[
// 'doctorName'],
// textAlign:
// TextAlign.start,
// ),
// );
// }).toList(),
// )),
)
: SizedBox(),
],
@ -775,6 +860,7 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
toDate = _toDateController2.text;
fromDate = _toDateController.text;
this.reason = widget.updateData.reasonId.toString();
doctorID = widget.updateData.coveringDoctorId;
}
});
}
@ -910,4 +996,19 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
}
});
}
getSelectedDoctor(model2) {
var doctorName;
if (doctorID == null)
return projectsProvider.isArabic
? model2.coveringDoctors[0]['doctorNameN']
: model2.coveringDoctors[0]['doctorName'];
else {
model2.coveringDoctors.forEach((newVal) => {
if (newVal['doctorID'].toString() == doctorID)
{doctorName = newVal['doctorName']}
});
return doctorName;
}
}
}

Loading…
Cancel
Save