Merge branch 'pharmacy-bugs' into 'development'

Pharmacy bugs

See merge request Cloud_Solution/diplomatic-quarter!315
merge-requests/316/head
Mohammad Aljammal 4 years ago
commit 234e69c02d

@ -511,10 +511,10 @@ class _BMICalculatorState extends State<BMICalculator> {
context,
FadePage(
page: ResultPage(
finalResult: bmiResult,
textResult: textResult,
msg: msg,
)),
finalResult: bmiResult,
textResult: textResult,
msg: msg,
)),
);
}
})

@ -125,6 +125,16 @@ class _BmrCalculatorState extends State<BmrCalculator> {
isShowAppBar: true,
isShowDecPage: false,
appBarTitle: 'Bmr Calculator',
showHomeAppBarIcon: false,
appBarIcons: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 7.0),
child: Icon(
Icons.info_outline,
color: Colors.white,
),
)
],
body: Padding(
padding: EdgeInsets.symmetric(horizontal: 25.0, vertical: 15.0),
child: SingleChildScrollView(
@ -704,9 +714,9 @@ class _BmrCalculatorState extends State<BmrCalculator> {
context,
FadePage(
page: BmrResultPage(
bmrResult: bmrResult,
calories: calories,
)),
bmrResult: bmrResult,
calories: calories,
)),
);
}
});

@ -210,6 +210,16 @@ class _BodyFatState extends State<BodyFat> {
return AppScaffold(
isShowAppBar: true,
appBarTitle: 'Body Fat',
showHomeAppBarIcon: false,
appBarIcons: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 7.0),
child: Icon(
Icons.info_outline,
color: Colors.white,
),
)
],
body: Padding(
padding: EdgeInsets.symmetric(horizontal: 25.0, vertical: 15.0),
child: SingleChildScrollView(
@ -1004,10 +1014,10 @@ class _BodyFatState extends State<BodyFat> {
context,
FadePage(
page: FatResult(
bodyFat: bodyFat,
fat: fat,
textResult: textResult,
)),
bodyFat: bodyFat,
fat: fat,
textResult: textResult,
)),
);
}
});

@ -108,6 +108,16 @@ class _CalorieCalculatorState extends State<CalorieCalculator> {
isShowDecPage: false,
appBarTitle:
"${TranslationBase.of(context).calories} ${TranslationBase.of(context).calcHealth}",
showHomeAppBarIcon: false,
appBarIcons: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 7.0),
child: Icon(
Icons.info_outline,
color: Colors.white,
),
)
],
body: Column(
children: [
Expanded(
@ -417,7 +427,9 @@ class _CalorieCalculatorState extends State<CalorieCalculator> {
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 0.0, horizontal: 18.0),
child: Center(child: Texts(TranslationBase.of(context).cm)),
child: Center(
child:
Texts(TranslationBase.of(context).cm)),
),
),
),
@ -446,11 +458,13 @@ class _CalorieCalculatorState extends State<CalorieCalculator> {
],
),
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 16.0),
child: Center(child: Texts(TranslationBase.of(context).feet))),
),
padding: const EdgeInsets.symmetric(
horizontal: 16.0),
child: Center(
child: Texts(
TranslationBase.of(context).feet))),
),
),
),
],
),
@ -465,7 +479,7 @@ class _CalorieCalculatorState extends State<CalorieCalculator> {
),
Container(
margin:
EdgeInsets.symmetric(horizontal: 4.0, vertical: 12.0),
EdgeInsets.symmetric(horizontal: 4.0, vertical: 12.0),
decoration: BoxDecoration(
color: Colors.white,
),
@ -514,8 +528,7 @@ class _CalorieCalculatorState extends State<CalorieCalculator> {
),
onTap: () {
setState(() {
if (weight < 250)
weight++;
if (weight < 250) weight++;
});
},
),
@ -589,7 +602,9 @@ class _CalorieCalculatorState extends State<CalorieCalculator> {
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 0.0, horizontal: 18.0),
child: Center(child: Texts(TranslationBase.of(context).kg)),
child: Center(
child:
Texts(TranslationBase.of(context).kg)),
),
),
),
@ -618,9 +633,11 @@ class _CalorieCalculatorState extends State<CalorieCalculator> {
],
),
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 16.0),
child: Center(child: Texts(TranslationBase.of(context).pound)),
padding: const EdgeInsets.symmetric(
horizontal: 16.0),
child: Center(
child: Texts(
TranslationBase.of(context).pound)),
),
),
),
@ -681,8 +698,8 @@ class _CalorieCalculatorState extends State<CalorieCalculator> {
context,
FadePage(
page: CalorieResultPage(
calorie: calories,
)),
calorie: calories,
)),
);
}
});

