You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
195 lines
6.7 KiB
Dart
195 lines
6.7 KiB
Dart
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/review_view_model.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
import 'package:rating_bar/rating_bar.dart';
|
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
|
|
|
void main() => runApp(MyReviewsPage());
|
|
|
|
class MyReviewsPage extends StatefulWidget {
|
|
@override
|
|
_MyReviewsPageState createState() => _MyReviewsPageState();
|
|
}
|
|
|
|
class _MyReviewsPageState extends State<MyReviewsPage> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BaseView<ReviewViewModel>(
|
|
onModelReady: (model) => model.getReviewData(),
|
|
builder: (_, model, wi) => AppScaffold(
|
|
appBarTitle: 'Wishlist page',
|
|
isShowAppBar: true,
|
|
isPharmacy: true,
|
|
body: Container(
|
|
child: ListView.builder(
|
|
itemCount: model.reviewListList.length,
|
|
itemBuilder: (BuildContext context, int index) {
|
|
return Column(
|
|
children: [
|
|
Container(
|
|
child: reviewDetails(
|
|
model.reviewListList[index],
|
|
double.parse(model.reviewListList[index].product
|
|
.approvedTotalReviews.toString()),
|
|
double.parse(model.reviewListList[index].rating.toString()),
|
|
),
|
|
),
|
|
Divider(height: 1, color: Colors.grey)
|
|
],
|
|
);
|
|
}),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
reviewDetails(data, rate, myRate) {
|
|
return Container(
|
|
child: Padding(
|
|
padding: const EdgeInsets.only(bottom: 10.0),
|
|
child: Container(
|
|
height: 200,
|
|
width: double.infinity,
|
|
color: Colors.white,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Container(
|
|
margin: EdgeInsets.only(top: 10, left: 10),
|
|
child: Image.network(
|
|
data.product.images[0].src.trim(),
|
|
fit: BoxFit.cover,
|
|
width: 80,
|
|
height: 80,
|
|
),
|
|
),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
Container(
|
|
margin: EdgeInsets.all(5),
|
|
child: Align(
|
|
alignment: Alignment.topLeft,
|
|
child: RichText(
|
|
text: TextSpan(
|
|
text: data.product.name,
|
|
style: TextStyle(
|
|
color: Colors.black54,
|
|
fontSize: 13,
|
|
fontWeight: FontWeight.bold),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Column(
|
|
children: [
|
|
Container(
|
|
margin: EdgeInsets.all(5),
|
|
child: Align(
|
|
alignment: Alignment.topLeft,
|
|
child: RichText(
|
|
text: TextSpan(
|
|
text: data.product.price.toString() +
|
|
" " +
|
|
data.product.currency,
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.black,
|
|
fontSize: 13),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.all(5),
|
|
child: Align(
|
|
alignment: Alignment.topLeft,
|
|
child: RatingBar.readOnly(
|
|
initialRating: rate,
|
|
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: 20,
|
|
),
|
|
Container(
|
|
child: Row(
|
|
children: [
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
Container(
|
|
padding: EdgeInsets.only(left: 10),
|
|
child: Text(data.createdOnUtc.toString())),
|
|
],
|
|
),
|
|
),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
children: [
|
|
Container(
|
|
padding: EdgeInsets.only(left: 60),
|
|
child: RatingBar.readOnly(
|
|
initialRating: myRate,
|
|
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: 15,
|
|
),
|
|
Expanded(
|
|
child: Container(
|
|
padding: EdgeInsets.only(left: 10),
|
|
child: Text(fixingString(data.reviewText.toString())),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
fixingString(txt){
|
|
String stringTxt;
|
|
String newTxt;
|
|
stringTxt = txt.toString();
|
|
newTxt = stringTxt.split('.')[1];
|
|
|
|
return newTxt;
|
|
}
|