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,113 +1,58 @@
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: onDelete: deleteWishListItem,
widget.wishlist[index].product.images[0].src,
showLine: widget.isTrue, ),
productID: widget.wishlist[index].product.id, ),
onDelete: deleteWishListItem, Divider(height: 1, color: Colors.grey)
],
)
: 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,
),
),
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,231 +12,236 @@ 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 appBarTitle: TranslationBase.of(context).shoppingCart,
.badgeUpdater('${model.cartResponse.quantityCount ?? 0}'); isShowAppBar: true,
}); isPharmacy: true,
}, showHomeAppBarIcon: false,
builder: (_, model, wi) => ChangeNotifierProvider.value( isShowDecPage: true,
value: model.cartResponse, baseViewModel: model,
child: appScaffold = AppScaffold( backgroundColor: Colors.white,
appBarTitle: TranslationBase.of(context).shoppingCart, body: !(model.cartResponse.shoppingCarts == null ||
isShowAppBar: true, model.cartResponse.shoppingCarts.length == 0)
isPharmacy: true, ? Container(
isShowDecPage: true, height: height * 0.85,
description: "", width: double.infinity,
baseViewModel: model, child: SingleChildScrollView(
backgroundColor: Colors.white, child: Container(
body: !(model.cartResponse.shoppingCarts == null || margin: EdgeInsets.all(10),
model.cartResponse.shoppingCarts.length == 0) child: Column(
? Container( crossAxisAlignment: CrossAxisAlignment.start,
height: height * 0.85, children: [
width: double.infinity, GestureIconButton(
child: Consumer<ShoppingCartResponse>( TranslationBase.of(context).deleteAllItems,
builder: (ctx, cart, _) => Container( Icon(
child: SingleChildScrollView( Icons.delete_outline_sharp,
child: Container( color: Colors.grey.shade700,
margin: EdgeInsets.all(10), ),
child: Column( onTap: () => {model.deleteShoppingCart()},
crossAxisAlignment: CrossAxisAlignment.start, ),
children: [ const Divider(
GestureIconButton( color: Color(0xFFD6D6D6),
TranslationBase.of(context).deleteAllItems, height: 20,
Icon( thickness: 1,
Icons.delete_outline_sharp, indent: 0,
color: Colors.grey.shade700, endIndent: 0,
), ),
onTap: () => {model.deleteShoppingCart()}, Container(
), child: Column(
const Divider( children: [
color: Color(0xFFD6D6D6), ...List.generate(
height: 20, model.cartResponse.shoppingCarts != null
thickness: 1, ? model.cartResponse.shoppingCarts.length
indent: 0, : 0,
endIndent: 0, (index) => ProductOrderItem(
), model.cartResponse.shoppingCarts[index], () {
Container( print(model.cartResponse.shoppingCarts[index]
child: Column( .quantity);
children: [ model
...List.generate( .changeProductQuantity(
cart.shoppingCarts != null model.cartResponse.shoppingCarts[index])
? cart.shoppingCarts.length .then((value) {
: 0, if (model.state !=
(index) => ProductOrderItem( ViewState.Error) {
cart.shoppingCarts[index], () { appScaffold.appBar.badgeUpdater(
print(cart.shoppingCarts[index] '${value.quantityCount ?? 0}');
.quantity); }
model if (model.state ==
.changeProductQuantity( ViewState.ErrorLocal) {
cart.shoppingCarts[index]) Utils.showErrorToast(
.then((value) { model.error);
if (model.state != }
ViewState.Error) { });
appScaffold.appBar.badgeUpdater( }, () {
'${value.quantityCount ?? 0}'); model
} .deleteProduct(
if (model.state == model.cartResponse.shoppingCarts[index])
ViewState.ErrorLocal) { .then((value) {
Utils.showErrorToast( if (model.state !=
model.error); ViewState.Error) {
} appScaffold.appBar.badgeUpdater(
}); '${value.quantityCount ?? 0}');
}, () { }
model });
.deleteProduct( }))
cart.shoppingCarts[index]) ],
.then((value) {
if (model.state !=
ViewState.Error) {
appScaffold.appBar.badgeUpdater(
'${value.quantityCount ?? 0}');
}
});
}))
],
),
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 2,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context).subtotal,
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase.of(context).sar} ${(cart.subtotal).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Texts(
"${TranslationBase.of(context).vat}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase.of(context).sar} ${(cart.subtotalVatAmount).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context).total,
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.bold,
),
Texts(
"${TranslationBase.of(context).sar} ${(cart.subtotal).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.bold,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Image.asset(
"assets/images/pharmacy_module/payment_image.png",
width: mediaQuery.size.width - 20,
height: 30.0,
fit: BoxFit.scaleDown,
)
],
),
),
),
), ),
), ),
) const Divider(
: Center( color: Color(0xFFD6D6D6),
child: Column( height: 20,
mainAxisAlignment: MainAxisAlignment.center, thickness: 2,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [ children: [
Padding( Texts(
padding: const EdgeInsets.all(8.0), TranslationBase.of(context).subtotal,
child: Image.asset( fontSize: 14,
'assets/images/new-design/empty_box.png', color: Colors.black,
width: 100, fontWeight: FontWeight.w500,
height: 100, ),
fit: BoxFit.cover, Texts(
), "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Texts(
"${TranslationBase.of(context).vat}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context).total,
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.bold,
),
Texts(
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.bold,
), ),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
TranslationBase.of(context).noData,
// 'There is no data',
style: TextStyle(fontSize: 30),
),
)
], ],
), ),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Image.asset(
"assets/images/pharmacy_module/payment_image.png",
width: mediaQuery.size.width - 20,
height: 30.0,
fit: BoxFit.scaleDown,
),
SizedBox(height: 120,)
],
),
),
),
)
: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Image.asset(
'assets/images/new-design/empty_box.png',
width: 100,
height: 100,
fit: BoxFit.cover,
), ),
bottomSheet: Container( ),
height: !(model.cartResponse.shoppingCarts == null || Padding(
model.cartResponse.shoppingCarts.length == 0) padding: const EdgeInsets.all(8.0),
? height * 0.15 child: Text(
: 0, TranslationBase.of(context).noData,
color: Colors.white, // 'There is no data',
child: OrderBottomWidget(model.addresses, height), style: TextStyle(fontSize: 30),
),
)
],
), ),
), ),
bottomSheet: Container(
height: !(model.cartResponse.shoppingCarts == null ||
model.cartResponse.shoppingCarts.length == 0)
? height * 0.15
: 0,
color: Colors.white,
child: OrderBottomWidget(model.addresses, height),
),
), ),
); );
} }
@ -258,154 +263,150 @@ 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>( ? Column(
builder: (ctx, cart, _) => !(cart.shoppingCarts == null || crossAxisAlignment: CrossAxisAlignment.start,
cart.shoppingCarts.length == 0) children: [
? Column( const Divider(
color: Color(0xFFD6D6D6),
height: 1,
thickness: 1,
indent: 0,
endIndent: 0,
),
Container(
height: widget.height * 0.070,
color: Color(0xffe6ffe0),
padding: EdgeInsets.symmetric(horizontal: 4),
child: Row(
children: [
InkWell(
onTap: () {
setState(() {
isAgree = !isAgree;
});
},
child: Container(
width: 25.0,
height: widget.height * 0.070,
decoration: new BoxDecoration(
color:
!isAgree ? Color(0xffeeeeee) : Colors.green,
shape: BoxShape.circle,
),
child: !isAgree
? null
: Padding(
padding: const EdgeInsets.all(0.0),
child: Icon(
Icons.check,
color: Colors.white,
size: 25,
),
),
),
),
Expanded(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 4),
margin: const EdgeInsets.symmetric(vertical: 4),
child: Texts(
TranslationBase.of(context)
.pharmacyServiceTermsCondition,
fontSize: 13,
color: Colors.grey.shade800,
fontWeight: FontWeight.normal,
),
),
),
InkWell(
onTap: () => {
Navigator.push(context,
FadePage(page: PharmacyTermsConditions()))
},
child: Container(
child: Icon(
Icons.info,
size: 25,
color: Color(0xff005aff),
),
),
),
],
),
),
Container(
height: widget.height * 0.065,
margin: EdgeInsets.symmetric(vertical: 2),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
const Divider(
color: Color(0xFFD6D6D6),
height: 1,
thickness: 1,
indent: 0,
endIndent: 0,
),
Container( Container(
height: widget.height * 0.070, margin: EdgeInsets.symmetric(
color: Color(0xffe6ffe0), horizontal: 0, vertical: 0),
padding: EdgeInsets.symmetric(horizontal: 4),
child: Row( child: Row(
children: [ children: [
InkWell( Texts(
onTap: () { "${TranslationBase.of(context).sar} ${(cart.cartResponse.subtotal).toStringAsFixed(2)}",
setState(() { fontSize:
isAgree = !isAgree; projectProvider.isArabic ? 12 : 14,
}); fontWeight: FontWeight.bold,
},
child: Container(
width: 25.0,
height: widget.height * 0.070,
decoration: new BoxDecoration(
color:
!isAgree ? Color(0xffeeeeee) : Colors.green,
shape: BoxShape.circle,
),
child: !isAgree
? null
: Padding(
padding: const EdgeInsets.all(0.0),
child: Icon(
Icons.check,
color: Colors.white,
size: 25,
),
),
),
),
Expanded(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 4),
margin: const EdgeInsets.symmetric(vertical: 4),
child: Texts(
TranslationBase.of(context)
.pharmacyServiceTermsCondition,
fontSize: 13,
color: Colors.grey.shade800,
fontWeight: FontWeight.normal,
),
),
), ),
InkWell( Padding(
onTap: () => { padding: const EdgeInsets.symmetric(
Navigator.push(context, horizontal: 4),
FadePage(page: PharmacyTermsConditions())) child: Texts(
}, "${TranslationBase.of(context).inclusiveVat}",
child: Container( fontSize: 8,
child: Icon( color: Colors.grey,
Icons.info, fontWeight: FontWeight.bold,
size: 25,
color: Color(0xff005aff),
),
), ),
), ),
], ],
), ),
), ),
Container( Texts(
height: widget.height * 0.065, "${cart.cartResponse.quantityCount} ${TranslationBase.of(context).items}",
margin: EdgeInsets.symmetric(vertical: 2), fontSize: 10,
child: Row( color: Colors.grey,
mainAxisAlignment: MainAxisAlignment.spaceBetween, fontWeight: FontWeight.bold,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
margin: EdgeInsets.symmetric(
horizontal: 0, vertical: 0),
child: Row(
children: [
Texts(
"${TranslationBase.of(context).sar} ${(cart.subtotal).toStringAsFixed(2)}",
fontSize:
projectProvider.isArabic ? 12 : 14,
fontWeight: FontWeight.bold,
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 4),
child: Texts(
"${TranslationBase.of(context).inclusiveVat}",
fontSize: 8,
color: Colors.grey,
fontWeight: FontWeight.bold,
),
),
],
),
),
Texts(
"${cart.quantityCount} ${TranslationBase.of(context).items}",
fontSize: 10,
color: Colors.grey,
fontWeight: FontWeight.bold,
),
],
),
),
RaisedButton(
onPressed: isAgree
? () => {
Navigator.push(
context,
FadePage(
page: OrderPreviewPage(
widget.addresses)))
}
: null,
child: new Text(
"${TranslationBase.of(context).checkOut}",
style: new TextStyle(
color: isAgree
? Colors.white
: Colors.grey.shade300,
fontSize: 14),
),
color: Color(0xff005aff),
disabledColor: Color(0xff005aff),
),
],
),
), ),
], ],
) ),
: Container(), ),
)); RaisedButton(
onPressed: isAgree
? () => {
Navigator.push(
context,
FadePage(
page: OrderPreviewPage(
widget.addresses)))
}
: null,
child: new Text(
"${TranslationBase.of(context).checkOut}",
style: new TextStyle(
color: isAgree
? Colors.white
: Colors.grey.shade300,
fontSize: 14),
),
color: Color(0xff005aff),
disabledColor: Color(0xff005aff),
),
],
),
),
],
)
: Container();
} }
} }

