add loader and cache on images
parent
1e1e230908
commit
47e19c4ab5
@ -1,97 +1,89 @@
|
|||||||
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
|
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
|
||||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
|
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
|
||||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
|
||||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:rating_bar/rating_bar.dart';
|
import 'package:rating_bar/rating_bar.dart';
|
||||||
|
|
||||||
class ReviewsInfo extends StatelessWidget {
|
class ReviewsInfo extends StatelessWidget {
|
||||||
final PharmacyProduct product;
|
final PharmacyProduct product;
|
||||||
|
final ProductDetailViewModel previousModel;
|
||||||
|
|
||||||
const ReviewsInfo({Key key, this.product}) : super(key: key);
|
const ReviewsInfo({Key key, this.product, this.previousModel}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BaseView<ProductDetailViewModel>(
|
return previousModel.productDetailService.length != 0 &&
|
||||||
onModelReady: (model) => model.getProductReviewsData(product.id),
|
previousModel.productDetailService[0].reviews.length != 0
|
||||||
allowAny: true,
|
? ListView.builder(
|
||||||
builder: (_, model, wi) => NetworkBaseView(
|
physics: ScrollPhysics(),
|
||||||
baseViewModel:model ,
|
itemCount: previousModel.productDetailService[0].reviews.length,
|
||||||
child: model.productDetailService.length != 0 &&
|
scrollDirection: Axis.vertical,
|
||||||
model.productDetailService[0].reviews.length != 0
|
shrinkWrap: true,
|
||||||
? ListView.builder(
|
itemBuilder: (BuildContext context, int index) {
|
||||||
physics: ScrollPhysics(),
|
return Padding(
|
||||||
itemCount: model.productDetailService[0].reviews.length,
|
padding: EdgeInsets.all(8.0),
|
||||||
scrollDirection: Axis.vertical,
|
child: Column(
|
||||||
shrinkWrap: true,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
return Padding(
|
children: [
|
||||||
padding: EdgeInsets.all(8.0),
|
Container(
|
||||||
child: Column(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
children: [
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
Container(
|
||||||
children: [
|
child: Text(
|
||||||
Container(
|
previousModel.productDetailService[0].reviews[index]
|
||||||
child: Row(
|
.customerId
|
||||||
children: [
|
.toString(),
|
||||||
Container(
|
style: TextStyle(
|
||||||
child: Text(
|
fontSize: 17,
|
||||||
model.productDetailService[0].reviews[index]
|
color: Colors.grey,
|
||||||
.customerId
|
fontWeight: FontWeight.w600),
|
||||||
.toString(),
|
),
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 17,
|
|
||||||
color: Colors.grey,
|
|
||||||
fontWeight: FontWeight.w600),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.only(left: 210),
|
|
||||||
child: RatingBar.readOnly(
|
|
||||||
initialRating: model.productDetailService[0]
|
|
||||||
.reviews[index].rating
|
|
||||||
.toDouble(),
|
|
||||||
size: 15.0,
|
|
||||||
filledColor: Colors.yellow[700],
|
|
||||||
emptyColor: Colors.grey[500],
|
|
||||||
isHalfAllowed: true,
|
|
||||||
halfFilledIcon: Icons.star_half,
|
|
||||||
filledIcon: Icons.star,
|
|
||||||
emptyIcon: Icons.star,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
child: Text(
|
|
||||||
model.productDetailService[0].reviews[index]
|
|
||||||
.reviewText,
|
|
||||||
style: TextStyle(fontSize: 20),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 50,
|
|
||||||
),
|
|
||||||
Divider(height: 1, color: Colors.grey),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
Container(
|
||||||
},
|
margin: EdgeInsets.only(left: 210),
|
||||||
)
|
child: RatingBar.readOnly(
|
||||||
: Container(
|
initialRating: previousModel.productDetailService[0]
|
||||||
padding: EdgeInsets.all(15),
|
.reviews[index].rating
|
||||||
alignment: Alignment.center,
|
.toDouble(),
|
||||||
|
size: 15.0,
|
||||||
|
filledColor: Colors.yellow[700],
|
||||||
|
emptyColor: Colors.grey[500],
|
||||||
|
isHalfAllowed: true,
|
||||||
|
halfFilledIcon: Icons.star_half,
|
||||||
|
filledIcon: Icons.star,
|
||||||
|
emptyIcon: Icons.star,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
child: Text(
|
child: Text(
|
||||||
TranslationBase.of(context).noReviewsAvailable,
|
previousModel.productDetailService[0].reviews[index]
|
||||||
|
.reviewText,
|
||||||
|
style: TextStyle(fontSize: 20),
|
||||||
),
|
),
|
||||||
// Text('No Reviews Available'),
|
|
||||||
),
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 50,
|
||||||
|
),
|
||||||
|
Divider(height: 1, color: Colors.grey),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: Container(
|
||||||
|
padding: EdgeInsets.all(15),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).noReviewsAvailable,
|
||||||
),
|
),
|
||||||
|
// Text('No Reviews Available'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue