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.
PatientApp-KKUMC/lib/widgets/pharmacy/product_tile.dart

358 lines
15 KiB
Dart

import 'package:diplomaticquarterapp/pages/pharmacy/order/ProductReview.dart';
import 'package:flutter/material.dart';
import 'package:flutter_html/style.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:rating_bar/rating_bar.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
class productTile extends StatelessWidget {
final String productName;
final String productPrice;
final double productRate;
final int productReviews;
final String qyt;
final String totalPrice;
final bool isOrderDetails;
final String productImage;
final bool showLine;
productTile(
{this.productName,
this.productPrice,
this.productRate,
this.qyt,
this.totalPrice,
this.productReviews,
this.isOrderDetails = true,
this.productImage,
this.showLine = true});
@override
Widget build(BuildContext context) {
return Container(
height: 180,
width: double.infinity,
color: Colors.white,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
children: [
Container(
margin: EdgeInsets.only(left: 10),
child: Image.network(
productImage.trim(),
fit: BoxFit.cover,
width: 80,
height: 80,
),
// child: Image(
// image:
// AssetImage('assets/images/al-habib_onlne_pharmacy_bg.png'),
// fit: BoxFit.cover,
// width: 80,
// height: 80,
// ),
),
Expanded(
flex: 5,
child: Column(
children: [
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: productName,
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
),
),
),
),
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: 'SAR $productPrice',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
),
),
),
),
this.isOrderDetails == false
? Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RatingBar.readOnly(
initialRating: productRate,
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
),
)
: Container(),
],
),
),
this.isOrderDetails == false
? Expanded(
flex: 1,
child: Column(
children: [
Icon(FontAwesomeIcons.trashAlt, size: 15),
SizedBox(
height: 50,
),
Icon(FontAwesomeIcons.shoppingCart, size: 15),
],
),
)
: Container(),
],
),
this.isOrderDetails == true
? Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Container(
margin: EdgeInsets.only(bottom: 5.0),
child: RichText(
text: TextSpan(
text: 'QYT: $qyt',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.grey,
fontSize: 13),
),
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
TranslationBase.of(context).total,
style: TextStyle(
color: Colors.grey,
fontSize: 13.0,
fontWeight: FontWeight.bold,
),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
RichText(
text: TextSpan(
text: ' $totalPrice SAR',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 15),
),
),
],
),
],
),
],
),
)
: Container(),
// this.isOrderDetails == true && model.order[0].orderStatusId == 30?
this.isOrderDetails == true
? Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Container(
// margin: EdgeInsets.all(5.0),
child: Align(
alignment: Alignment.topLeft,
child: RatingBar.readOnly(
initialRating: productRate,
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
),
),
Container(
// margin: EdgeInsets.all(5),
child: Align(
// alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: '($productReviews reviews)',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.grey,
fontSize: 13),
),
),
),
),
InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ProductReviewPage()));
},
child: Container(
padding: EdgeInsets.only(
left: 13.0, right: 13.0, top: 5.0),
height: 30.0,
decoration: BoxDecoration(
border: Border.all(
color: Colors.orange,
style: BorderStyle.solid,
width: 1.0),
color: Colors.transparent,
borderRadius: BorderRadius.circular(5.0)),
child: Text(
TranslationBase.of(context).writeReview,
style: TextStyle(
fontSize: 12,
color: Colors.orange,
),
),
),
),
],
),
)
: Container(
child: Padding(
padding: EdgeInsets.all(8.0),
child: Row(
children: [
Padding(
padding: EdgeInsets.only(left: 15),
child: Container(
width: 160,
height: 200,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border(
top: BorderSide(
width: 0.5, color: Colors.grey),
left: BorderSide(
width: 0.5, color: Colors.grey),
right: BorderSide(
width: 0.5, color: Colors.grey),
bottom: BorderSide(
width: 0.5, color: Colors.grey),
),
color: Colors.white),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(
height: 2,
),
Container(
child: Image.network(
productImage.trim(),
fit: BoxFit.cover,
width: 80,
height: 70,
),
),
SizedBox(
height: 10,
),
// Container(width: 150,height: 20,color: Colors.green,),
Container(
alignment: Alignment.centerLeft,
child: Column(
children: [
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: productName,
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
),
),
),
),
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: 'SAR $productPrice',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
),
),
),
),
Container(
alignment: Alignment.topLeft,
margin: EdgeInsets.all(5),
child: Align(
child: RatingBar.readOnly(
initialRating: productRate,
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
),
),
],
),
),
],
),
),
),
],
),
),
),
],
),
);
}
}