@ -0,0 +1,36 @@
|
||||
class DoctorRateDetails {
|
||||
dynamic doctorID;
|
||||
dynamic projectID;
|
||||
dynamic clinicID;
|
||||
dynamic rate;
|
||||
dynamic patientNumber;
|
||||
dynamic ratio;
|
||||
|
||||
DoctorRateDetails(
|
||||
{this.doctorID,
|
||||
this.projectID,
|
||||
this.clinicID,
|
||||
this.rate,
|
||||
this.patientNumber,
|
||||
this.ratio});
|
||||
|
||||
DoctorRateDetails.fromJson(Map<String, dynamic> json) {
|
||||
doctorID = json['DoctorID'];
|
||||
projectID = json['ProjectID'];
|
||||
clinicID = json['ClinicID'];
|
||||
rate = json['Rate'];
|
||||
patientNumber = json['PatientNumber'];
|
||||
ratio = json['Ratio'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['DoctorID'] = this.doctorID;
|
||||
data['ProjectID'] = this.projectID;
|
||||
data['ClinicID'] = this.clinicID;
|
||||
data['Rate'] = this.rate;
|
||||
data['PatientNumber'] = this.patientNumber;
|
||||
data['Ratio'] = this.ratio;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,195 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
|
||||
import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart';
|
||||
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
||||
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class DoctorRatingDetails extends StatelessWidget {
|
||||
const DoctorRatingDetails({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Consumer<BookAppointmentsViewModel>(builder: (context, bookAppointmentsVM, child) {
|
||||
return bookAppointmentsVM.isDoctorRatingDetailsLoading
|
||||
? Utils.getLoadingWidget()
|
||||
: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
bookAppointmentsVM.doctorsProfileResponseModel.actualDoctorRate!.ceilToDouble().toString().toText44(isBold: true),
|
||||
SizedBox(height: 4.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
"${bookAppointmentsVM.doctorsProfileResponseModel.noOfPatientsRate} ${LocaleKeys.reviews.tr(context: context)}"
|
||||
.toText16(weight: FontWeight.w500, color: AppColors.greyInfoTextColor),
|
||||
RatingBar(
|
||||
initialRating: bookAppointmentsVM.doctorsProfileResponseModel.actualDoctorRate!.toDouble(),
|
||||
direction: Axis.horizontal,
|
||||
allowHalfRating: true,
|
||||
itemCount: 5,
|
||||
itemSize: 20.h,
|
||||
ignoreGestures: true,
|
||||
ratingWidget: RatingWidget(
|
||||
full: Icon(
|
||||
Icons.star,
|
||||
color: AppColors.ratingColorYellow,
|
||||
size: 24.h,
|
||||
),
|
||||
half: Icon(
|
||||
Icons.star_half,
|
||||
color: AppColors.ratingColorYellow,
|
||||
),
|
||||
empty: Icon(
|
||||
Icons.star,
|
||||
color: AppColors.ratingColorYellow,
|
||||
),
|
||||
),
|
||||
tapOnlyMode: true,
|
||||
unratedColor: Colors.grey[500],
|
||||
itemPadding: EdgeInsets.symmetric(horizontal: 4.0),
|
||||
onRatingUpdate: (rating) {
|
||||
print(rating);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8.h),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 10.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 100.0,
|
||||
margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0),
|
||||
child: Text(LocaleKeys.excellent.tr(context: context), style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))),
|
||||
getRatingLine(bookAppointmentsVM.doctorDetailsList[0].ratio, Colors.green[700]!),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0),
|
||||
child: Text("${getRatingWidth(bookAppointmentsVM.doctorDetailsList[0].ratio).round()}%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 100.0,
|
||||
margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0),
|
||||
child: Text(LocaleKeys.vGood.tr(context: context), style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))),
|
||||
getRatingLine(bookAppointmentsVM.doctorDetailsList[1].ratio, Color(0xffB7B723)),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0),
|
||||
child: Text("${bookAppointmentsVM.doctorDetailsList[1].ratio.round()}%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 100.0,
|
||||
margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0),
|
||||
child: Text(LocaleKeys.good.tr(context: context), style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))),
|
||||
getRatingLine(bookAppointmentsVM.doctorDetailsList[2].ratio, Color(0xffEBA727)),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0),
|
||||
child: Text("${bookAppointmentsVM.doctorDetailsList[2].ratio.round()}%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 100.0,
|
||||
margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0),
|
||||
child: Text(LocaleKeys.average.tr(context: context), style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))),
|
||||
getRatingLine(bookAppointmentsVM.doctorDetailsList[3].ratio, Color(0xffEB7227)),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0),
|
||||
child: Text("${bookAppointmentsVM.doctorDetailsList[3].ratio.round()}%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(bottom: 30.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 100.0,
|
||||
margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0),
|
||||
child: Text(LocaleKeys.average.tr(context: context), style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))),
|
||||
getRatingLine(bookAppointmentsVM.doctorDetailsList[4].ratio, Color(0xffE20C0C)),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0),
|
||||
child: Text("${bookAppointmentsVM.doctorDetailsList[4].ratio.round()}%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
double getRatingWidth(num patientNumber) {
|
||||
var width = patientNumber;
|
||||
return width.roundToDouble();
|
||||
}
|
||||
|
||||
Widget getRatingLine(double patientNumber, Color color) {
|
||||
return Container(
|
||||
margin: EdgeInsets.only(top: 10.0),
|
||||
child: Stack(children: [
|
||||
SizedBox(
|
||||
width: 150.0,
|
||||
height: 7.h,
|
||||
child: Container(
|
||||
color: Colors.grey[300],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: patientNumber * 1.55,
|
||||
height: 7.h,
|
||||
child: Container(
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
]),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue