Merge branch 'fix_product_tile' into 'development'

Fix product tile

See merge request Cloud_Solution/diplomatic-quarter!421
merge-update-with-lab-changes
Mohammad Aljammal 5 years ago
commit f736ab5365

@ -1,7 +1,7 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class ShoppingCartResponse with ChangeNotifier { class ShoppingCartResponse {
int itemCount; int itemCount;
int quantityCount; int quantityCount;
double subtotal; double subtotal;
@ -11,17 +11,15 @@ class ShoppingCartResponse with ChangeNotifier {
List<ShoppingCart> shoppingCarts; List<ShoppingCart> shoppingCarts;
ShoppingCartResponse( ShoppingCartResponse(
{this.itemCount, {this.itemCount =0,
this.quantityCount, this.quantityCount =0,
this.subtotal, this.subtotal=0.0,
this.subtotalWithVat, this.subtotalWithVat = 0.0,
this.subtotalVatAmount, this.subtotalVatAmount = 0.0,
this.subtotalVatRate, this.subtotalVatRate = 0.0 ,
this.shoppingCarts}); this.shoppingCarts});
void updateShoppingCard() {
notifyListeners();
}
ShoppingCartResponse.fromJson(Map<String, dynamic> json) { ShoppingCartResponse.fromJson(Map<String, dynamic> json) {
itemCount = json['item_count']; itemCount = json['item_count'];

@ -114,7 +114,6 @@ class OrderPreviewViewModel extends BaseViewModel {
cartResponse.shoppingCarts.add(shoppingCart); cartResponse.shoppingCarts.add(shoppingCart);
totalAdditionalShippingCharge += shoppingCart.product.additionalShippingCharge; totalAdditionalShippingCharge += shoppingCart.product.additionalShippingCharge;
}); });
cartResponse.updateShoppingCard();
return cartResponse; return cartResponse;
} }

@ -12,20 +12,9 @@ class WishListViewModel extends BaseViewModel{
bool hasError = false; bool hasError = false;
// Future getWishlistData() async { Future getWishlistData({isLocalLoader = false}) async {
// setState(ViewState.Busy);
// await _wishlistService.getWishlist();
// if (_wishlistService.hasError) {
// error = _wishlistService.error;
// setState(ViewState.Error);
// } else {
// setState(ViewState.Idle);
// }
// }
Future getWishlistData() async {
hasError = false; hasError = false;
setState(ViewState.Busy); setState(isLocalLoader ? ViewState.BusyLocal:ViewState.Busy);
await _wishlistService.getWishlist(); await _wishlistService.getWishlist();
if (_wishlistService.hasError) { if (_wishlistService.hasError) {
error = _wishlistService.error; error = _wishlistService.error;

@ -294,7 +294,7 @@ void setupLocator() {
locator.registerFactory(() => ProductDetailViewModel()); locator.registerFactory(() => ProductDetailViewModel());
locator.registerFactory(() => WeatherViewModel()); locator.registerFactory(() => WeatherViewModel());
locator.registerFactory(() => OrderPreviewViewModel()); // locator.registerFactory(() => OrderPreviewViewModel());
locator.registerFactory(() => LacumViewModel()); locator.registerFactory(() => LacumViewModel());
locator.registerFactory(() => LacumTranferViewModel()); locator.registerFactory(() => LacumTranferViewModel());
locator.registerFactory(() => LacumRegistrationViewModel()); locator.registerFactory(() => LacumRegistrationViewModel());

@ -13,6 +13,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'config/size_config.dart'; import 'config/size_config.dart';
import 'core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'core/viewModels/project_view_model.dart'; import 'core/viewModels/project_view_model.dart';
import 'locator.dart'; import 'locator.dart';
import 'pages/pharmacies/compare-list.dart'; import 'pages/pharmacies/compare-list.dart';
@ -79,6 +80,8 @@ class _MyApp extends State<MyApp> {
), ),
ChangeNotifierProvider<CompareList>( ChangeNotifierProvider<CompareList>(
create: (context) => CompareList()), create: (context) => CompareList()),
ChangeNotifierProvider<OrderPreviewViewModel>(
create: (context) => OrderPreviewViewModel()),
], ],
child: Consumer<ProjectViewModel>( child: Consumer<ProjectViewModel>(
builder: (context, projectProvider, child) => MaterialApp( builder: (context, projectProvider, child) => MaterialApp(

@ -31,8 +31,6 @@ class OfferAndPackagesDetailState extends State<OfferAndPackagesDetail>{
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
getLanguageID();
return BaseView<PackagesViewModel>( return BaseView<PackagesViewModel>(
onModelReady: (model){ onModelReady: (model){
viewModel = model; viewModel = model;

@ -1,65 +1,39 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/wishlist_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/widgets/pharmacy/product_tile.dart'; import 'package:diplomaticquarterapp/widgets/pharmacy/product_tile.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.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/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/wishlist_view_model.dart'; import 'package:provider/provider.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
AppSharedPreferences sharedPref = AppSharedPreferences();
var languageID;
class ProductCheckTypeWidget extends StatefulWidget { class ProductCheckTypeWidget extends StatefulWidget {
final List<dynamic> wishlist; final WishListViewModel model;
final bool isTrue;
ProductCheckTypeWidget(this.isTrue, this.wishlist); ProductCheckTypeWidget({this.model});
@override @override
_ProductCheckTypeWidgetState createState() => _ProductCheckTypeWidgetState(); _ProductCheckTypeWidgetState createState() => _ProductCheckTypeWidgetState();
} }
class _ProductCheckTypeWidgetState extends State<ProductCheckTypeWidget> { class _ProductCheckTypeWidgetState extends State<ProductCheckTypeWidget> {
void initState() {
getLanguageID();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return widget.isTrue ProjectViewModel projectViewModel = Provider.of(context);
? ListView.builder( return ListView.builder(
itemCount: widget.wishlist.length, itemCount: widget.model.wishListList.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return Column( return Column(
children: [ children: [
Container( Container(
child: widget.isTrue child: productTile(
? productTile( productName: projectViewModel.isArabic
productName: languageID == 'ar' ? widget.model.wishListList[index].product.namen
? widget.wishlist[index].product.namen : widget.model.wishListList[index].product.name,
: widget.wishlist[index].product.name, productPrice: widget.model.wishListList[index].subtotal,
productPrice: widget.wishlist[index].subtotal, productRate: double.parse(widget.model.wishListList[index].subtotalVatRate),
productRate: double.parse( productImage: widget.model.wishListList[index].product.images[0].src,
widget.wishlist[index].subtotalVatRate), productID: widget.model.wishListList[index].product.id,
productImage:
widget.wishlist[index].product.images[0].src,
showLine: widget.isTrue,
productID: widget.wishlist[index].product.id,
onDelete: deleteWishListItem,
)
: productTile(
productName: languageID == 'ar'
? widget.wishlist[index].product.namen
: widget.wishlist[index].product.name,
productPrice: widget.wishlist[index].subtotal,
productRate: double.parse(
widget.wishlist[index].subtotalVatRate),
productImage:
widget.wishlist[index].product.images[0].src,
showLine: widget.isTrue,
onDelete: deleteWishListItem, onDelete: deleteWishListItem,
), ),
@ -67,47 +41,18 @@ class _ProductCheckTypeWidgetState extends State<ProductCheckTypeWidget> {
Divider(height: 1, color: Colors.grey) Divider(height: 1, color: Colors.grey)
], ],
); );
}) });
: GridView.count(
crossAxisCount: 2,
children: List.generate(
widget.wishlist.length,
(index) => productTile(
productName: widget.wishlist[index].product.name,
productPrice: widget.wishlist[index].subtotal,
productRate:
double.parse(widget.wishlist[index].subtotalVatRate),
productImage:
widget.wishlist[index].product.images[0].src,
showLine: widget.isTrue,
)),
);
} }
deleteWishListItem(itemID) async { deleteWishListItem(itemID) async {
ProductDetailViewModel x = new ProductDetailViewModel(); ProductDetailViewModel x = new ProductDetailViewModel();
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await x.deleteWishlistData(itemID); await x.deleteWishlistData(itemID);
setState(() await widget.model.getWishlistData(isLocalLoader: true);
async{
await
//getWishlistData();
Navigator.push(context,
FadePage(page: WishlistPage(false)),
);
});
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
print("Delete");
} }
getWishlistData() async {
WishListViewModel x = new WishListViewModel();
await x.getWishlistData();
}
} }
getLanguageID() async {
languageID = await sharedPref.getString(APP_LANGUAGE);
}

@ -12,32 +12,41 @@ import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/buttons/GestureIconButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/GestureIconButton.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/network_base_view.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:provider/provider.dart'; import 'package:provider/provider.dart';
class CartOrderPage extends StatelessWidget { class CartOrderPage extends StatefulWidget {
const CartOrderPage({Key key}) : super(key: key);
@override
_CartOrderPageState createState() => _CartOrderPageState();
}
class _CartOrderPageState extends State<CartOrderPage> {
@override
void initState() {
super.initState();
Provider.of<OrderPreviewViewModel>(context, listen: false).getShoppingCart();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final mediaQuery = MediaQuery.of(context); final mediaQuery = MediaQuery.of(context);
OrderPreviewViewModel model = Provider.of(context);
final height = mediaQuery.size.height - 60 - mediaQuery.padding.top; final height = mediaQuery.size.height - 60 - mediaQuery.padding.top;
AppScaffold appScaffold; AppScaffold appScaffold;
return BaseView<OrderPreviewViewModel>( return NetworkBaseView(
onModelReady: (model) { baseViewModel: model,
model.getShoppingCart().then((value) { child: AppScaffold(
appScaffold.appBar
.badgeUpdater('${model.cartResponse.quantityCount ?? 0}');
});
},
builder: (_, model, wi) => ChangeNotifierProvider.value(
value: model.cartResponse,
child: appScaffold = AppScaffold(
appBarTitle: TranslationBase.of(context).shoppingCart, appBarTitle: TranslationBase.of(context).shoppingCart,
isShowAppBar: true, isShowAppBar: true,
isPharmacy: true, isPharmacy: true,
showHomeAppBarIcon: false,
isShowDecPage: true, isShowDecPage: true,
description: "",
baseViewModel: model, baseViewModel: model,
backgroundColor: Colors.white, backgroundColor: Colors.white,
body: !(model.cartResponse.shoppingCarts == null || body: !(model.cartResponse.shoppingCarts == null ||
@ -45,8 +54,6 @@ class CartOrderPage extends StatelessWidget {
? Container( ? Container(
height: height * 0.85, height: height * 0.85,
width: double.infinity, width: double.infinity,
child: Consumer<ShoppingCartResponse>(
builder: (ctx, cart, _) => Container(
child: SingleChildScrollView( child: SingleChildScrollView(
child: Container( child: Container(
margin: EdgeInsets.all(10), margin: EdgeInsets.all(10),
@ -72,16 +79,16 @@ class CartOrderPage extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
...List.generate( ...List.generate(
cart.shoppingCarts != null model.cartResponse.shoppingCarts != null
? cart.shoppingCarts.length ? model.cartResponse.shoppingCarts.length
: 0, : 0,
(index) => ProductOrderItem( (index) => ProductOrderItem(
cart.shoppingCarts[index], () { model.cartResponse.shoppingCarts[index], () {
print(cart.shoppingCarts[index] print(model.cartResponse.shoppingCarts[index]
.quantity); .quantity);
model model
.changeProductQuantity( .changeProductQuantity(
cart.shoppingCarts[index]) model.cartResponse.shoppingCarts[index])
.then((value) { .then((value) {
if (model.state != if (model.state !=
ViewState.Error) { ViewState.Error) {
@ -97,7 +104,7 @@ class CartOrderPage extends StatelessWidget {
}, () { }, () {
model model
.deleteProduct( .deleteProduct(
cart.shoppingCarts[index]) model.cartResponse.shoppingCarts[index])
.then((value) { .then((value) {
if (model.state != if (model.state !=
ViewState.Error) { ViewState.Error) {
@ -127,7 +134,7 @@ class CartOrderPage extends StatelessWidget {
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
), ),
Texts( Texts(
"${TranslationBase.of(context).sar} ${(cart.subtotal).toStringAsFixed(2)}", "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
fontSize: 14, fontSize: 14,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
@ -152,7 +159,7 @@ class CartOrderPage extends StatelessWidget {
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
), ),
Texts( Texts(
"${TranslationBase.of(context).sar} ${(cart.subtotalVatAmount).toStringAsFixed(2)}", "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}",
fontSize: 14, fontSize: 14,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
@ -177,7 +184,7 @@ class CartOrderPage extends StatelessWidget {
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
Texts( Texts(
"${TranslationBase.of(context).sar} ${(cart.subtotal).toStringAsFixed(2)}", "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
fontSize: 14, fontSize: 14,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -196,10 +203,9 @@ class CartOrderPage extends StatelessWidget {
width: mediaQuery.size.width - 20, width: mediaQuery.size.width - 20,
height: 30.0, height: 30.0,
fit: BoxFit.scaleDown, fit: BoxFit.scaleDown,
)
],
),
), ),
SizedBox(height: 120,)
],
), ),
), ),
), ),
@ -237,7 +243,6 @@ class CartOrderPage extends StatelessWidget {
child: OrderBottomWidget(model.addresses, height), child: OrderBottomWidget(model.addresses, height),
), ),
), ),
),
); );
} }
} }
@ -258,12 +263,9 @@ class _OrderBottomWidgetState extends State<OrderBottomWidget> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectProvider = Provider.of(context); ProjectViewModel projectProvider = Provider.of(context);
OrderPreviewViewModel cart = Provider.of(context);
return Container( return !(cart.cartResponse.shoppingCarts == null ||
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 0), cart.cartResponse.shoppingCarts.length == 0)
child: Consumer<ShoppingCartResponse>(
builder: (ctx, cart, _) => !(cart.shoppingCarts == null ||
cart.shoppingCarts.length == 0)
? Column( ? Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -352,7 +354,7 @@ class _OrderBottomWidgetState extends State<OrderBottomWidget> {
child: Row( child: Row(
children: [ children: [
Texts( Texts(
"${TranslationBase.of(context).sar} ${(cart.subtotal).toStringAsFixed(2)}", "${TranslationBase.of(context).sar} ${(cart.cartResponse.subtotal).toStringAsFixed(2)}",
fontSize: fontSize:
projectProvider.isArabic ? 12 : 14, projectProvider.isArabic ? 12 : 14,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -371,7 +373,7 @@ class _OrderBottomWidgetState extends State<OrderBottomWidget> {
), ),
), ),
Texts( Texts(
"${cart.quantityCount} ${TranslationBase.of(context).items}", "${cart.cartResponse.quantityCount} ${TranslationBase.of(context).items}",
fontSize: 10, fontSize: 10,
color: Colors.grey, color: Colors.grey,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -405,7 +407,6 @@ class _OrderBottomWidgetState extends State<OrderBottomWidget> {
), ),
], ],
) )
: Container(), : Container();
));
} }
} }

@ -15,26 +15,34 @@ 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/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.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:provider/provider.dart'; import 'package:provider/provider.dart';
class OrderPreviewPage extends StatelessWidget { class OrderPreviewPage extends StatefulWidget {
final List<Addresses> addresses; final List<Addresses> addresses;
OrderPreviewPage(this.addresses); OrderPreviewPage(this.addresses);
@override
_OrderPreviewPageState createState() => _OrderPreviewPageState();
}
class _OrderPreviewPageState extends State<OrderPreviewPage> {
MyInAppBrowser browser; MyInAppBrowser browser;
@override
void initState() {
super.initState();
Provider.of<OrderPreviewViewModel>(context, listen: false).getShoppingCart();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final mediaQuery = MediaQuery.of(context); final mediaQuery = MediaQuery.of(context);
final height = mediaQuery.size.height - 60 - mediaQuery.padding.top; final height = mediaQuery.size.height - 60 - mediaQuery.padding.top;
OrderPreviewViewModel model = Provider.of(context);
return BaseView<OrderPreviewViewModel>( return NetworkBaseView(
onModelReady: (model) => model.getShoppingCart(),
builder: (_, model, wi) => ChangeNotifierProvider.value(
value: model.paymentCheckoutData,
child: AppScaffold( child: AppScaffold(
appBarTitle: "${TranslationBase.of(context).checkOut}", appBarTitle: "${TranslationBase.of(context).checkOut}",
isShowAppBar: true, isShowAppBar: true,
@ -49,7 +57,7 @@ class OrderPreviewPage extends StatelessWidget {
color: Color(0xFFF1F1F1), color: Color(0xFFF1F1F1),
child: Column( child: Column(
children: [ children: [
SelectAddressWidget(model, addresses), SelectAddressWidget(model,widget.addresses),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
@ -252,7 +260,8 @@ class OrderPreviewPage extends StatelessWidget {
child: PaymentBottomWidget(model), child: PaymentBottomWidget(model),
), ),
), ),
)); baseViewModel: model,
);
} }
} }

@ -1,5 +1,6 @@
import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/BestSellerViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/BestSellerViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/BrandViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/BrandViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/LastVisitedViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/LastVisitedViewModel.dart';
@ -35,6 +36,7 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart'; import 'package:rating_bar/rating_bar.dart';
import '../../../locator.dart';
import '../../final_products_page.dart'; import '../../final_products_page.dart';
class PharmacyPage extends StatefulWidget { class PharmacyPage extends StatefulWidget {
@ -50,10 +52,11 @@ class _PharmacyPageState extends State<PharmacyPage> {
onWillPop: ()async{ onWillPop: ()async{
return false; return false;
}, },
child: BaseView<PharmacyModuleViewModel>( child:BaseView<PharmacyModuleViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
await model.getSavedLanguage(); await model.getSavedLanguage();
await model.getBannerList(); await model.getBannerList();
await locator<OrderPreviewService>().getShoppingCart();
}, },
allowAny: true, allowAny: true,
builder: (_, model, wi) => AppScaffold( builder: (_, model, wi) => AppScaffold(
@ -74,8 +77,7 @@ class _PharmacyPageState extends State<PharmacyPage> {
ShopByBrandWidget(), ShopByBrandWidget(),
RecentlyViewedWidget(), RecentlyViewedWidget(),
BestSellerWidget(), BestSellerWidget(),
], ],),
),
), ),
), ),
), ),

@ -5,22 +5,16 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
class WishlistPage extends StatefulWidget { class WishlistPage extends StatelessWidget {
bool showBar; const WishlistPage({Key key}) : super(key: key);
WishlistPage(this.showBar);
@override
_WishlistPageState createState() => _WishlistPageState();
}
class _WishlistPageState extends State<WishlistPage> {
bool isTrue = true;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<WishListViewModel>( return BaseView<WishListViewModel>(
onModelReady: (model) => model.getWishlistData(), onModelReady: (model) => model.getWishlistData(),
builder: (_, model, wi) => AppScaffold( builder: (_, model, wi) => AppScaffold(
appBarTitle: TranslationBase.of(context).wishlist, appBarTitle: TranslationBase.of(context).wishlist,
isShowAppBar: widget.showBar, isShowAppBar: true,
isShowDecPage: false, isShowDecPage: false,
isPharmacy: true, isPharmacy: true,
baseViewModel: model, baseViewModel: model,
@ -57,10 +51,8 @@ class _WishlistPageState extends State<WishlistPage> {
flex: 20, flex: 20,
child: Container( child: Container(
width: double.infinity, width: double.infinity,
height: height: MediaQuery.of(context).size.height * 0.85, //250,
MediaQuery.of(context).size.height * 0.85, //250, child: ProductCheckTypeWidget(model: model,),
child:
ProductCheckTypeWidget(isTrue, model.wishListList),
), ),
), ),
], ],
@ -70,3 +62,4 @@ class _WishlistPageState extends State<WishlistPage> {
); );
} }
} }

@ -19,10 +19,7 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.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/pharmacy/my_account_items.dart';
import 'package:diplomaticquarterapp/widgets/pharmacy/my_account_services.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:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
@ -111,10 +108,7 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
Container( Container(
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Padding( Container(
padding: EdgeInsets.symmetric(
horizontal: 15.0, vertical: 8.0),
child: Container(
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: 20.0, top: 20.0,
left: 10.0, left: 10.0,
@ -122,42 +116,36 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
bottom: 10.0, bottom: 10.0,
), ),
child: LargeAvatar( child: LargeAvatar(
radius: 55.0,
name: user.firstName.toString(), name: user.firstName.toString(),
url: url: '',
'https://thumbs.dreamstime.com/b/default-avatar-profile-vector-user-profile-default-avatar-profile-vector-user-profile-profile-179376714.jpg',
),
), ),
), ),
Column( Column(children: <Widget>[
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Row(children: <Widget>[ Row(children: <Widget>[
Texts( Text(
TranslationBase.of(context) TranslationBase.of(context)
.welcome, .welcome,
fontSize: 16.0, style: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.bold,
color: Colors.grey),
), ),
]), ]),
SizedBox( SizedBox(
height: 5.0, height: 10,
), ),
Row(children: <Widget>[ Row(children: <Widget>[
Texts( Text(
languageID == "ar" languageID == "ar"
? user.firstNameN ? user.firstNameN.toString() +
.toString() +
" " + " " +
user.lastNameN user.lastNameN.toString()
.toString() : user.firstName.toString() +
: user.firstName
.toString() +
" " + " " +
user.lastName user.lastName.toString(),
.toString(), style: TextStyle(
fontSize: 17.0, fontSize: 14.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold),
), ),
]), ]),
]), ]),
@ -180,10 +168,8 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
Container( Container(
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
AccountServices( Expanded(
title: TranslationBase.of(context).orders, child: InkWell(
serviceImage:
'assets/images/pharmacy/orders_icon.svg',
onTap: () { onTap: () {
if (customerId == null) { if (customerId == null) {
AppToast.showErrorToast( AppToast.showErrorToast(
@ -196,37 +182,109 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
page: OrderPage( page: OrderPage(
customerID: customerId))); customerID: customerId)));
}, },
child: Column(
children: <Widget>[
// Image(image: AssetImage('assets/images/pharmacy/orders_icon.svg')),
SvgPicture.asset(
'assets/images/pharmacy/orders_icon.svg',
width: 50,
height: 50,
), ),
AccountServices( SizedBox(
title: TranslationBase.of(context).lakum, height: 5,
serviceImage: ),
'assets/images/pharmacy/lakum_icon.svg', Text(
TranslationBase.of(context).orders,
style: TextStyle(
fontSize: 13.0,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
Expanded(
child: InkWell(
onTap: () { onTap: () {
Navigator.push(context, Navigator.push(context,
FadePage(page: LakumMainPage())); FadePage(page: LakumMainPage()));
}, },
child: Column(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/lakum_icon.svg',
width: 50,
height: 50,
), ),
AccountServices( SizedBox(
title: TranslationBase.of(context).wishlist, height: 5,
serviceImage: ),
'assets/images/pharmacy/wishlist_icon.svg', Text(
TranslationBase.of(context).lakum,
style: TextStyle(
fontSize: 13.0,
fontWeight: FontWeight.bold),
),
],
),
),
),
Expanded(
child: InkWell(
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( FadePage(page: WishlistPage()));
builder: (context) =>
WishlistPage(true)));
}, },
child: Column(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/wishlist_icon.svg',
width: 50,
height: 50,
), ),
AccountServices( SizedBox(
title: TranslationBase.of(context).reviews, height: 5,
serviceImage: ),
'assets/images/pharmacy/review_icon.svg', Text(
TranslationBase.of(context).wishlist,
style: TextStyle(
fontSize: 13.0,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
Expanded(
child: InkWell(
onTap: () { onTap: () {
Navigator.push(context, Navigator.push(context,
FadePage(page: MyReviewsPage())); FadePage(page: MyReviewsPage()));
}, },
) child: Column(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/review_icon.svg',
width: 50,
height: 50,
),
SizedBox(
height: 5,
),
Text(
TranslationBase.of(context).reviews,
style: TextStyle(
fontSize: 13.0,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
], ],
)), )),
SizedBox( SizedBox(
@ -243,13 +301,16 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
height: 10, height: 10,
), ),
Container( Container(
padding: EdgeInsets.symmetric(horizontal: 25.0), padding: EdgeInsets.only(left: 10.0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Texts(TranslationBase.of(context).myAccount, Text(
TranslationBase.of(context).myAccount,
style: TextStyle(
fontSize: 16.0, fontSize: 16.0,
fontWeight: FontWeight.bold), fontWeight: FontWeight.bold),
),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
@ -264,11 +325,24 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
FadePage( FadePage(
page: HomePrescriptionsPage())); page: HomePrescriptionsPage()));
}, },
child: AccountItem( child: Row(
title: TranslationBase.of(context) children: <Widget>[
.myPrescription, SvgPicture.asset(
itemIcon:
'assets/images/pharmacy/my_prescription_icon.svg', 'assets/images/pharmacy/my_prescription_icon.svg',
width: 28,
height: 28,
),
SizedBox(
width: 15,
),
Text(
TranslationBase.of(context)
.myPrescription,
style: TextStyle(
fontSize: 13.0,
),
),
],
), ),
), ),
SizedBox( SizedBox(
@ -283,12 +357,24 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
Navigator.push(context, Navigator.push(context,
FadePage(page: ComparePage())); FadePage(page: ComparePage()));
}, },
child: AccountItem( child: Row(
isTerms: true, children: <Widget>[
title: TranslationBase.of(context) Image.asset(
.compare, 'assets/images/pharmacy/compare.png',
itemIcon: width: 35,
"assets/images/pharmacy/compare.png")), height: 35),
SizedBox(
width: 15,
),
Text(
TranslationBase.of(context).compare,
style: TextStyle(
fontSize: 13.0,
),
),
],
),
),
SizedBox( SizedBox(
height: 5, height: 5,
), ),
@ -303,11 +389,25 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
FadePage( FadePage(
page: HomePrescriptionsPage())); page: HomePrescriptionsPage()));
}, },
child: AccountItem( child: Row(
title: TranslationBase.of(context) children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/medication_refill_icon.svg',
width: 30,
height: 30,
),
SizedBox(
width: 20,
),
Text(
TranslationBase.of(context)
.medicationsRefill, .medicationsRefill,
itemIcon: style: TextStyle(
'assets/images/pharmacy/medication_refill_icon.svg'), fontSize: 13.0,
),
),
],
),
), ),
SizedBox( SizedBox(
height: 5, height: 5,
@ -321,10 +421,23 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
Navigator.push( Navigator.push(
context, FadePage(page: MyFamily())); context, FadePage(page: MyFamily()));
}, },
child: AccountItem( child: Row(
title: TranslationBase.of(context).family, children: <Widget>[
itemIcon: SvgPicture.asset(
'assets/images/pharmacy/my_family_icon.svg', 'assets/images/pharmacy/my_family_icon.svg',
width: 20,
height: 20,
),
SizedBox(
width: 20,
),
Text(
TranslationBase.of(context).family,
style: TextStyle(
fontSize: 13.0,
),
),
],
), ),
), ),
SizedBox( SizedBox(
@ -341,11 +454,24 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
FadePage( FadePage(
page: PharmacyAddressesPage())); page: PharmacyAddressesPage()));
}, },
child: AccountItem( child: Row(
itemIcon: children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/shipping_addresses_icon.svg', 'assets/images/pharmacy/shipping_addresses_icon.svg',
title: TranslationBase.of(context) width: 30,
height: 30,
),
SizedBox(
width: 20,
),
Text(
TranslationBase.of(context)
.shippingAddresses, .shippingAddresses,
style: TextStyle(
fontSize: 13.0,
),
),
],
), ),
), ),
SizedBox( SizedBox(
@ -360,15 +486,28 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: page: PharmacyTermsConditions()));
PharmacyTermsConditions()));
}, },
child: AccountItem( child: Row(
isTerms: true, children: <Widget>[
title: TranslationBase.of(context) Image.asset(
'assets/images/pharmacy/terms.png',
width: 25,
height: 25,
),
SizedBox(
width: 10,
),
Text(
TranslationBase.of(context)
.conditionsHMG, .conditionsHMG,
itemIcon: style: TextStyle(
'assets/images/pharmacy/terms.png')), fontSize: 13.0,
),
),
],
),
),
SizedBox( SizedBox(
height: 5, height: 5,
), ),
@ -388,13 +527,28 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
this.mobileNo, this.mobileNo,
this.languageId))); this.languageId)));
}, },
child: AccountItem( child: Row(
title: TranslationBase.of(context) children: <Widget>[
.conditions, Image.asset(
itemIcon:
'assets/images/pharmacy/terms.png', 'assets/images/pharmacy/terms.png',
isTerms: true, width: 25,
)), height: 25,
),
// IconButton(icon: Icon(Icons.error_outline), iconSize: 30,
// color: Colors.black,),
SizedBox(
width: 10,
),
Text(
TranslationBase.of(context)
.conditions,
style: TextStyle(
fontSize: 13.0,
),
),
],
),
),
], ],
), ),
), ),
@ -411,17 +565,17 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Padding( Container(
padding: const EdgeInsets.symmetric(
horizontal: 15.0, vertical: 8.0),
child: Container(
padding: EdgeInsets.only(left: 10.0), padding: EdgeInsets.only(left: 10.0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Texts(TranslationBase.of(context).reachUs, Text(
TranslationBase.of(context).reachUs,
style: TextStyle(
fontSize: 16.0, fontSize: 16.0,
fontWeight: FontWeight.bold), fontWeight: FontWeight.bold),
),
SizedBox( SizedBox(
height: 5, height: 5,
), ),
@ -434,11 +588,22 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
Navigator.push(context, Navigator.push(context,
FadePage(page: LiveChatPage())); FadePage(page: LiveChatPage()));
}, },
child: AccountItem( child: Row(
title: TranslationBase.of(context) children: <Widget>[
.contactUs, SvgPicture.asset(
itemIcon: 'assets/images/pharmacy/contact_us_icon.svg',
'assets/images/pharmacy/contact_us_icon.svg'), width: 20,
height: 20,
),
SizedBox(
width: 20,
),
Text(
TranslationBase.of(context).contactUs,
style: TextStyle(fontSize: 13.0),
),
],
),
), ),
SizedBox( SizedBox(
height: 5, height: 5,
@ -452,13 +617,25 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
Navigator.push(context, Navigator.push(context,
FadePage(page: FindUsPage())); FadePage(page: FindUsPage()));
}, },
child: AccountItem( child: Row(
title: TranslationBase.of(context) children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/our_locations_icon.svg',
width: 30,
height: 30,
),
SizedBox(
width: 20,
),
Text(
TranslationBase.of(context)
.ourLocations, .ourLocations,
itemIcon: style: TextStyle(fontSize: 13.0),
'assets/images/pharmacy/our_locations_icon.svg')) ),
], ],
), ),
)
],
), ),
) )
], ],

