import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/profile/profile.dart'; import 'package:rating_bar/rating_bar.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; import 'package:diplomaticquarterapp/widgets//pharmacy/product_tile.dart'; class ProductReviewPage extends StatefulWidget { @override _ProductReviewPageState createState() => _ProductReviewPageState(); } class _ProductReviewPageState extends State { String orderId ="3516"; var pharmacyUser =""; var product =""; var CustomerId =""; String submitTxt =""; var doctorRating= ""; var reviewObj = {}; AppSharedPreferences sharedPref = AppSharedPreferences(); @override Widget build(BuildContext context) { return BaseView( onModelReady: (model)=>model.getProductReview(orderId), builder: (_,model, wi )=> AppScaffold( appBarTitle: TranslationBase.of(context).writeReview, isShowAppBar: true, isPharmacy:true , body: Container( color: Colors.white, child: SingleChildScrollView( child: Column( children: [ // Container( // child: productTile(productName: 'Panadol Extra 500 MG', productPrice: '10.00', productRate: 3.00, // productReviews:4, ), // ), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Container( margin: EdgeInsets.only(left: 10), child: SvgPicture.asset( // model.order[0].orderItems[0].product.images[0].src.toString(), 'assets/images/al-habib_onlne_pharmacy_bg.png', fit: BoxFit.cover, width: 80, height: 80, ), ),] ), Container( margin: EdgeInsets.only(top :15.0, bottom: 15.0), child: Column( children: [ Row( children: [ Text(model.order[0].orderItems[0].product.name.toString(), style: TextStyle(fontSize: 16.0, ), ), ], ), Row( children: [ Container( margin: EdgeInsets.only(left: 5), child: Text(model.order[0].orderItems[0].product.price.toString(), style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, ), ), ), Container( margin: EdgeInsets.only(left: 5), child: Text(TranslationBase.of(context).sar, style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, ), ), ), ], ), Row( children: [ Container( margin: EdgeInsets.all(5), child: Align( alignment: Alignment.topLeft, child: RatingBar.readOnly( initialRating: 3, size: 15.0, filledColor: Colors.yellow[700], emptyColor: Colors.grey[500], isHalfAllowed: true, halfFilledIcon: Icons.star_half, filledIcon: Icons.star, emptyIcon: Icons.star, ), ), ), Container( child: Text(model.order[0].orderItems[0].product.approvedRatingSum.toString(), style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold, ), ), ), Container( margin: EdgeInsets.only(left: 5), child: Text("(" + model.order[0].orderItems[0].product.approvedTotalReviews.toString() + ' ' + TranslationBase.of(context).review +")", style: TextStyle(fontSize: 12.0, ), ), ), ], ), ], ), ), Divider( color: Colors.grey[350], height: 20, thickness: 8, indent: 0, endIndent: 0, ), Container( margin: EdgeInsets.only( top: 12.0), child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisSize: MainAxisSize.max, children: [ RatingBar( // initialRating: // this.doctor.actualDoctorRate.toDouble(), size: 40.0, filledColor: Colors.yellow[700], emptyColor: Colors.grey[500], isHalfAllowed: true, halfFilledIcon: Icons.star_half, filledIcon: Icons.star, emptyIcon: Icons.star, ), ], ), ), Container( padding: EdgeInsets.fromLTRB(8.0, 20.0, 8.0,20.0), child: Column( children: [ TextFormField ( decoration: InputDecoration( contentPadding: const EdgeInsets.symmetric(vertical: 60.0), border: InputBorder.none, hintText: 'Tell us more about product!', focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(5.0), borderSide: BorderSide(width: 1, color: Colors.grey[400]), ), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(5.0)), borderSide: BorderSide(color: Colors.grey[400], width: 1), ), ), ), ], ), ), InkWell( onTap: () { // Navigator.push(context, // MaterialPageRoute(builder: (context) => )); }, child: Container( height: 50.0, width: 400.0, color: Colors.transparent, child: Container( decoration: BoxDecoration( border: Border.all( color: Colors.yellow[700], style: BorderStyle.solid, width: 1.0 ), color: Colors.yellow[700], borderRadius: BorderRadius.circular(5.0) ), child: Center( child: Text( TranslationBase.of(context).shareReview, style: TextStyle( color: Colors.white, fontSize: 16.0, fontWeight: FontWeight.bold, ), ), ), ), ), ), ], ), ), ),), ); } //new screen is showing after submitting the review Widget getReviewedProduct(){ return Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Row( mainAxisAlignment: MainAxisAlignment.center, children: [ SvgPicture.asset( 'assets/images/pharmacy/check_icon.svg', width: 28, height: 28,), Container( margin: EdgeInsets.only(left: 10.0), child: Text(TranslationBase.of(context).reviewSuccessful, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold, ), ), ), ], ), Container( margin: EdgeInsets.only(top:5.0, bottom: 20.0 ), child: Text(TranslationBase.of(context).reviewShared, style: TextStyle(fontSize: 15.0, ), ), ), Container( margin: EdgeInsets.only(bottom: 30.0, top: 30.0 ), child: SvgPicture.asset( 'assets/images/pharmacy/success_review_icon.svg', width: 100, height: 100,), ), Container( margin: EdgeInsets.only(left: 20.0, right: 20.0), child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.start, children: [ SvgPicture.asset( 'assets/images/pharmacy/quote_start.svg', width: 15, height: 15,), ], ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Text(TranslationBase.of(context).reviewComment, style: TextStyle(fontSize: 15.0, ), ), ], ), Row( mainAxisAlignment: MainAxisAlignment.end, children: [ SvgPicture.asset( 'assets/images/pharmacy/quote_end.svg', width: 15, height: 15,), ], ), ], ), ), Container( margin: EdgeInsets.only(top: 20.0 ), child: InkWell( onTap: () { Navigator.push( context, MaterialPageRoute(builder: (context) { return PharmacyProfilePage(); }), ); }, child: Container( height: 50.0, color: Colors.transparent, child: Container( decoration: BoxDecoration( border: Border.all( color: Colors.orange, style: BorderStyle.solid, width: 1.0 ), color: Colors.transparent, borderRadius: BorderRadius.circular(5.0) ), child: Center( child: Text( TranslationBase.of(context).backMyAccount, style: TextStyle( color: Colors.orange, fontWeight: FontWeight.bold, ), ), ), ), ), ), ), ], ); } // submit(){ // this.orderId.id = "0"; // this.reviewObj.position = 0; // this.reviewObj.customerId = this.pharmacyUser.CustomerId; // this.reviewObj.productId = this.product.id; // this.reviewObj.storeId = 2; // this.reviewObj.isApproved = false; // this.reviewObj.title =''; // this.reviewObj.reviewText = this.submitTxt; // this.reviewObj.rating = this.doctorRating; // this.reviewObj.replyText = null; // this.reviewObj.helpfulYesTotal = 0; // this.reviewObj.helpfulNoTotal = 0; // this.reviewObj.createdOnUtc = new Date().toString(); // this.submitProductReview(); // } submitProductReview(){ } }