fixed rating issues

merge-requests/489/head
Fatimah Alshammari 3 years ago
parent 77c8c85e88
commit eb4801c7ee

@ -15,6 +15,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:rating_bar/rating_bar.dart';
import 'base/base_view.dart'; import 'base/base_view.dart';
@ -274,11 +275,21 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
), ),
Row( Row(
children: [ children: [
StarRating( // StarRating(
totalAverage: model.finalProducts[index].approvedRatingSum > 0 // totalAverage: model.finalProducts[index].approvedRatingSum > 0
? (model.finalProducts[index].approvedRatingSum.toDouble() / model.finalProducts[index].approvedRatingSum.toDouble()).toDouble() // ? (model.finalProducts[index].approvedRatingSum.toDouble() / model.finalProducts[index].approvedRatingSum.toDouble()).toDouble()
: 0, // : 0,
forceStars: true), // forceStars: true),
RatingBar.readOnly(
initialRating: model.finalProducts[index].approvedRatingSum.toDouble(),
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
Texts( Texts(
"(${model.finalProducts[index].approvedTotalReviews})", "(${model.finalProducts[index].approvedTotalReviews})",
regular: true, regular: true,
@ -424,11 +435,21 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
), ),
Row( Row(
children: [ children: [
StarRating( // StarRating(
totalAverage: model.finalProducts[index].approvedRatingSum > 0 // totalAverage: model.finalProducts[index].approvedRatingSum > 0
? (model.finalProducts[index].approvedRatingSum.toDouble() / model.finalProducts[index].approvedRatingSum.toDouble()).toDouble() // ? (model.finalProducts[index].approvedRatingSum.toDouble() / model.finalProducts[index].approvedRatingSum.toDouble()).toDouble()
: 0, // : 0,
forceStars: true), // forceStars: true),
RatingBar.readOnly(
initialRating: model.finalProducts[index].approvedRatingSum.toDouble(),
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
Texts( Texts(
"(${model.finalProducts[index].approvedTotalReviews})", "(${model.finalProducts[index].approvedTotalReviews})",
regular: true, regular: true,

@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart';
import 'base/base_view.dart'; import 'base/base_view.dart';
@ -428,14 +429,24 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
), ),
Row( Row(
children: [ children: [
StarRating( // StarRating(
totalAverage: model.products[index].approvedRatingSum > // totalAverage: model.products[index].approvedRatingSum >
0 // 0
? (model.products[index].approvedRatingSum.toDouble() / model.products[index].approvedRatingSum.toDouble()) // ? (model.products[index].approvedRatingSum.toDouble() / model.products[index].approvedRatingSum.toDouble())
.toDouble() // .toDouble()
: 0, // : 0,
forceStars: // forceStars:
true), // true),
RatingBar.readOnly(
initialRating: model.products[index].approvedRatingSum.toDouble(),
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
Texts( Texts(
"(${model.products[index].approvedTotalReviews})", "(${model.products[index].approvedTotalReviews})",
regular: true, regular: true,
@ -663,19 +674,29 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
), ),
Row( Row(
children: [ children: [
StarRating( // StarRating(
totalAverage: model // totalAverage: model
.products[ // .products[
index] // index]
.approvedRatingSum > // .approvedRatingSum >
0 // 0
? (model.products[index].approvedRatingSum.toDouble() / // ? (model.products[index].approvedRatingSum.toDouble() /
model.products[index].approvedRatingSum // model.products[index].approvedRatingSum
.toDouble()) // .toDouble())
.toDouble() // .toDouble()
: 0, // : 0,
forceStars: // forceStars:
true), // true),
RatingBar.readOnly(
initialRating: model.products[index].approvedRatingSum.toDouble(),
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
Texts( Texts(
"(${model.products[index].approvedTotalReviews})", "(${model.products[index].approvedTotalReviews})",
regular: true, regular: true,

@ -22,6 +22,7 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart';
import 'base/base_view.dart'; import 'base/base_view.dart';
@ -714,11 +715,21 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
Row( Row(
children: [ children: [
StarRating( // StarRating(
totalAverage: model.parentProducts[index].approvedRatingSum > 0 // totalAverage: model.parentProducts[index].approvedRatingSum > 0
? (model.parentProducts[index].approvedRatingSum.toDouble() / model.parentProducts[index].approvedRatingSum.toDouble()).toDouble() // ? (model.parentProducts[index].approvedRatingSum.toDouble() / model.parentProducts[index].approvedRatingSum.toDouble()).toDouble()
: 0, // : 0,
forceStars: true), // forceStars: true),
RatingBar.readOnly(
initialRating: model.parentProducts[index].approvedRatingSum.toDouble(),
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
Texts( Texts(
"(${model.parentProducts[index].approvedTotalReviews})", "(${model.parentProducts[index].approvedTotalReviews})",
regular: true, regular: true,
@ -838,11 +849,21 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
Row( Row(
children: [ children: [
StarRating( // StarRating(
totalAverage: model.parentProducts[index].approvedRatingSum > 0 // totalAverage: model.parentProducts[index].approvedRatingSum > 0
? (model.parentProducts[index].approvedRatingSum.toDouble() / model.parentProducts[index].approvedRatingSum.toDouble()).toDouble() // ? (model.parentProducts[index].approvedRatingSum.toDouble() / model.parentProducts[index].approvedRatingSum.toDouble()).toDouble()
: 0, // : 0,
forceStars: true), // forceStars: true),
RatingBar.readOnly(
initialRating: model.parentProducts[index].approvedRatingSum.toDouble(),
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
Texts( Texts(
"(${model.parentProducts[index].approvedTotalReviews})", "(${model.parentProducts[index].approvedTotalReviews})",
regular: true, regular: true,

@ -17,6 +17,7 @@ import 'package:diplomaticquarterapp/widgets/others/entity_checkbox_list.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:rating_bar/rating_bar.dart';
import 'base/base_view.dart'; import 'base/base_view.dart';
import 'final_products_page.dart'; import 'final_products_page.dart';
@ -641,11 +642,21 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
), ),
Row( Row(
children: [ children: [
StarRating( // StarRating(
totalAverage: model.subProducts[index].approvedRatingSum > 0 // totalAverage: model.subProducts[index].approvedRatingSum > 0
? (model.subProducts[index].approvedRatingSum.toDouble() / model.subProducts[index].approvedRatingSum.toDouble()).toDouble() // ? (model.subProducts[index].approvedRatingSum.toDouble() / model.subProducts[index].approvedRatingSum.toDouble()).toDouble()
: 0, // : 0,
forceStars: true), // forceStars: true),
RatingBar.readOnly(
initialRating: model.subProducts[index].approvedRatingSum.toDouble(),
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
Texts( Texts(
"(${model.subProducts[index].approvedTotalReviews})", "(${model.subProducts[index].approvedTotalReviews})",
regular: true, regular: true,
@ -766,11 +777,21 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
), ),
Row( Row(
children: [ children: [
StarRating( // StarRating(
totalAverage: model.subProducts[index].approvedRatingSum > 0 // totalAverage: model.subProducts[index].approvedRatingSum > 0
? (model.subProducts[index].approvedRatingSum.toDouble() / model.subProducts[index].approvedRatingSum.toDouble()).toDouble() // ? (model.subProducts[index].approvedRatingSum.toDouble() / model.subProducts[index].approvedRatingSum.toDouble()).toDouble()
: 0, // : 0,
forceStars: true), // forceStars: true),
RatingBar.readOnly(
initialRating: model.subProducts[index].approvedRatingSum.toDouble(),
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
Texts( Texts(
"(${model.subProducts[index].approvedTotalReviews})", "(${model.subProducts[index].approvedTotalReviews})",
regular: true, regular: true,

Loading…
Cancel
Save