@ -15,244 +15,253 @@ 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(), child: AppScaffold(
builder: (_, model, wi) => ChangeNotifierProvider.value( appBarTitle: "${TranslationBase.of(context).checkOut}",
value: model.paymentCheckoutData, isShowAppBar: true,
child: AppScaffold( isPharmacy: true,
appBarTitle: "${TranslationBase.of(context).checkOut}", isShowDecPage: false,
isShowAppBar: true, backgroundColor: Colors.white,
isPharmacy: true, baseViewModel: model,
isShowDecPage: false, body: Container(
backgroundColor: Colors.white, height: height * 0.90,
baseViewModel: model, child: SingleChildScrollView(
body: Container( child: Container(
height: height * 0.90, color: Color(0xFFF1F1F1),
child: SingleChildScrollView( child: Column(
child: Container( children: [
color: Color(0xFFF1F1F1), SelectAddressWidget(model,widget.addresses),
child: Column( SizedBox(
children: [ height: 10,
SelectAddressWidget(model, addresses), ),
SizedBox( SelectPaymentOptionWidget(model),
height: 10, SizedBox(
), height: 10,
SelectPaymentOptionWidget(model), ),
SizedBox( Consumer<PaymentCheckoutData>(
height: 10, builder: (ctx, paymentData, _) =>
), paymentData.lacumInformation != null
Consumer<PaymentCheckoutData>( ? Container(
builder: (ctx, paymentData, _) => child: Column(
paymentData.lacumInformation != null children: [
? Container( LakumWidget(model),
child: Column( SizedBox(
children: [ height: 10,
LakumWidget(model),
SizedBox(
height: 10,
),
],
),
)
: Container()),
Container(
color: Colors.white,
width: double.infinity,
padding: EdgeInsets.all(8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
TranslationBase
.of(context)
.reviewOrder,
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,
),
...List.generate(
model.cartResponse.shoppingCarts != null
? model.cartResponse.shoppingCarts.length
: 0,
(index) =>
ProductOrderPreviewItem(
model.cartResponse
.shoppingCarts[index]),
),
],
), ),
), ],
Container( ),
width: double.infinity, )
padding: EdgeInsets.all(8), : Container()),
child: model.cartResponse.subtotal != null Container(
? Column( color: Colors.white,
crossAxisAlignment: width: double.infinity,
CrossAxisAlignment.start, padding: EdgeInsets.all(8),
children: [ child: Column(
Texts( crossAxisAlignment: CrossAxisAlignment.start,
TranslationBase children: [
.of(context) Texts(
.orderSummary, TranslationBase
fontSize: 14, .of(context)
fontWeight: FontWeight.bold, .reviewOrder,
color: Colors.black, fontSize: 14,
), fontWeight: FontWeight.bold,
SizedBox( color: Colors.black,
height: 20, ),
), ...List.generate(
Row( model.cartResponse.shoppingCarts != null
mainAxisAlignment: ? model.cartResponse.shoppingCarts.length
MainAxisAlignment.spaceBetween, : 0,
children: [ (index) =>
Texts( ProductOrderPreviewItem(
"${TranslationBase model.cartResponse
.of(context) .shoppingCarts[index]),
.subtotal}", ),
fontSize: 14, ],
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase
.of(context)
.sar} ${(model.cartResponse.subtotal)
.toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Texts(
"${TranslationBase
.of(context)
.shipping}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase
.of(context)
.sar} ${(model
.totalAdditionalShippingCharge)
.toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Texts(
"${TranslationBase
.of(context)
.vat}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase
.of(context)
.sar} ${(model.cartResponse
.subtotalVatAmount).toStringAsFixed(
2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase
.of(context)
.total,
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.bold,
),
Texts(
"${TranslationBase
.of(context)
.sar} ${(model.cartResponse.subtotal)
.toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.bold,
),
],
),
SizedBox(
height: 10,
),
],
)
: Container(),
)
],
),
), ),
), ),
), Container(
bottomSheet: Container( width: double.infinity,
height: model.cartResponse.shoppingCarts != null padding: EdgeInsets.all(8),
? height * 0.10 child: model.cartResponse.subtotal != null
: 0, ? Column(
color: Colors.white, crossAxisAlignment:
child: PaymentBottomWidget(model), CrossAxisAlignment.start,
), children: [
Texts(
TranslationBase
.of(context)
.orderSummary,
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,
),
SizedBox(
height: 20,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Texts(
"${TranslationBase
.of(context)
.subtotal}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase
.of(context)
.sar} ${(model.cartResponse.subtotal)
.toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Texts(
"${TranslationBase
.of(context)
.shipping}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase
.of(context)
.sar} ${(model
.totalAdditionalShippingCharge)
.toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Texts(
"${TranslationBase
.of(context)
.vat}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase
.of(context)
.sar} ${(model.cartResponse
.subtotalVatAmount).toStringAsFixed(
2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase
.of(context)
.total,
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.bold,
),
Texts(
"${TranslationBase
.of(context)
.sar} ${(model.cartResponse.subtotal)
.toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.bold,
),
],
),
SizedBox(
height: 10,
),
],
)
: Container(),
)
],
), ),
)); ),
),
),
bottomSheet: Container(
height: model.cartResponse.shoppingCarts != null
? height * 0.10
: 0,
color: Colors.white,
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,32 +52,32 @@ 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, },
builder: (_, model, wi) => AppScaffold( allowAny: true,
title: "", builder: (_, model, wi) => AppScaffold(
isShowAppBar: false, title: "",
isShowDecPage: false, isShowAppBar: false,
baseViewModel: model, isShowDecPage: false,
backgroundColor: Colors.white, baseViewModel: model,
body: Container( backgroundColor: Colors.white,
width: double.infinity, body: Container(
child: SingleChildScrollView( width: double.infinity,
child: Column( child: SingleChildScrollView(
//crossAxisAlignment: CrossAxisAlignment.start, child: Column(
children: <Widget>[ //crossAxisAlignment: CrossAxisAlignment.start,
BannerPager(model), children: <Widget>[
GridViewButtons(model), BannerPager(model),
PrescriptionsWidget(), GridViewButtons(model),
ShopByBrandWidget(), PrescriptionsWidget(),
RecentlyViewedWidget(), ShopByBrandWidget(),
BestSellerWidget(), RecentlyViewedWidget(),
], BestSellerWidget(),
), ],),
), ),
), ),
), ),

