Clinic List widget

merge-requests/354/head
Elham Rababah 4 years ago
parent 64c7dae97c
commit e2e92c1c59

@ -42,7 +42,7 @@ class _PatientsScreenState extends State<PatientsScreen> {
List date;
List unFilterDate;
var clinicId;
int clinicId;
AuthViewModel authProvider;
Color sideColor = Colors.black;
@ -340,10 +340,7 @@ class _PatientsScreenState extends State<PatientsScreen> {
children: <Widget>[
Padding(
padding: EdgeInsets.only(
top: MediaQuery.of(context)
.size
.height *
0.03),
top:0),
child: SERVICES_PATIANT2[
int.parse(patientType)] ==
"List_MyOutPatient"
@ -371,80 +368,10 @@ class _PatientsScreenState extends State<PatientsScreen> {
height: 10.0,
),
if(int.parse(patientType)==7)
projectsProvider
.doctorClinicsList.length >
0
? FractionallySizedBox(
widthFactor: 0.9,
child: Column(
children: [
Container(
width: MediaQuery.of(context).size.width *0.8,
child: Center(
child: DropdownButtonHideUnderline(
child: DropdownButton(
dropdownColor:
Colors.white,
iconEnabledColor:
Colors.black,
isExpanded: true,
value: clinicId == null
? projectsProvider
.doctorClinicsList[
0]
.clinicID
: clinicId,
iconSize: 25,
elevation: 16,
selectedItemBuilder:
(BuildContext
context) {
return projectsProvider
.doctorClinicsList
.map((item) {
return Row(
mainAxisSize:
MainAxisSize
.max,
children: <Widget>[
AppText(
item.clinicName,
fontSize: SizeConfig
.textMultiplier *
2.1,
color: Colors
.black,
),
],
);
}).toList();
},
onChanged: (newValue) {
clinicId = newValue;
changeClinic(newValue, context, model);
},
items: projectsProvider
.doctorClinicsList
.map((item) {
return DropdownMenuItem(
child: Text(
item.clinicName,
textAlign:
TextAlign.end,
),
value: item.clinicID,
);
}).toList(),
)),
),
),
],
),
)
: AppText(
TranslationBase
.of(context)
.noClinic),
ClinicList(clinicId: clinicId,onClinicChange: (newValue) {
clinicId = newValue;
changeClinic(newValue, context, model);
},),
Divider(
thickness: 0.8,
color: Color(0xffCCCCCC),
@ -663,3 +590,97 @@ class _PatientsScreenState extends State<PatientsScreen> {
);
}
}
// ignore: must_be_immutable
class ClinicList extends StatelessWidget {
ProjectViewModel projectsProvider;
final int clinicId;
final Function (int value) onClinicChange;
ClinicList({Key key, this.clinicId, this.onClinicChange}) : super(key: key);
@override
Widget build(BuildContext context) {
// authProvider = Provider.of(context);
projectsProvider = Provider.of(context);
return Container(
child:
projectsProvider
.doctorClinicsList.length >
0
? FractionallySizedBox(
widthFactor: 0.9,
child: Column(
children: [
Container(
width: MediaQuery.of(context).size.width *0.8,
child: Center(
child: DropdownButtonHideUnderline(
child: DropdownButton(
dropdownColor:
Colors.white,
iconEnabledColor:
Colors.black,
isExpanded: true,
value: clinicId == null
? projectsProvider
.doctorClinicsList[
0]
.clinicID
: clinicId,
iconSize: 25,
elevation: 16,
selectedItemBuilder:
(BuildContext
context) {
return projectsProvider
.doctorClinicsList
.map((item) {
return Row(
mainAxisSize:
MainAxisSize
.max,
children: <Widget>[
AppText(
item.clinicName,
fontSize: SizeConfig
.textMultiplier *
2.1,
color: Colors
.black,
),
],
);
}).toList();
},
onChanged: (newValue){
onClinicChange(newValue);
},
items: projectsProvider
.doctorClinicsList
.map((item) {
return DropdownMenuItem(
child: Text(
item.clinicName,
textAlign:
TextAlign.end,
),
value: item.clinicID,
);
}).toList(),
)),
),
),
],
),
)
: AppText(
TranslationBase
.of(context)
.noClinic),
);
}
}

Loading…
Cancel
Save