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.
151 lines
5.6 KiB
Dart
151 lines
5.6 KiB
Dart
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
|
|
import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart';
|
|
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:rating_bar/rating_bar.dart';
|
|
import 'package:smart_progress_bar/smart_progress_bar.dart';
|
|
|
|
import '../DoctorProfile.dart';
|
|
|
|
class DoctorView extends StatelessWidget {
|
|
DoctorList doctor;
|
|
|
|
|
|
DoctorView({@required this.doctor});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return InkWell(
|
|
onTap: () {
|
|
getDoctorsProfile(context, doctor);
|
|
},
|
|
child: Card(
|
|
margin: EdgeInsets.fromLTRB(10.0, 16.0, 10.0, 8.0),
|
|
color: Colors.white,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
child: Container(
|
|
decoration: BoxDecoration(),
|
|
padding: EdgeInsets.all(7.0),
|
|
width: MediaQuery.of(context).size.width,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: <Widget>[
|
|
ClipRRect(
|
|
borderRadius: BorderRadius.circular(100.0),
|
|
child: Image.network(this.doctor.doctorImageURL,
|
|
fit: BoxFit.fill, height: 60.0, width: 60.0),
|
|
),
|
|
Container(
|
|
width: MediaQuery.of(context).size.width * 0.5,
|
|
margin: EdgeInsets.fromLTRB(20.0, 10.0, 10.0, 0.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
Text(this.doctor.doctorTitle + " " + this.doctor.name,
|
|
style: TextStyle(
|
|
fontSize: 14.0,
|
|
color: Colors.grey[700],
|
|
letterSpacing: 1.0)),
|
|
Container(
|
|
margin: EdgeInsets.only(top: 3.0),
|
|
child: Text(this.doctor.clinicName,
|
|
style: TextStyle(
|
|
fontSize: 12.0,
|
|
color: Colors.grey[600],
|
|
letterSpacing: 1.0)),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(top: 3.0),
|
|
child: Text(this.doctor.projectName,
|
|
style: TextStyle(
|
|
fontSize: 12.0,
|
|
color: Colors.grey[600],
|
|
letterSpacing: 1.0)),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(top: 3.0, bottom: 3.0),
|
|
child: Text(
|
|
getDoctorSpeciality(this.doctor.speciality).trim(),
|
|
style: TextStyle(
|
|
fontSize: 12.0,
|
|
color: Colors.grey[600],
|
|
letterSpacing: 1.0)),
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: <Widget>[
|
|
RatingBar.readOnly(
|
|
initialRating:
|
|
this.doctor.actualDoctorRate.toDouble(),
|
|
size: 20.0,
|
|
filledColor: Colors.yellow[700],
|
|
emptyColor: Colors.grey[500],
|
|
isHalfAllowed: true,
|
|
halfFilledIcon: Icons.star_half,
|
|
filledIcon: Icons.star,
|
|
emptyIcon: Icons.star,
|
|
),
|
|
Container(
|
|
child: Image.network(this.doctor.nationalityFlagURL,
|
|
width: 25.0, height: 25.0),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
String getDoctorSpeciality(List<String> docSpecial) {
|
|
String docSpeciality = "";
|
|
docSpecial.forEach((v) {
|
|
docSpeciality = docSpeciality + v + "\n";
|
|
});
|
|
return docSpeciality;
|
|
}
|
|
|
|
getDoctorsProfile(context, DoctorList docObject, {isAppo}) {
|
|
List<DoctorProfileList> docProfileList = [];
|
|
DoctorsListService service = new DoctorsListService();
|
|
service
|
|
.getDoctorsProfile(docObject.doctorID, docObject.clinicID,
|
|
docObject.projectID, context)
|
|
.then((res) {
|
|
if (res['MessageStatus'] == 1) {
|
|
if (res['DoctorProfileList'].length != 0) {
|
|
res['DoctorProfileList'].forEach((v) {
|
|
docProfileList.add(new DoctorProfileList.fromJson(v));
|
|
});
|
|
} else {}
|
|
navigateToDoctorProfile(context, docObject, docProfileList[0],
|
|
isAppo: isAppo);
|
|
} else {
|
|
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
|
}
|
|
}).catchError((err) {
|
|
print(err);
|
|
}).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
|
|
}
|
|
|
|
Future navigateToDoctorProfile(context, docObject, docProfile,
|
|
{isAppo}) async {
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (context) => DoctorProfile(
|
|
doctor: docObject,
|
|
docProfileList: docProfile,
|
|
isOpenAppt: isAppo,
|
|
)));
|
|
}
|
|
}
|