viewMakePay method

dynamic viewMakePay(
  1. dynamic context
)

Implementation

viewMakePay(context) {
  Size size = MediaQuery.of(context).size;
  dynamic headers = {
    "public_key": widget.public_key,
    "private_key": widget.private_key,
    "secret_key": widget.secret_key,
    "merchant_key": widget.merchant_key,
    "required_user_information": widget.required_user_information,
    "custom_user_information": widget.custom_user_information,
  };
  ScrollController scrollController = ScrollController();

  return SingleChildScrollView(
    controller: scrollController,
    child: Column(
      mainAxisAlignment: MainAxisAlignment.start,
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Container(
          width: size.width,
          padding: EdgeInsets.all(15),
          color: ColorConstant.black,
          child: Text(
            "${taux} % de frais appliqués",
            style: TextStyle(
              color: Colors.white,
              fontSize: size.width * 0.04,
            ),
            textAlign: TextAlign.center,
          ),
        ),
        transaction_object != null
            ? Container(
                width: size.width,
                height: size.height * 0.3,
                child: Stack(
                  children: [
                    Container(
                      width: size.width,
                      height: size.height * 0.2,
                      color: ColorConstant.fromHex(widget.color),
                      child: Column(
                        mainAxisAlignment: MainAxisAlignment.center,
                        crossAxisAlignment: CrossAxisAlignment.center,
                        children: [
                          Text(
                            "Montant à payer",
                            style: TextStyle(
                                color: ColorConstant.white,
                                fontSize: size.width * 0.05),
                          ),
                          Text(
                            "${total_with_fees} ${transaction_object["x_currency"]["_code_alpha"]}",
                            style: TextStyle(
                                color: ColorConstant.white,
                                fontSize: size.width * 0.05,
                                fontWeight: FontWeight.bold),
                          ),
                        ],
                      ),
                    ),
                    Positioned(
                        top: size.height * 0.16,
                        child: Container(
                          width: size.width,
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.center,
                            children: [
                              Container(
                                width: size.width * 0.3,
                                height: size.width * 0.3,
                                decoration: BoxDecoration(
                                    border: Border.all(
                                        color: ColorConstant.white,
                                        width: 10),
                                    borderRadius: BorderRadius.all(
                                        Radius.circular(60))),
                                child: Container(
                                  padding: EdgeInsets.all(10),
                                  decoration: BoxDecoration(
                                      border: Border.all(
                                          color: ColorConstant.fromHex(
                                              widget.color),
                                          width: 10),
                                      borderRadius: BorderRadius.all(
                                          Radius.circular(60))),
                                  child: Image.network(
                                    transaction_object["_store"]["logo_url"],
                                    fit: BoxFit.contain,
                                  ),
                                ),
                              )
                            ],
                          ),
                        ))
                  ],
                ),
              )
            : SizedBox(),
        Container(
          width: size.width,
          height: size.height * 0.6,
          child: DefaultTabController(
            length: 1,
            child: Scaffold(
              backgroundColor: ColorConstant.white,
              appBar: AppBar(
                automaticallyImplyLeading: false,
                backgroundColor: ColorConstant.white,
                toolbarHeight: size.height * 0.07,
                title: TabBar(
                  indicatorColor: ColorConstant.fromHex(widget.color),
                  dividerColor: ColorConstant.fromHex(widget.color),
                  labelColor: ColorConstant.fromHex(widget.color),
                  labelStyle: TextStyle(fontSize: size.width * 0.05),
                  onTap: (value) {
                    switch (value) {
                      case 0:
                        setState(() {
                          type_means_of_paiement = TYPE_MEANS_PAYMENT_MOBILE;
                        });
                        break;
                      case 1:
                        setState(() {
                          type_means_of_paiement = TYPE_MEANS_PAYMENT_BANK;
                        });
                        break;
                    }
                    loadAmount();

                  },
                  tabs: [
                    Tab(
                      icon: Icon(
                        Icons.mobile_friendly,
                        size: size.width * 0.05,
                      ),
                      text: "Mobile Money",
                      height: size.height * 0.07,
                    ),
                    /*  Tab(
                        icon: Icon(Icons.credit_card),
                        text: "Carte Bancaire"),*/
                  ],
                ),
              ),
              body: TabBarView(
                children: [
                  PaymentMobileScreen(
                      headers,
                      transaction_result,
                      mobile_means_of_paiements,
                      total_to_pay,
                      total_with_fees,
                      fees,
                      taux,
                      selected_means_of_paiement, (value) {
                    setState(() {
                      page = value;
                    });
                  }, widget.color),
/*
                  PaymentCardScreen(),
*/
                ],
              ),
            ),
          ),
        ),
      ],
    ),
  );

}