fix issues

merge-update-with-lab-changes
Elham Rababh 5 years ago
parent 769dc4e0ac
commit 2839af658a

@ -2,112 +2,83 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_deta
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.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';
class AvailabilityInfo extends StatelessWidget { class AvailabilityInfo extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<ProductDetailViewModel>( return BaseView<ProductDetailViewModel>(
onModelReady: (model) => onModelReady: (model) => model.getProductLocationData(),
model.getProductLocationData(),
builder: (_, model, wi) => model builder: (_, model, wi) => NetworkBaseView(
.productLocationService baseViewModel: model,
.length == child: model.productLocationService.length == 0
0 ? Container(
? Container( padding: EdgeInsets.all(15),
padding: EdgeInsets.all(15), alignment: Alignment.center,
alignment: Alignment.center, child: Text(
child: Text( TranslationBase.of(context).noLocationAvailable,
TranslationBase.of(context) ),
.noLocationAvailable, )
), : ListView.builder(
// Text('No location Available'), physics: ScrollPhysics(),
) scrollDirection: Axis.vertical,
: ListView.builder( shrinkWrap: true,
physics: ScrollPhysics(), itemCount: model.productLocationService.length,
scrollDirection: Axis.vertical, itemBuilder: (BuildContext context, int index) {
shrinkWrap: true, return Padding(
itemCount: model padding: EdgeInsets.all(8.0),
.productLocationService child: Column(
.length, children: [
itemBuilder: Row(
(BuildContext context, mainAxisAlignment: MainAxisAlignment.start,
int index) { children: [
return Padding( Expanded(
padding: flex: 1,
EdgeInsets.all(8.0), child: Image.network(model
child: Column( .productLocationService[index].projectImageUrl),
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.start,
children: [
Row(
// crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment
.start,
children: [
Expanded(
flex: 1,
child: Image.network(model
.productLocationService[
index]
.projectImageUrl),
),
SizedBox(
width: 10,
),
Expanded(
flex: 4,
child: Text(
model
.productLocationService[
index]
.locationDescription +
"\n" +
convertCityName(
model
.productLocationService[
0]
.cityName
.toString(),
), ),
style: TextStyle( SizedBox(
fontSize: width: 10,
12), ),
), Expanded(
), flex: 4,
Expanded( child: Text(
flex: 1, model.productLocationService[index]
child: IconButton( .locationDescription +
icon: Icon(Icons "\n" +
.location_on), convertCityName(
color: model.productLocationService[0].cityName
Colors.red, .toString(),
onPressed: ),
() {}, style: TextStyle(fontSize: 12),
), ),
), ),
Expanded( Expanded(
flex: 1, flex: 1,
child: IconButton( child: IconButton(
icon: Icon(Icons icon: Icon(Icons.location_on),
.phone), color: Colors.red,
color: onPressed: () {},
Colors.red, ),
onPressed: ),
() {}, Expanded(
), flex: 1,
child: IconButton(
icon: Icon(Icons.phone),
color: Colors.red,
onPressed: () {},
),
),
],
),
Divider(height: 1.2, color: Colors.grey)
],
), ),
], );
), },
Divider( ),
height: 1.2,
color: Colors.grey)
],
),
);
},
), ),
); );
} }

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
@ -14,6 +15,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scafold_detail_page.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scafold_detail_page.dart';
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
@ -46,13 +48,16 @@ class ProductDetailPage extends StatefulWidget {
__ProductDetailPageState createState() => __ProductDetailPageState(); __ProductDetailPageState createState() => __ProductDetailPageState();
} }
class __ProductDetailPageState extends State<ProductDetailPage> { class __ProductDetailPageState extends State<ProductDetailPage>
with SingleTickerProviderStateMixin {
TabController _tabController;
AppSharedPreferences sharedPref = AppSharedPreferences(); AppSharedPreferences sharedPref = AppSharedPreferences();
bool isTrue = true; bool isTrue = true;
bool isDetails = true; bool isDetails = true;
bool isReviews = false; bool isReviews = false;
bool isAvailability = false; bool isAvailability = false;
int _activeTab = 0;
checkWishlist() async { checkWishlist() async {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
@ -74,10 +79,18 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
void initState() { void initState() {
price = 1; price = 1;
specificationData = widget.product; specificationData = widget.product;
_tabController = TabController(length: 3, vsync: this);
userInfo(); userInfo();
super.initState(); super.initState();
} }
@override
void dispose() {
_tabController.dispose();
super.dispose();
}
void userInfo() async { void userInfo() async {
print(specificationData); print(specificationData);
customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
@ -90,6 +103,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
final screenSize = MediaQuery.of(context).size;
return customerId != null return customerId != null
? DetailPageScafold( ? DetailPageScafold(
@ -153,15 +167,87 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
SizedBox( SizedBox(
height: 6, height: 6,
), ),
// Container(
// height: 500,
// color: Colors.white,
// child: Scaffold(
// backgroundColor: Colors.white,
// extendBodyBehindAppBar: false,
// appBar: PreferredSize(
// preferredSize: Size.fromHeight(
// MediaQuery.of(context).size.height * 0.070),
// child: Container(
// height: MediaQuery.of(context).size.height * 0.070,
// decoration: BoxDecoration(
// border: Border(
// bottom: BorderSide(
// color: Theme.of(context).dividerColor,
// width: 0.5), //width: 0.7
// ),
// color: Colors.white),
// child: Center(
// child: TabBar(
// isScrollable: false,
// controller: _tabController,
// // indicatorColor: Colors.transparent,
// indicatorWeight: 1.0,
// indicatorSize: TabBarIndicatorSize.tab,
// indicatorColor:Colors.green,
// labelColor: Theme.of(context).primaryColor,
// labelPadding: EdgeInsets.only(
// top: 0, left: 0, right: 0, bottom: 0),
// unselectedLabelColor: Colors.grey[800],
// tabs: [
// tabWidget(screenSize, _activeTab == 0,
// TranslationBase.of(context).details,
// ),
// tabWidget(screenSize, _activeTab == 1,
// TranslationBase.of(context).review,
// ),
// tabWidget(screenSize, _activeTab == 2,
// TranslationBase.of(context).availability),
// ],
// ),
// ),
// ),
// ),
// body: Column(
// children: [
// Expanded(
// child: TabBarView(
// physics: BouncingScrollPhysics(),
// controller: _tabController,
// children: [
// DetailsInfo(
// product: widget.product,
// ),
// ReviewsInfo(
// product: widget.product,
// ),
// AvailabilityInfo()
// ],
// ),
// ),
//
// ],
// ),
// ),
// ),
SizedBox(
height: 6,
),
//TODO Elham* Remove this
Container( Container(
width: 500, // width: 500,
margin: EdgeInsets.only(bottom: 6), margin: EdgeInsets.only(bottom: 6),
color: Colors.white, color: Colors.white,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
Column( Column(
children: [ children: [
@ -181,13 +267,9 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
), ),
color: Colors.white, color: Colors.white,
), ),
isDetails CustomDivider(
? Container( color: isDetails ? Colors.green : Colors.transparent,
width: 100, )
height: 5,
color: Colors.green,
)
: Container()
], ],
), ),
SizedBox( SizedBox(
@ -211,13 +293,9 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
), ),
color: Colors.white, color: Colors.white,
), ),
isReviews CustomDivider(
? Container( color: isReviews ? Colors.green : Colors.transparent,
width: 100, ),
height: 5,
color: Colors.green,
)
: Container(),
], ],
), ),
SizedBox( SizedBox(
@ -241,13 +319,9 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
), ),
color: Colors.white, color: Colors.white,
), ),
isAvailability CustomDivider(
? Container( color: isAvailability ? Colors.green : Colors.transparent,
width: 100, ),
height: 5,
color: Colors.green,
)
: Container(),
], ],
), ),
], ],
@ -795,6 +869,24 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
} }
} }
class CustomDivider extends StatelessWidget {
const CustomDivider({
Key key,
this.color,
}) : super(key: key);
final Color color;
@override
Widget build(BuildContext context) {
return Container(
width: 120,
height: 2,
color: color,
);
}
}
convertCityName(txt) { convertCityName(txt) {
String stringTxt; String stringTxt;
String newTxt; String newTxt;
@ -828,3 +920,27 @@ deleteFromWishlistFunction(itemID) async {
isInWishList = false; isInWishList = false;
await x.deletWishlistData(itemID); await x.deletWishlistData(itemID);
} }
//TODO Elham* move to file
Widget tabWidget(
Size screenSize,
bool isActive,
String title,
) {
return Center(
child: Container(
height: screenSize.height * 0.070,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AppText(
title,
fontSize: SizeConfig.textMultiplier * 1.5,
// color: Color(0xFF2B353E),
fontWeight: FontWeight.w700,
),
],
),
),
);
}