@ -25,10 +25,17 @@ class _GestureIconButtonState extends State<GestureIconButton> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GestureDetector( return GestureDetector(
onLongPressStart: (_) => onTap: (){
setState(() => _buttonLongPress = !_buttonLongPress), setState(() {
onLongPressEnd: (_) => _buttonLongPress = !_buttonLongPress;
setState(() => _buttonLongPress = !_buttonLongPress), });
widget.onTap();
},
// onLongPressStart: (_) =>
// setState(() => _buttonLongPress = !_buttonLongPress),
// onLongPressEnd: (_) =>
// setState(() => _buttonLongPress = !_buttonLongPress),
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
@ -52,6 +59,8 @@ class _GestureIconButtonState extends State<GestureIconButton> {
), ),
Texts( Texts(
widget.label, widget.label,
fontWeight: FontWeight.bold,
fontSize: 13.6,
color: _buttonLongPress ? Colors.white : Colors.black, color: _buttonLongPress ? Colors.white : Colors.black,
), ),
], ],

@ -1,4 +1,7 @@
import 'package:diplomaticquarterapp/Constants.dart'; import 'package:diplomaticquarterapp/Constants.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/login/welcome.dart'; import 'package:diplomaticquarterapp/pages/login/welcome.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
@ -6,6 +9,8 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../../locator.dart';
class BottomNavPharmacyItem extends StatelessWidget { class BottomNavPharmacyItem extends StatelessWidget {
final String title; final String title;
final IconData icon; final IconData icon;
@ -32,7 +37,10 @@ class BottomNavPharmacyItem extends StatelessWidget {
return Expanded( return Expanded(
child: SizedBox( child: SizedBox(
// height: 72.0, // height: 72.0,
child: Material( child: Stack(
clipBehavior: Clip.none,
children: [
Material(
type: MaterialType.transparency, type: MaterialType.transparency,
child: InkWell( child: InkWell(
highlightColor: Colors.transparent, highlightColor: Colors.transparent,
@ -89,6 +97,22 @@ class BottomNavPharmacyItem extends StatelessWidget {
), ),
), ),
), ),
if(currentIndex == 3 &&Provider.of<OrderPreviewViewModel>(context, listen: false).cartResponse.quantityCount !=0)
Positioned(
top: 5, right: -3.5,
child: Container(
decoration: BoxDecoration(
color: Colors.red,
borderRadius: BorderRadius.circular(15),
),
padding: EdgeInsets.only(left: 5, right: 4.5),
height: 18,
child: Center(child: Texts(Provider.of<OrderPreviewViewModel>(context, listen: false).cartResponse.quantityCount.toString(), style: "caption", medium: true, color: Colors.white,)),
),
)
],
),
), ),
); );
} }

Loading…
Cancel
Save