@ -82,6 +82,16 @@ class _CarbsState extends State<Carbs> {
return AppScaffold(
isShowAppBar: true,
appBarTitle: 'Carb Protein Fat',
showHomeAppBarIcon: false,
appBarIcons: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 7.0),
child: Icon(
Icons.info_outline,
color: Colors.white,
),
)
],
body: Padding(
padding: EdgeInsets.symmetric(horizontal: 25.0, vertical: 15.0),
child: SingleChildScrollView(
@ -201,7 +211,7 @@ class _CarbsState extends State<Carbs> {
),
Button(
backgroundColor: Color(0xffC5272D),
label: 'NOT SURE? CLICK HERE ',
label: 'NOT SURE? CLICK HERE',
onTap: () {
setState(() {
{
@ -341,16 +351,16 @@ class _CarbsState extends State<Carbs> {
context,
FadePage(
page: CarbsResult(
cCal: cCal,
pCal: pCal,
fCal: fCal,
pCalGram: pCalGram,
pCalMeal: pCalMeal,
fCalGram: fCalGram,
fCalMeal: fCalMeal,
cCalGram: cCalGram,
cCalMeal: cCalMeal,
)),
cCal: cCal,
pCal: pCal,
fCal: fCal,
pCalGram: pCalGram,
pCalMeal: pCalMeal,
fCalGram: fCalGram,
fCalMeal: fCalMeal,
cCalGram: cCalGram,
cCalMeal: cCalMeal,
)),
);
}
});

@ -102,6 +102,16 @@ class _IdealBodyState extends State<IdealBody> {
return AppScaffold(
isShowAppBar: true,
appBarTitle: 'Ideal Body Weight',
showHomeAppBarIcon: false,
appBarIcons: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 7.0),
child: Icon(
Icons.info_outline,
color: Colors.white,
),
)
],
body: Padding(
padding: EdgeInsets.symmetric(vertical: 15.0, horizontal: 25.0),
child: SingleChildScrollView(
@ -518,7 +528,7 @@ class _IdealBodyState extends State<IdealBody> {
height: 30.0,
),
Container(
height: 100.0,
height: 50.0,
width: 350.0,
child: SecondaryButton(
label: 'CALCULATE',
@ -535,12 +545,12 @@ class _IdealBodyState extends State<IdealBody> {
context,
FadePage(
page: IdealBodyResult(
idealBodyWeight: idealWeight,
minRange: minRange,
mixRange: maxRange,
overWeightBy: overWeightBy,
textResult: textResult,
)),
idealBodyWeight: idealWeight,
minRange: minRange,
mixRange: maxRange,
overWeightBy: overWeightBy,
textResult: textResult,
)),
);
}
});