@ -2,6 +2,7 @@ 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/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';
@ -14,79 +15,82 @@ class ReviewsInfo extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<ProductDetailViewModel>( return BaseView<ProductDetailViewModel>(
onModelReady: (model) => model.getProductReviewsData(product.id), onModelReady: (model) => model.getProductReviewsData(product.id),
builder: (_, model, wi) => model.productDetailService.length != 0 && builder: (_, model, wi) => NetworkBaseView(
model.productDetailService[0].reviews.length != 0 baseViewModel:model ,
? ListView.builder( child: model.productDetailService.length != 0 &&
physics: ScrollPhysics(), model.productDetailService[0].reviews.length != 0
itemCount: model.productDetailService[0].reviews.length, ? ListView.builder(
scrollDirection: Axis.vertical, physics: ScrollPhysics(),
shrinkWrap: true, itemCount: model.productDetailService[0].reviews.length,
itemBuilder: (BuildContext context, int index) { scrollDirection: Axis.vertical,
return Padding( shrinkWrap: true,
padding: EdgeInsets.all(8.0), itemBuilder: (BuildContext context, int index) {
child: Column( return Padding(
mainAxisAlignment: MainAxisAlignment.start, padding: EdgeInsets.all(8.0),
crossAxisAlignment: CrossAxisAlignment.start, child: Column(
children: [ mainAxisAlignment: MainAxisAlignment.start,
Container( crossAxisAlignment: CrossAxisAlignment.start,
child: Row( children: [
children: [ Container(
Container( child: Row(
child: Text( children: [
model.productDetailService[0].reviews[index] Container(
.customerId child: Text(
.toString(), model.productDetailService[0].reviews[index]
style: TextStyle( .customerId
fontSize: 17, .toString(),
color: Colors.grey, style: TextStyle(
fontWeight: FontWeight.w600), fontSize: 17,
color: Colors.grey,
fontWeight: FontWeight.w600),
),
), ),
), Container(
Container( margin: EdgeInsets.only(left: 210),
margin: EdgeInsets.only(left: 210), child: RatingBar.readOnly(
child: RatingBar.readOnly( initialRating: model.productDetailService[0]
initialRating: model.productDetailService[0] .reviews[index].rating
.reviews[index].rating .toDouble(),
.toDouble(), size: 15.0,
size: 15.0, filledColor: Colors.yellow[700],
filledColor: Colors.yellow[700], emptyColor: Colors.grey[500],
emptyColor: Colors.grey[500], isHalfAllowed: true,
isHalfAllowed: true, halfFilledIcon: Icons.star_half,
halfFilledIcon: Icons.star_half, filledIcon: Icons.star,
filledIcon: Icons.star, emptyIcon: Icons.star,
emptyIcon: Icons.star, ),
), ),
), ],
], ),
), ),
), SizedBox(
SizedBox( height: 10,
height: 10,
),
Container(
child: Text(
model.productDetailService[0].reviews[index]
.reviewText,
style: TextStyle(fontSize: 20),
), ),
), Container(
SizedBox( child: Text(
height: 50, model.productDetailService[0].reviews[index]
), .reviewText,
Divider(height: 1, color: Colors.grey), style: TextStyle(fontSize: 20),
], ),
), ),
); SizedBox(
}, height: 50,
) ),
: Container( Divider(height: 1, color: Colors.grey),
padding: EdgeInsets.all(15), ],
alignment: Alignment.center, ),
child: Text( );
TranslationBase.of(context).noReviewsAvailable, },
), )
: Container(
padding: EdgeInsets.all(15),
alignment: Alignment.center,
child: Text(
TranslationBase.of(context).noReviewsAvailable,
),
// Text('No Reviews Available'), // Text('No Reviews Available'),
), ),
),
); );
} }
} }

Loading…
Cancel
Save