import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCategoriesResponseModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/packages_offers/PackagesOffersViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/ProductCheckTypeWidget.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart' as utils;
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/StarRating.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';

import 'ClinicOfferAndPackagesPage.dart';

class OfferAndPackagesDetail extends StatefulWidget{
  final dynamic model;

  const OfferAndPackagesDetail({@required this.model, Key key}) : super(key: key);

  @override
  State<StatefulWidget> createState() => OfferAndPackagesDetailState();
}


class OfferAndPackagesDetailState extends State<OfferAndPackagesDetail>{

  PackagesViewModel viewModel;

  @override
  Widget build(BuildContext context) {
    getLanguageID();

    return BaseView<PackagesViewModel>(
      onModelReady: (model){
        viewModel = model;
      },
      builder: (_, model, wi) => AppScaffold(
          appBarTitle: TranslationBase.of(context).offerAndPackages,
          isShowAppBar: true,
          isPharmacy: false,
          showPharmacyCart: false,
          showHomeAppBarIcon: false,
          isOfferPackages: true,
          showOfferPackagesCart: true,
          isShowDecPage: false,
          body: Stack(
            children: [
              Padding(
                padding: const EdgeInsets.only(bottom: 60),
                child: ListView(
                  children: [
                    Padding(
                      padding: const EdgeInsets.all(5),
                      child: Stack(
                        children: [
                          Padding(
                            padding: const EdgeInsets.all(10),
                            child: AspectRatio(
                                aspectRatio: 1/1,
                                child: utils.applyShadow(
                                  child: ClipRRect(
                                      borderRadius: BorderRadius.circular(10),
                                      child: utils.Utils.loadNetworkImage(url: "https://wallpaperaccess.com/full/30103.jpg",)
                                  ),
                                )
                            ),
                          ),
                          Align(
                            alignment: Alignment.topLeft,
                            child: Image.asset(
                              'assets/images/discount_${'en'}.png',
                              height: 70,
                              width: 70,
                            ),
                          ),

                        ],

                      ),
                    ),

                    Padding(
                      padding: const EdgeInsets.only(left: 20, right: 20, bottom: 20),
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Texts(
                              "Child Dental Offer",
                              fontSize: 25,
                              fontWeight: FontWeight.normal,
                              color: Colors.black,
                          ),

                          Stack(
                            children: [
                              Texts(
                                  "200 SAR",
                                      fontWeight: FontWeight.normal,
                                      decoration: TextDecoration.lineThrough,
                                      color: Colors.grey,
                                      fontSize: 12
                              ),
                              Padding(
                                padding: const EdgeInsets.only(top: 15),
                                child: Texts(
                                    "894.99 SAR",
                                    fontWeight: FontWeight.bold,
                                    color: Colors.green,
                                    fontSize: 18
                                ),
                              ),
                            ],
                          ),

                          StarRating(
                              size: 20,
                              totalCount: null,
                              totalAverage: 5,
                              forceStars: true),


                          SizedBox(height: 20,),


                          Texts(
                              "Details",
                              fontWeight: FontWeight.bold,
                              color: Colors.grey,
                              fontSize: 20
                          ),



                          AspectRatio(
                            aspectRatio: 2/1,
                            child: Container(
                                color: Colors.grey[300],
                                child: Padding(
                                  padding: const EdgeInsets.all(10),
                                  child: Texts("Detail of offers written here"),
                                )
                            ),
                          ),


                          SizedBox(height: 10,),
                        ],
                      ),
                    ),
                  ],
                ),
              ),

              Padding(
                padding: const EdgeInsets.all(10),
                child: Align(
                  alignment: Alignment.bottomRight,
                  child: Row(
                    children: [

                      Expanded(
                        child:  RaisedButton.icon(
                          padding: EdgeInsets.only(top: 5, bottom: 5, left: 0, right: 0),
                          shape: RoundedRectangleBorder(
                              borderRadius: BorderRadius.circular(8.0),
                              side: BorderSide(color: Colors.red, width: 0.5)
                          ),
                          color: Colors.red,
                          icon: Icon(
                            Icons.add_shopping_cart_outlined,
                            size: 25,
                            color: Colors.white,
                          ),
                          label: Texts(
                            "Add to Cart",
                            fontSize: 17, color: Colors.white, fontWeight: FontWeight.normal,
                          ),
                          onPressed: (){},),
                      ),

                      SizedBox(width: 15,),

                      Expanded(
                        child:  OutlineButton.icon(
                          padding: EdgeInsets.only(top: 5, bottom: 5, left: 0, right: 0),
                          borderSide: BorderSide(width: 1.0, color: Colors.red),
                          shape: RoundedRectangleBorder(
                            borderRadius: BorderRadius.circular(8.0),
                          ),
                          color: Colors.white,
                          icon: Icon(
                            Icons.favorite_rounded,
                            size: 25,
                            color: Colors.red,
                          ),
                          label: Texts(
                            "Add to Favorites",
                              fontSize: 17, color: Colors.red, fontWeight: FontWeight.normal
                          ),
                          onPressed: (){

                          },),
                      ),

                    ],
                  ),
                ),
              )



            ],
          )
      ),
    );
  }
}

