|
|
|
|
@ -1,10 +1,10 @@
|
|
|
|
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/review_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:rating_bar/rating_bar.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
|
|
|
|
|
|
|
|
|
class MyReviewsPage extends StatefulWidget {
|
|
|
|
|
@override
|
|
|
|
|
@ -47,7 +47,8 @@ class _MyReviewsPageState extends State<MyReviewsPage> {
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: Text(TranslationBase.of(context).noData,
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).noData,
|
|
|
|
|
// 'There is no data',
|
|
|
|
|
style: TextStyle(fontSize: 30),
|
|
|
|
|
),
|
|
|
|
|
@ -65,11 +66,8 @@ class _MyReviewsPageState extends State<MyReviewsPage> {
|
|
|
|
|
Container(
|
|
|
|
|
child: reviewDetails(
|
|
|
|
|
model.reviewListList[index],
|
|
|
|
|
double.parse(model.reviewListList[index].product
|
|
|
|
|
.approvedTotalReviews
|
|
|
|
|
.toString()),
|
|
|
|
|
double.parse(model.reviewListList[index].rating
|
|
|
|
|
.toString()),
|
|
|
|
|
double.parse(model.reviewListList[index].product.approvedTotalReviews.toString()),
|
|
|
|
|
double.parse(model.reviewListList[index].rating.toString()),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Divider(height: 1, color: Colors.grey)
|
|
|
|
|
@ -97,9 +95,7 @@ reviewDetails(data, rate, myRate) {
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
margin: languageID == 'ar'
|
|
|
|
|
? EdgeInsets.only(top: 10, right: 10)
|
|
|
|
|
: EdgeInsets.only(top: 10, left: 10),
|
|
|
|
|
margin: languageID == 'ar' ? EdgeInsets.only(top: 10, right: 10) : EdgeInsets.only(top: 10, left: 10),
|
|
|
|
|
child: Image.network(
|
|
|
|
|
data.product.images[0].src.trim(),
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
@ -114,18 +110,11 @@ reviewDetails(data, rate, myRate) {
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.all(5),
|
|
|
|
|
child: Align(
|
|
|
|
|
alignment: languageID == 'ar'
|
|
|
|
|
? Alignment.topRight
|
|
|
|
|
: Alignment.topLeft,
|
|
|
|
|
alignment: languageID == 'ar' ? Alignment.topRight : Alignment.topLeft,
|
|
|
|
|
child: RichText(
|
|
|
|
|
text: TextSpan(
|
|
|
|
|
text: languageID == 'ar'
|
|
|
|
|
? data.product.namen
|
|
|
|
|
: data.product.name,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.black54,
|
|
|
|
|
fontSize: languageID == 'ar' ? 12 : 13,
|
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
|
text: languageID == 'ar' ? data.product.namen : data.product.name,
|
|
|
|
|
style: TextStyle(color: Colors.black54, fontSize: languageID == 'ar' ? 12 : 13, fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -135,18 +124,11 @@ reviewDetails(data, rate, myRate) {
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.all(5),
|
|
|
|
|
child: Align(
|
|
|
|
|
alignment: languageID == 'ar'
|
|
|
|
|
? Alignment.topRight
|
|
|
|
|
: Alignment.topLeft,
|
|
|
|
|
alignment: languageID == 'ar' ? Alignment.topRight : Alignment.topLeft,
|
|
|
|
|
child: RichText(
|
|
|
|
|
text: TextSpan(
|
|
|
|
|
text: data.product.quantity.toString() +
|
|
|
|
|
" " +
|
|
|
|
|
data.product.currency,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
fontSize: 13),
|
|
|
|
|
text: data.product.price.toString() + " " + data.product.currency,
|
|
|
|
|
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -156,9 +138,7 @@ reviewDetails(data, rate, myRate) {
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.all(5),
|
|
|
|
|
child: Align(
|
|
|
|
|
alignment: languageID == 'ar'
|
|
|
|
|
? Alignment.topRight
|
|
|
|
|
: Alignment.topLeft,
|
|
|
|
|
alignment: languageID == 'ar' ? Alignment.topRight : Alignment.topLeft,
|
|
|
|
|
child: RatingBar.readOnly(
|
|
|
|
|
initialRating: rate,
|
|
|
|
|
size: 15.0,
|
|
|
|
|
@ -186,11 +166,7 @@ reviewDetails(data, rate, myRate) {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
padding: languageID == 'ar'
|
|
|
|
|
? EdgeInsets.only(right: 10)
|
|
|
|
|
: EdgeInsets.only(left: 10),
|
|
|
|
|
child: Text(data.createdOnUtc.toString().substring(0 , 11))),
|
|
|
|
|
Container(padding: languageID == 'ar' ? EdgeInsets.only(right: 10) : EdgeInsets.only(left: 10), child: Text(data.createdOnUtc.toString().substring(0, 11))),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -200,9 +176,7 @@ reviewDetails(data, rate, myRate) {
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
padding: languageID == 'ar'
|
|
|
|
|
? EdgeInsets.only(right: 60)
|
|
|
|
|
: EdgeInsets.only(left: 60),
|
|
|
|
|
padding: languageID == 'ar' ? EdgeInsets.only(right: 60) : EdgeInsets.only(left: 60),
|
|
|
|
|
child: RatingBar.readOnly(
|
|
|
|
|
initialRating: myRate,
|
|
|
|
|
size: 15.0,
|
|
|
|
|
@ -225,10 +199,8 @@ reviewDetails(data, rate, myRate) {
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: languageID == 'ar'
|
|
|
|
|
? EdgeInsets.only(right: 10)
|
|
|
|
|
: EdgeInsets.only(left: 10),
|
|
|
|
|
child: Text(fixingString(data.reviewText.toString())),
|
|
|
|
|
padding: languageID == 'ar' ? EdgeInsets.only(right: 10) : EdgeInsets.only(left: 10),
|
|
|
|
|
child: Text(getReview(data) ?? ""),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
@ -238,6 +210,20 @@ reviewDetails(data, rate, myRate) {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String getReview(data) {
|
|
|
|
|
String reviewTxt = "";
|
|
|
|
|
|
|
|
|
|
if (data.reviewText == null && data.replyText == null) {
|
|
|
|
|
reviewTxt = "";
|
|
|
|
|
}
|
|
|
|
|
if (data.reviewText == null)
|
|
|
|
|
reviewTxt = data.replyText;
|
|
|
|
|
else
|
|
|
|
|
reviewTxt = data.reviewText;
|
|
|
|
|
|
|
|
|
|
return reviewTxt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fixingString(txt) {
|
|
|
|
|
String stringTxt;
|
|
|
|
|
String newTxt;
|
|
|
|
|
|