rating bug fixed

merge-update-with-lab-changes
Sultan khan 3 years ago
parent f29d33d7e7
commit 0306c777ed

@ -1,6 +1,7 @@
extension CapExtension on String { extension CapExtension on String {
String get toCamelCase => "${this[0].toUpperCase()}${this.substring(1)}"; String get toCamelCase => "${this[0].toUpperCase()}${this.substring(1)}";
String get inCaps => '${this[0].toUpperCase()}${this.substring(1)}'; String get inCaps => '${this[0].toUpperCase()}${this.substring(1)}';
String get allInCaps => this.toUpperCase(); String get allInCaps => this.toUpperCase();
String get capitalizeFirstofEach => this.trim().length > 0 ? this.trim().toLowerCase().split(" ").map((str) => str.inCaps).join(" ") : ""; String get capitalizeFirstofEach => this.trim().length > 0 ? this.trim().toLowerCase().split(" ").map((str) => str.isNotEmpty ? str.inCaps: str).join(" ") : "";
} }

@ -298,12 +298,12 @@ class DoctorHeader extends StatelessWidget {
width: 100.0, width: 100.0,
margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0),
child: Text(TranslationBase.of(context).excellent, style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))), child: Text(TranslationBase.of(context).excellent, style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))),
getRatingLine(doctorDetailsList[0].patientNumber, Colors.green[700]), getRatingLine(doctorDetailsList[0].ratio, Colors.green[700]),
], ],
), ),
Container( Container(
margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0),
child: Text(getRatingWidth(doctorDetailsList[0].patientNumber).round().toString() + "%", child: Text(getRatingWidth(doctorDetailsList[0].ratio).round().toString() + "%",
style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)),
), ),
], ],
@ -319,12 +319,12 @@ class DoctorHeader extends StatelessWidget {
width: 100.0, width: 100.0,
margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0),
child: Text(TranslationBase.of(context).v_good, style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))), child: Text(TranslationBase.of(context).v_good, style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))),
getRatingLine(doctorDetailsList[1].patientNumber, Color(0xffB7B723)), getRatingLine(doctorDetailsList[1].ratio, Color(0xffB7B723)),
], ],
), ),
Container( Container(
margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0),
child: Text(getRatingWidth(doctorDetailsList[1].patientNumber).round().toString() + "%", child: Text(doctorDetailsList[1].ratio.round().toString() + "%",
style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)),
), ),
], ],
@ -340,12 +340,12 @@ class DoctorHeader extends StatelessWidget {
width: 100.0, width: 100.0,
margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0),
child: Text(TranslationBase.of(context).good, style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))), child: Text(TranslationBase.of(context).good, style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))),
getRatingLine(doctorDetailsList[2].patientNumber, Color(0xffEBA727)), getRatingLine(doctorDetailsList[2].ratio, Color(0xffEBA727)),
], ],
), ),
Container( Container(
margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0),
child: Text(getRatingWidth(doctorDetailsList[2].patientNumber).round().toString() + "%", child: Text(doctorDetailsList[2].ratio.round().toString() + "%",
style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)),
), ),
], ],
@ -361,12 +361,12 @@ class DoctorHeader extends StatelessWidget {
width: 100.0, width: 100.0,
margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0),
child: Text(TranslationBase.of(context).average, style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))), child: Text(TranslationBase.of(context).average, style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))),
getRatingLine(doctorDetailsList[3].patientNumber, Color(0xffEB7227)), getRatingLine(doctorDetailsList[3].ratio, Color(0xffEB7227)),
], ],
), ),
Container( Container(
margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0),
child: Text(getRatingWidth(doctorDetailsList[3].patientNumber).round().toString() + "%", child: Text(doctorDetailsList[3].ratio.round().toString() + "%",
style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)),
), ),
], ],
@ -383,12 +383,12 @@ class DoctorHeader extends StatelessWidget {
width: 100.0, width: 100.0,
margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0),
child: Text(TranslationBase.of(context).below_average, style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))), child: Text(TranslationBase.of(context).below_average, style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))),
getRatingLine(doctorDetailsList[4].patientNumber, Color(0xffE20C0C)), getRatingLine(doctorDetailsList[4].ratio, Color(0xffE20C0C)),
], ],
), ),
Container( Container(
margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0),
child: Text(getRatingWidth(doctorDetailsList[4].patientNumber).round().toString() + "%", child: Text(doctorDetailsList[4].ratio.round().toString() + "%",
style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)),
), ),
], ],
@ -410,12 +410,12 @@ class DoctorHeader extends StatelessWidget {
pageBuilder: (context, animation1, animation2) {}); pageBuilder: (context, animation1, animation2) {});
} }
double getRatingWidth(int patientNumber) { double getRatingWidth(double patientNumber) {
var width = (patientNumber / this.headerModel.totalReviews) * 100; var width = patientNumber;
return width.roundToDouble(); return width.roundToDouble();
} }
Widget getRatingLine(int patientNumber, Color color) { Widget getRatingLine(double patientNumber, Color color) {
return Container( return Container(
margin: EdgeInsets.only(top: 10.0), margin: EdgeInsets.only(top: 10.0),
child: Stack(children: [ child: Stack(children: [
@ -427,7 +427,7 @@ class DoctorHeader extends StatelessWidget {
), ),
), ),
SizedBox( SizedBox(
width: getRatingWidth(patientNumber) * 1.35, width: patientNumber * 1.35,
height: 4.0, height: 4.0,
child: Container( child: Container(
color: color, color: color,

Loading…
Cancel
Save