import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/BannerPager.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/BestSellerWidget.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/GridViewButtons.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/MostViewedWidget.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/PrescriptionsWidget.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/ShopByBrandWidget.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

bool isInWishlist = false;
int price = 0;
var itemID;
var product;
var customerId;
var item;
dynamic languageID;
List wishlistData;

class PharmacyPage extends StatefulWidget {
  @override
  _PharmacyPageState createState() => _PharmacyPageState();
}

class _PharmacyPageState extends State<PharmacyPage> {
  @override
  Widget build(BuildContext context) {
    OrderPreviewViewModel orderPreviewViewModel = Provider.of(context);
    return WillPopScope(
      onWillPop: () async {
        return false;
      },
      child: BaseView<PharmacyModuleViewModel>(
        onModelReady: (model) async {
          await model.getSavedLanguage();
          await model.getBannerList();
          if (model.isLogin) await orderPreviewViewModel.getShoppingCart();
        },
        allowAny: true,
        builder: (_, model, wi) => AppScaffold(
          title: "",
          isShowDecPage: false,
          baseViewModel: model,
          isMainPharmacyPages: true,
          isPharmacy: true,
          isShowPharmacyAppbar: true,
          backgroundColor: Color(0xffFEFEFE),
          body: Container(
            width: double.infinity,
            child: SingleChildScrollView(
              child: Column(
                //crossAxisAlignment: CrossAxisAlignment.start,
                children: <Widget>[
                  BannerPager(model),
                  PrescriptionsWidget(),
                  //ShopByBrandWidget(),
                  MostViewedWidget(),
                  RecentlyViewedWidget(),
                  BestSellerWidget(),
                  //ShopByBrandWidget(),
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }
}
