merge-requests/563/head
haroon amjad 4 years ago
parent 94aab4a737
commit 207525e31a

@ -806,7 +806,7 @@ const Map localizedValues = {
"HealthTipsBasedOnCurrentWeather": {"en": "Health Tips Based On Current Weather", 'ar': ' نصائح صحية بناءاً على الطقس الحالي '},
"MoreDetails": {"en": "More details", "ar": " المزيد من التفاصيل "},
"SendCopy": {"en": "Send Copy", "ar": "ارسال نسخة"},
"ResendOrder": {"en": "Refill Order & Delivery", "ar": "إعادة طلب و توصيل"},
"ResendOrder": {"en": "Re-Order & Delivery", "ar": "إعادة طلب و توصيل"},
"Ports": {"en": "Ports", "ar": "المنافذ"},
"Way": {"en": "Way", "ar": "الطريقة"},
"Average": {"en": "Average", "ar": "متوسط"},

@ -490,6 +490,7 @@ class BaseAppClient {
}) async {
String url = fullUrl;
print("URL Query String: $url");
print("body: $body");
if (await Utils.checkConnection()) {
headers.addAll({'Content-Type': 'application/json', 'Accept': 'application/json'});
@ -502,6 +503,8 @@ class BaseAppClient {
print("statusCode :$statusCode");
if (await handleUnauthorized(statusCode, forUrl: fullUrl)) simplePost(fullUrl, onFailure: onFailure, onSuccess: onSuccess, body: body, headers: headers);
print(response.body.toString());
if (statusCode < 200 || statusCode >= 400 || json == null) {
onFailure('Error While Fetching data', statusCode);
} else {

@ -389,7 +389,9 @@ class _Register extends State<Register> {
Navigator.of(context).push(FadePage(page: ConfirmLogin(changePageViewIndex: widget.changePageViewIndex))),
}
else
{AppToast.showErrorToast(message: result ? result : TranslationBase.of(context).somethingWentWrong)}
{
AppToast.showErrorToast(message: result != null ? result : TranslationBase.of(context).somethingWentWrong),
}
});
}
}

@ -18,28 +18,25 @@ dynamic languageID;
class ClinicPackagesPage extends StatefulWidget {
List<PackagesResponseModel> products;
ClinicPackagesPage({@required this.products});
@override
_ClinicPackagesPageState createState() => _ClinicPackagesPageState();
}
class _ClinicPackagesPageState extends State<ClinicPackagesPage> with AfterLayoutMixin<ClinicPackagesPage>{
class _ClinicPackagesPageState extends State<ClinicPackagesPage> with AfterLayoutMixin<ClinicPackagesPage> {
AppScaffold appScaffold;
List<PackagesResponseModel> get _products => widget.products;
PackagesViewModel viewModel;
onProductCartClick(PackagesResponseModel product) async {
if(viewModel.service.customer == null)
viewModel.service.customer = await CreateCustomerDialogPage(context: context).show();
if (viewModel.service.customer == null) viewModel.service.customer = await CreateCustomerDialogPage(context: context).show();
if(viewModel.service.customer != null) {
if (viewModel.service.customer != null) {
var request = AddProductToCartRequestModel(product_id: product.id, customer_id: viewModel.service.customer.id);
await viewModel.service.addProductToCart(request, context: context).then((response){
await viewModel.service.addProductToCart(request, context: context).then((response) {
// appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount);
}).catchError((error) {
utils.Utils.showErrorToast(error);
@ -47,9 +44,8 @@ class _ClinicPackagesPageState extends State<ClinicPackagesPage> with AfterLayo
}
}
@override
void afterFirstLayout(BuildContext context) async{
void afterFirstLayout(BuildContext context) async {
// appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount);
}
@ -58,13 +54,11 @@ class _ClinicPackagesPageState extends State<ClinicPackagesPage> with AfterLayo
super.initState();
}
@override
Widget build(BuildContext context) {
return BaseView<PackagesViewModel>(
allowAny: true,
onModelReady: (model){
onModelReady: (model) {
viewModel = model;
},
builder: (_, model, wi) => appScaffold = AppScaffold(
@ -76,22 +70,25 @@ class _ClinicPackagesPageState extends State<ClinicPackagesPage> with AfterLayo
isOfferPackages: true,
showOfferPackagesCart: true,
isShowDecPage: false,
showNewAppBar: true,
showNewAppBarTitle: true,
body: Padding(
padding: const EdgeInsets.all(5),
padding: const EdgeInsets.all(12),
child: StaggeredGridView.countBuilder(
crossAxisCount:4,
crossAxisCount: 4,
itemCount: _products.length,
itemBuilder: (BuildContext context, int index) => new Container(
color: Colors.transparent,
child: PackagesItemCard( itemContentPadding: 10,itemModel: _products[index], onCartClick: onProductCartClick,)
),
child: PackagesItemCard(
itemContentPadding: 10,
itemModel: _products[index],
onCartClick: onProductCartClick,
)),
staggeredTileBuilder: (int index) => StaggeredTile.fit(2),
mainAxisSpacing: 20,
crossAxisSpacing: 10,
)
),
)),
),
);
}
}

@ -47,7 +47,7 @@ class PackagesItemCardState extends State<PackagesItemCard> {
aspectRatio: 144 / 144,
child: ClipRRect(
borderRadius: BorderRadius.circular(12.0),
child: Image.network("https://mdlaboratories.com/offersdiscounts/images/thumbs/0000162_dermatology-testing.jpeg", fit: BoxFit.fill, height: 180.0, width: 180.0),
child: Image.network(widget.itemModel.images.isNotEmpty ? widget.itemModel.images[0].src : "https://mdlaboratories.com/offersdiscounts/images/thumbs/0000162_dermatology-testing.jpeg", fit: BoxFit.fill, height: 180.0, width: 180.0),
),
),
SizedBox(height: 6),
@ -61,7 +61,7 @@ class PackagesItemCardState extends State<PackagesItemCard> {
color: Color(0xff2B353E),
),
),
Text("Special discount for all HMG Employees and their first…",
Text(widget.itemModel.shortDescription,
maxLines: 2,
style: TextStyle(
fontSize: 12.0,

Loading…
Cancel
Save