@ -5,68 +5,61 @@ 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,
body: model.wishListList.length == 0 body: model.wishListList.length == 0
? Container( ? Container(
child: Center( child: Center(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Image.asset( child: Image.asset(
'assets/images/new-design/empty_box.png', 'assets/images/new-design/empty_box.png',
width: 100, width: 100,
height: 100, height: 100,
fit: BoxFit.cover, fit: BoxFit.cover,
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'There is no data',
style: TextStyle(fontSize: 30),
),
)
],
), ),
), ),
) Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'There is no data',
style: TextStyle(fontSize: 30),
),
)
],
),
),
)
: Container( : Container(
child: Column( child: Column(
children: [ children: [
Expanded( Expanded(
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),
),
),
],
), ),
), ),
],
),
),
), ),
); );
} }
} }

@ -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';
@ -101,7 +98,7 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
isPharmacy: true, isPharmacy: true,
body: user != null body: user != null
? Container( ? Container(
color: Colors.white, color: Colors.white,
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
@ -111,56 +108,47 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
Container( Container(
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Padding( Container(
padding: EdgeInsets.symmetric( padding: EdgeInsets.only(
horizontal: 15.0, vertical: 8.0), top: 20.0,
child: Container( left: 10.0,
padding: EdgeInsets.only( right: 10.0,
top: 20.0, bottom: 10.0,
left: 10.0, ),
right: 10.0, child: LargeAvatar(
bottom: 10.0, name: user.firstName.toString(),
), url: '',
child: LargeAvatar(
radius: 55.0,
name: user.firstName.toString(),
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: Row(children: <Widget>[
CrossAxisAlignment.start, Text(
children: <Widget>[ TranslationBase.of(context)
Row(children: <Widget>[ .welcome,
Texts( style: TextStyle(
TranslationBase.of(context) fontSize: 14.0,
.welcome,
fontSize: 16.0,
),
]),
SizedBox(
height: 5.0,
),
Row(children: <Widget>[
Texts(
languageID == "ar"
? user.firstNameN
.toString() +
" " +
user.lastNameN
.toString()
: user.firstName
.toString() +
" " +
user.lastName
.toString(),
fontSize: 17.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), color: Colors.grey),
]), ),
]), ]),
SizedBox(
height: 10,
),
Row(children: <Widget>[
Text(
languageID == "ar"
? user.firstNameN.toString() +
" " +
user.lastNameN.toString()
: user.firstName.toString() +
" " +
user.lastName.toString(),
style: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.bold),
),
]),
]),
], ],
), ),
) )
@ -180,53 +168,123 @@ 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: onTap: () {
'assets/images/pharmacy/orders_icon.svg', if (customerId == null) {
onTap: () { AppToast.showErrorToast(
if (customerId == null) { message: "Customer not found");
AppToast.showErrorToast( return;
message: "Customer not found"); }
return; Navigator.push(
} context,
Navigator.push( FadePage(
context, page: OrderPage(
FadePage( customerID: customerId)));
page: OrderPage( },
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,
),
SizedBox(
height: 5,
),
Text(
TranslationBase.of(context).orders,
style: TextStyle(
fontSize: 13.0,
fontWeight: FontWeight.bold,
),
),
],
),
),
), ),
AccountServices( Expanded(
title: TranslationBase.of(context).lakum, child: InkWell(
serviceImage: onTap: () {
'assets/images/pharmacy/lakum_icon.svg', Navigator.push(context,
onTap: () { FadePage(page: LakumMainPage()));
Navigator.push(context, },
FadePage(page: LakumMainPage())); child: Column(
}, children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/lakum_icon.svg',
width: 50,
height: 50,
),
SizedBox(
height: 5,
),
Text(
TranslationBase.of(context).lakum,
style: TextStyle(
fontSize: 13.0,
fontWeight: FontWeight.bold),
),
],
),
),
), ),
AccountServices( Expanded(
title: TranslationBase.of(context).wishlist, child: InkWell(
serviceImage: onTap: () {
'assets/images/pharmacy/wishlist_icon.svg', Navigator.push(
onTap: () { context,
Navigator.push( FadePage(page: WishlistPage()));
context, },
MaterialPageRoute( child: Column(
builder: (context) => children: <Widget>[
WishlistPage(true))); SvgPicture.asset(
}, 'assets/images/pharmacy/wishlist_icon.svg',
width: 50,
height: 50,
),
SizedBox(
height: 5,
),
Text(
TranslationBase.of(context).wishlist,
style: TextStyle(
fontSize: 13.0,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
Expanded(
child: InkWell(
onTap: () {
Navigator.push(context,
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,
),
),
],
),
),
), ),
AccountServices(
title: TranslationBase.of(context).reviews,
serviceImage:
'assets/images/pharmacy/review_icon.svg',
onTap: () {
Navigator.push(context,
FadePage(page: MyReviewsPage()));
},
)
], ],
)), )),
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(
fontSize: 16.0, TranslationBase.of(context).myAccount,
fontWeight: FontWeight.bold), style: TextStyle(
fontSize: 16.0,
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(
@ -279,16 +353,28 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
height: 20, height: 20,
), ),
InkWell( InkWell(
onTap: () { onTap: () {
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>[
.medicationsRefill, SvgPicture.asset(
itemIcon: 'assets/images/pharmacy/medication_refill_icon.svg',
'assets/images/pharmacy/medication_refill_icon.svg'), width: 30,
height: 30,
),
SizedBox(
width: 20,
),
Text(
TranslationBase.of(context)
.medicationsRefill,
style: TextStyle(
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,
.shippingAddresses, height: 30,
),
SizedBox(
width: 20,
),
Text(
TranslationBase.of(context)
.shippingAddresses,
style: TextStyle(
fontSize: 13.0,
),
),
],
), ),
), ),
SizedBox( SizedBox(
@ -356,19 +482,32 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
height: 20, height: 20,
), ),
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: page: PharmacyTermsConditions()));
PharmacyTermsConditions())); },
}, child: Row(
child: AccountItem( children: <Widget>[
isTerms: true, Image.asset(
title: TranslationBase.of(context) '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,
), ),
@ -377,24 +516,39 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
height: 20, height: 20,
), ),
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: LakumTermsConditions( page: LakumTermsConditions(
this.identificationNo, this.identificationNo,
this.firstName, this.firstName,
this.lastName, this.lastName,
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', width: 25,
isTerms: true, 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,54 +565,77 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Padding( Container(
padding: const EdgeInsets.symmetric( padding: EdgeInsets.only(left: 10.0),
horizontal: 15.0, vertical: 8.0), child: Column(
child: Container( crossAxisAlignment: CrossAxisAlignment.start,
padding: EdgeInsets.only(left: 10.0), children: <Widget>[
child: Column( Text(
crossAxisAlignment: CrossAxisAlignment.start, TranslationBase.of(context).reachUs,
children: <Widget>[ style: TextStyle(
Texts(TranslationBase.of(context).reachUs,
fontSize: 16.0, fontSize: 16.0,
fontWeight: FontWeight.bold), fontWeight: FontWeight.bold),
SizedBox( ),
height: 5, SizedBox(
), height: 5,
Divider( ),
color: Colors.grey, Divider(
height: 20, color: Colors.grey,
), height: 20,
InkWell( ),
onTap: () { InkWell(
Navigator.push(context, onTap: () {
FadePage(page: LiveChatPage())); Navigator.push(context,
}, FadePage(page: LiveChatPage()));
child: AccountItem( },
title: TranslationBase.of(context) child: Row(
.contactUs, children: <Widget>[
itemIcon: SvgPicture.asset(
'assets/images/pharmacy/contact_us_icon.svg'), 'assets/images/pharmacy/contact_us_icon.svg',
), width: 20,
SizedBox( height: 20,
height: 5, ),
SizedBox(
width: 20,
),
Text(
TranslationBase.of(context).contactUs,
style: TextStyle(fontSize: 13.0),
),
],
), ),
Divider( ),
color: Colors.grey, SizedBox(
height: 20, height: 5,
),
Divider(
color: Colors.grey,
height: 20,
),
InkWell(
onTap: () {
Navigator.push(context,
FadePage(page: FindUsPage()));
},
child: Row(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/our_locations_icon.svg',
width: 30,
height: 30,
),
SizedBox(
width: 20,
),
Text(
TranslationBase.of(context)
.ourLocations,
style: TextStyle(fontSize: 13.0),
),
],
), ),
InkWell( )
onTap: () { ],
Navigator.push(context,
FadePage(page: FindUsPage()));
},
child: AccountItem(
title: TranslationBase.of(context)
.ourLocations,
itemIcon:
'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,62 +37,81 @@ class BottomNavPharmacyItem extends StatelessWidget {
return Expanded( return Expanded(
child: SizedBox( child: SizedBox(
// height: 72.0, // height: 72.0,
child: Material( child: Stack(
type: MaterialType.transparency, clipBehavior: Clip.none,
child: InkWell( children: [
highlightColor: Colors.transparent, Material(
splashColor: Colors.transparent, type: MaterialType.transparency,
onTap: () { child: InkWell(
if (!Provider.of<ProjectViewModel>(context, listen: false) highlightColor: Colors.transparent,
splashColor: Colors.transparent,
onTap: () {
if (!Provider.of<ProjectViewModel>(context, listen: false)
.isLogin && .isLogin &&
(currentIndex == 2 || currentIndex == 3)) (currentIndex == 2 || currentIndex == 3))
Navigator.push( Navigator.push(
context, context,
FadePage(page: WelcomeLogin()), FadePage(page: WelcomeLogin()),
); );
else else
changeIndex(currentIndex); changeIndex(currentIndex);
}, },
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
SizedBox( SizedBox(
height: 15, height: 15,
), ),
currentIndex == index currentIndex == index
? Divider( ? Divider(
color: Color(0xff5AB145), color: Color(0xff5AB145),
thickness: 3.5, thickness: 3.5,
) )
: Divider( : Divider(
thickness: 0, thickness: 0,
), ),
Container( Container(
child: Icon(currentIndex == index ? activeIcon : icon, child: Icon(currentIndex == index ? activeIcon : icon,
color: isHome color: isHome
? Color(0xff5AB145) ? Color(0xff5AB145)
: currentIndex == index : currentIndex == index
? Colors.grey ? Colors.grey
: Colors.grey, : Colors.grey,
size: 22.0), size: 22.0),
), ),
SizedBox( SizedBox(
height: 11, height: 11,
), ),
// Added TextAlign Property // Added TextAlign Property
Texts( Texts(
title, title,
textAlign: TextAlign.center, textAlign: TextAlign.center,
color: currentIndex == index ? Colors.grey : Colors.grey, color: currentIndex == index ? Colors.grey : Colors.grey,
fontWeight: fontWeight:
currentIndex == index ? FontWeight.bold : FontWeight.w400, currentIndex == index ? FontWeight.bold : FontWeight.w400,
fontSize: currentIndex == index ? 13 : 11, fontSize: currentIndex == index ? 13 : 11,
),
],
), ),
], ),
), ),
), 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