You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
110 lines
3.3 KiB
Dart
110 lines
3.3 KiB
Dart
import 'package:diplomaticquarterapp/models/Clinics/ClinicListResponse.dart';
|
|
import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart';
|
|
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class SearchByClinic extends StatefulWidget {
|
|
@override
|
|
_SearchByClinicState createState() => _SearchByClinicState();
|
|
}
|
|
|
|
class _SearchByClinicState extends State<SearchByClinic> {
|
|
bool nearestAppo = false;
|
|
String dropdownValue = null;
|
|
List<ListClinicCentralized> clinicsList = [];
|
|
|
|
@override
|
|
void initState() {
|
|
// TODO: implement initState
|
|
getClinicsList();
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
margin: EdgeInsets.all(10.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
Row(
|
|
children: <Widget>[
|
|
Checkbox(
|
|
activeColor: new Color(0xFFc5272d),
|
|
value: nearestAppo,
|
|
onChanged: (bool value) {
|
|
setState(() {
|
|
nearestAppo = value;
|
|
});
|
|
},
|
|
),
|
|
Text(TranslationBase.of(context).nearestAppo,
|
|
style: TextStyle(fontSize: 16.0, letterSpacing: 0.9)),
|
|
],
|
|
),
|
|
Container(
|
|
height: 60.0,
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
border: Border.all(
|
|
color: Colors.grey[400],
|
|
width: 1.0,
|
|
),
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
margin: EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 20.0),
|
|
padding: EdgeInsets.all(10.0),
|
|
width: MediaQuery.of(context).size.width,
|
|
child: DropdownButtonHideUnderline(
|
|
child: DropdownButton<String>(
|
|
hint: new Text("Select Clinic"),
|
|
value: dropdownValue,
|
|
items: clinicsList
|
|
.map((ListClinicCentralized clinicSelected) {
|
|
return new DropdownMenuItem<String>(
|
|
// value: dropdownValue,
|
|
child: new Text(clinicSelected.clinicDescription),
|
|
);
|
|
}).toList(),
|
|
onChanged: (newValue) {
|
|
setState(() {
|
|
print(newValue);
|
|
dropdownValue = newValue;
|
|
});
|
|
},
|
|
),
|
|
)),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
getClinicsList() {
|
|
ClinicListService service = new ClinicListService();
|
|
service.getClinicsList().then((res) {
|
|
if (res['MessageStatus'] == 1) {
|
|
setState(() {
|
|
res['ListClinicCentralized'].forEach((v) {
|
|
clinicsList.add(new ListClinicCentralized.fromJson(v));
|
|
});
|
|
clinicsList.forEach((v) {
|
|
print(v.clinicID);
|
|
});
|
|
});
|
|
} else {
|
|
// handel error
|
|
setState(() {
|
|
// projectsList = ListProject;
|
|
});
|
|
}
|
|
}).catchError((err) {
|
|
setState(() {
|
|
// projectsList = ListProject;
|
|
});
|
|
print(err);
|
|
});
|
|
}
|
|
|
|
}
|