@ -254,7 +254,7 @@ class _BloodSugarState extends State<BloodSugar> {
),
Flexible(
child: Container(
height: 60.0,
height: 50.0,
width: 150.0,
child: SecondaryButton(
label: TranslationBase.of(context).calculate,

@ -45,7 +45,8 @@ class PackagesCartPage extends StatefulWidget {
_PackagesCartPageState createState() => _PackagesCartPageState();
}
class _PackagesCartPageState extends State<PackagesCartPage> with AfterLayoutMixin<PackagesCartPage>, SingleTickerProviderStateMixin {
class _PackagesCartPageState extends State<PackagesCartPage>
with AfterLayoutMixin<PackagesCartPage>, SingleTickerProviderStateMixin {
getLanguageID() async {
languageID = await sharedPref.getString(APP_LANGUAGE);
}
@ -54,7 +55,8 @@ class _PackagesCartPageState extends State<PackagesCartPage> with AfterLayoutMix
void initState() {
_agreeTerms = false;
_selectedPaymentMethod = null;
_animationController = AnimationController(vsync: this, duration: Duration(seconds: 500));
_animationController =
AnimationController(vsync: this, duration: Duration(seconds: 500));
super.initState();
}
@ -77,20 +79,25 @@ class _PackagesCartPageState extends State<PackagesCartPage> with AfterLayoutMix
Navigator.push(context, FadePage(page: PharmacyTermsConditions()));
}
onPayNowClick() async{
await viewModel.service.placeOrder(context: context,paymentOption: _selectedPaymentMethod.toUpperCase()).then((orderId){
if(orderId.runtimeType == int){ // result == order_id
onPayNowClick() async {
await viewModel.service
.placeOrder(
context: context,
paymentOption: _selectedPaymentMethod.toUpperCase())
.then((orderId) {
if (orderId.runtimeType == int) {
// result == order_id
var browser = MyInAppBrowser(
context: context,
onExitCallback: (data, isDone) => paymentClosed(orderId: orderId, withStatus: isDone, data: data)
);
browser.openPackagesPaymentBrowser(customer_id: viewModel.service.customer.id, order_id: orderId);
}else{
utils.Utils.showErrorToast('Failed to place order, please try again later');
onExitCallback: (data, isDone) => paymentClosed(
orderId: orderId, withStatus: isDone, data: data));
browser.openPackagesPaymentBrowser(
customer_id: viewModel.service.customer.id, order_id: orderId);
} else {
utils.Utils.showErrorToast(
'Failed to place order, please try again later');
}
}).catchError((error){
}).catchError((error) {
utils.Utils.showErrorToast(error);
});
}
@ -124,7 +131,6 @@ class _PackagesCartPageState extends State<PackagesCartPage> with AfterLayoutMix
crossAxisCount: (_columnCount * _columnCount),
itemCount: viewModel.cartItemList.length,
itemBuilder: (BuildContext context, int index) {
var item = viewModel.cartItemList[index];
return Dismissible(
key: Key(index.toString()),
@ -132,7 +138,9 @@ class _PackagesCartPageState extends State<PackagesCartPage> with AfterLayoutMix
background: _cartItemDeleteContainer(),
secondaryBackground: _cartItemDeleteContainer(),
confirmDismiss: (direction) async {
bool status = await viewModel.service.deleteProductFromCart(item.id, context: context, showLoading: false);
bool status = await viewModel.service
.deleteProductFromCart(item.id,
context: context, showLoading: false);
return status;
},
onDismissed: (direction) {
@ -141,17 +149,23 @@ class _PackagesCartPageState extends State<PackagesCartPage> with AfterLayoutMix
},
child: PackagesCartItemCard(
itemModel: item,
shouldStepperChangeApply: (apply,total) async{
var request = AddProductToCartRequestModel(product_id: item.productId, quantity: apply);
ResponseModel response = await viewModel.service.addProductToCart(request, context: context, showLoading: false).catchError((error){
shouldStepperChangeApply: (apply, total) async {
var request = AddProductToCartRequestModel(
product_id: item.productId,
quantity: apply);
ResponseModel response = await viewModel
.service
.addProductToCart(request,
context: context, showLoading: false)
.catchError((error) {
utils.Utils.showErrorToast(error);
});
return response.status ?? false;
},
)
);
));
},
staggeredTileBuilder: (int index) => StaggeredTile.fit(_columnCount),
staggeredTileBuilder: (int index) =>
StaggeredTile.fit(_columnCount),
mainAxisSpacing: 0,
crossAxisSpacing: 10,
)),
@ -164,25 +178,29 @@ class _PackagesCartPageState extends State<PackagesCartPage> with AfterLayoutMix
color: Colors.white,
child: Column(
children: [
Texts(
TranslationBase.of(context).selectPaymentOption,
fontSize: 10,
fontWeight: FontWeight.bold
Texts(TranslationBase.of(context).selectPaymentOption,
fontSize: 10, fontWeight: FontWeight.bold),
Container(
height: 0.25,
width: 100,
color: Colors.grey[300],
),
Container(height: 0.25, width: 100, color: Colors.grey[300],),
_paymentOptions(context, (paymentMethod) {
setState(() => _selectedPaymentMethod = paymentMethod);
}),
Container(height: 0.25, color: Colors.grey[300],),
Container(height: 40,
child: _termsAndCondition(context, onSelected: onTermsClick, onInfoClick: onTermsInfoClick)
Container(
height: 0.25,
color: Colors.grey[300],
),
Container(
height: 40,
child: _termsAndCondition(context,
onSelected: onTermsClick,
onInfoClick: onTermsInfoClick)),
Container(
height: 0.25,
color: Colors.grey[300],
),
Container(height: 0.25, color: Colors.grey[300],),
_payNow(context, onPayNowClick: onPayNowClick)
],
),
@ -195,19 +213,19 @@ class _PackagesCartPageState extends State<PackagesCartPage> with AfterLayoutMix
fetchData() async {
await viewModel.service.cartItems(context: context).catchError((error) {});
setState((){});
setState(() {});
}
paymentClosed({@required int orderId, @required bool withStatus, dynamic data}) async{
viewModel.service.getOrderById(orderId, context: context).then((value){
paymentClosed(
{@required int orderId, @required bool withStatus, dynamic data}) async {
viewModel.service.getOrderById(orderId, context: context).then((value) {
var heading = withStatus ? "Success" : "Failed";
var title = "Your order has been placed successfully";
var subTitle = "Order# ${value.data.customOrderNumber}";
Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (context) => PackageOrderCompletedPage(heading: heading, title: title, subTitle: subTitle))
);
}).catchError((error){
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => PackageOrderCompletedPage(
heading: heading, title: title, subTitle: subTitle)));
}).catchError((error) {
debugPrint(error);
});
}
@ -231,13 +249,13 @@ Widget _paymentOptions(BuildContext context, Function(String) onSelected) {
),
],
borderRadius: BorderRadius.all(Radius.circular(5)),
border: Border.all(color: isSelected ? Colors.green : Colors.grey, width: isSelected ? 1 : 0.5)
),
border: Border.all(
color: isSelected ? Colors.green : Colors.grey,
width: isSelected ? 1 : 0.5)),
child: Padding(
padding: const EdgeInsets.all(4),
child: Image.asset('assets/images/new-design/$imageName'),
)
);
));
}
return Padding(
@ -267,7 +285,8 @@ Widget _paymentOptions(BuildContext context, Function(String) onSelected) {
width: 5,
),
InkWell(
child: buttonContent(_selectedPaymentMethod == "mastercard", 'mastercard.png'),
child: buttonContent(
_selectedPaymentMethod == "mastercard", 'mastercard.png'),
onTap: () {
onSelected("mastercard");
},
@ -276,7 +295,8 @@ Widget _paymentOptions(BuildContext context, Function(String) onSelected) {
width: 5,
),
InkWell(
child: buttonContent(_selectedPaymentMethod == "installment", 'installment.png'),
child: buttonContent(
_selectedPaymentMethod == "installment", 'installment.png'),
onTap: () {
onSelected("installment");
},
@ -288,14 +308,17 @@ Widget _paymentOptions(BuildContext context, Function(String) onSelected) {
}
bool _agreeTerms = false;
Widget _termsAndCondition(BuildContext context, {@required Function(bool) onSelected, @required VoidCallback onInfoClick}) {
Widget _termsAndCondition(BuildContext context,
{@required Function(bool) onSelected, @required VoidCallback onInfoClick}) {
return Padding(
padding: const EdgeInsets.all(5),
child: Row(
children: [
InkWell(
child: Icon(
_agreeTerms ? Icons.check_circle : Icons.radio_button_unchecked_sharp,
_agreeTerms
? Icons.check_circle
: Icons.radio_button_unchecked_sharp,
size: 20,
color: _agreeTerms ? Colors.green[600] : Colors.grey[400],
),
@ -308,7 +331,8 @@ Widget _termsAndCondition(BuildContext context, {@required Function(bool) onSele
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Texts(
TranslationBase.of(context).pharmacyServiceTermsCondition,
fontWeight: FontWeight.normal, fontSize: 13,
fontWeight: FontWeight.normal,
fontSize: 13,
),
)),
InkWell(
@ -340,9 +364,18 @@ Widget _payNow(BuildContext context, {@required VoidCallback onPayNowClick}) {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts('${TranslationBase.of(context).subtotal}: ${'999.9'} ${TranslationBase.of(context).sar}',
heightFactor: 1.5, fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 8),
Texts('${TranslationBase.of(context).vat}: ${'14.9'} ${TranslationBase.of(context).sar}', heightFactor: 1.5, fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 8),
Texts(
'${TranslationBase.of(context).subtotal}: ${'999.9'} ${TranslationBase.of(context).sar}',
heightFactor: 1.5,
fontWeight: FontWeight.bold,
color: Colors.grey,
fontSize: 8),
Texts(
'${TranslationBase.of(context).vat}: ${'14.9'} ${TranslationBase.of(context).sar}',
heightFactor: 1.5,
fontWeight: FontWeight.bold,
color: Colors.grey,
fontSize: 8),
Padding(
padding: const EdgeInsets.all(3),
child: Container(
@ -351,8 +384,12 @@ Widget _payNow(BuildContext context, {@required VoidCallback onPayNowClick}) {
color: Colors.grey[300],
),
),
Texts('${TranslationBase.of(context).total}: 999.99 ${TranslationBase.of(context).sar}',
heightFactor: 1.5, fontWeight: FontWeight.bold, color: Colors.black54, fontSize: 15)
Texts(
'${TranslationBase.of(context).total}: 999.99 ${TranslationBase.of(context).sar}',
heightFactor: 1.5,
fontWeight: FontWeight.bold,
color: Colors.black54,
fontSize: 15)
],
),
),
@ -360,10 +397,15 @@ Widget _payNow(BuildContext context, {@required VoidCallback onPayNowClick}) {
RaisedButton(
child: Texts(
TranslationBase.of(context).payNow,
fontSize: 15, color: Colors.white, fontWeight: FontWeight.bold,
fontSize: 15,
color: Colors.white,
fontWeight: FontWeight.bold,
),
padding: EdgeInsets.only(top: 5, bottom: 5, left: 0, right: 0),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5), side: BorderSide(color: Theme.of(context).primaryColor, width: 0.5)),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5),
side: BorderSide(
color: Theme.of(context).primaryColor, width: 0.5)),
color: Theme.of(context).primaryColor,
onPressed: isPayNowAQctive ? onPayNowClick : null,
),
@ -381,23 +423,23 @@ Widget _cartItemDeleteContainer() {
child: Padding(
padding: const EdgeInsets.all(5),
child: Container(
decoration: BoxDecoration(
color: Colors.red,
boxShadow: [
BoxShadow(
color: Colors.grey[500],
blurRadius: 2,
spreadRadius: 1,
),
],
borderRadius: BorderRadius.all(Radius.circular(5)),
decoration: BoxDecoration(
color: Colors.red,
boxShadow: [
BoxShadow(
color: Colors.grey[500],
blurRadius: 2,
spreadRadius: 1,
),
],
borderRadius: BorderRadius.all(Radius.circular(5)),
),
child: Center(
child: Texts(
"Deleting...",
fontWeight: FontWeight.normal,
fontSize: 15,
color: Colors.white,
fontWeight: FontWeight.normal,
fontSize: 15,
color: Colors.white,
)),
),
),

Loading…
Cancel
Save