Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
23 kB
1
Indexable
Never
import 'dart:async';

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:mobile_banking/data/bloc/refresh_token/refresh_token.dart';
import 'package:mobile_banking/data/model/global.dart';
import 'package:mobile_banking/feature/settings/change_email/change_email.dart';
import 'package:mobile_banking/feature/settings/change_success/change_success_page.dart';
import 'package:mobile_banking/feature/settings/forgot_password/forgot_password_page.dart';
import 'package:mobile_banking/feature/settings/management_proxy/registrasi_proxy_page.dart';
import 'package:mobile_banking/feature/settings/management_proxy/update_proxy_page.dart';
import 'package:mobile_banking/services/locator.dart';
import 'package:mobile_banking/util/appTheme.dart';
import 'package:mobile_banking/util/app_localization.dart';
import 'package:mobile_banking/util/convert_colors.dart';
import 'package:mobile_banking/util/custome_widget.dart';
import 'package:mobile_banking/util/translator.dart';
import 'package:mobile_banking/util/utility.dart';
import 'package:mobile_banking/widget/base_portfolio_state.dart';
import 'package:mobile_banking/widget/custom_base_page.dart';
import 'package:mobile_banking/widget/custom_button.dart';
import 'package:mobile_banking/widget/custom_dialog_widget.dart';
import 'package:mobile_banking/widget/vertical_spacing.dart';
import 'package:permissions_plugin/permissions_plugin.dart';
import 'package:rounded_loading_button/rounded_loading_button.dart';

class RecieptBifastPage extends StatefulWidget {
  static const String route = '/reciept_bifast_page';
  // final List<String> rek;
  // final List<String> proxy;

  // DetailProxyPage({this.rek, this.proxy});

  @override
  _RecieptBifastPageState createState() => _RecieptBifastPageState();
}

// List<String> dummyData = [];
// List<String> dummyData1 = [];

class _RecieptBifastPageState extends BasePortfolioState<RecieptBifastPage> {
  bool isFormField = false;
  final TextEditingController _favController = new TextEditingController();
  RoundedLoadingButtonController _buttonController =
      RoundedLoadingButtonController();
  List<Map<String, String>> dummyData = [
    {
      'key': 'Dari',
      'value': 'dummy',
    },
    {
      'key': 'Ke',
      'value': 'dummy',
    },
    {
      'key': 'Tujuan Transaksi',
      'value': '',
    },
    {
      'key': 'Keterangan',
      'value': '',
    },
    {
      'key': 'Biaya Admin',
      'value': '',
    },
    {
      'key': 'Total',
      'value': '',
    },
  ];
  @override
  void initState() {
    super.initState();
    Timer(Duration(seconds: 2), () {
      ScaffoldMessenger.of(context).showSnackBar(SnackBar(
        shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.all(Radius.circular(8))),
        backgroundColor: Colors.white,
        behavior: SnackBarBehavior.floating,
        margin: EdgeInsets.only(
            bottom: heightLayer() - 200, left: 8, right: 8, top: 80),
        content: Center(
            child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Row(children: [
              Container(
                  // height: 32,
                  // width: 32,
                  // decoration: BoxDecoration(
                  //     color: HexColor('#F58220'),
                  //     borderRadius:
                  //         BorderRadius.circular(100)
                  //more than 50% of width makes circle
                  // ),
                  child: Image.asset(
                imagePath('ic_launcher'),
                scale: 7 / 3.5,
                width: 20,
                height: 20,
              )),
              HorizontalSpacing(
                width: 5,
              ),
              Text(
                'Tepat',
                style: AppTheme.textMarkOT13Reguler212121,
              )
            ]),
            VerticalSpacing(height: 11),
            Text('title', style: AppTheme.textMarkOT13Bold212121),
            VerticalSpacing(
              height: 4,
            ),
            Expanded(
                child:
                    Text('subtitle', style: AppTheme.textMarkOT13Reguler212121))
          ],
        )),
        dismissDirection: DismissDirection.down,
      ));
    });
  }

  _RecieptBifastPageState() {}

  @override
  void dispose() {
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: CustomerBasePage(
        hideIcon: true,
        toolbarShadowColour: HexColor('#F58220'),
        toolbarColour: HexColor('#F58220'),
        textAlign: TextAlign.start,
        body: body(),
        title: Utility.getValueTranslator("", ""),
        iconData: Icons.arrow_back,
        footer: footer(),
        // backgroundColour: HexColor('#FFFFFF'),
        heightFooter: 64,
        showConnectIndicator: false,
      ),
    );
  }

  @override
  Widget body() {
    return Container(
      height: heightLayer(),
      width: widthLayer(),
      decoration: BoxDecoration(
        gradient: LinearGradient(
          begin: Alignment.topCenter,
          end: Alignment.bottomCenter,
          colors: [
            Color(0xfff58220),
            Color(0xfff47b32),
          ],
        ),
      ),
      child: Column(
        children: <Widget>[
          VerticalSpacing(
            height: 67,
          ),
          Padding(
            padding: const EdgeInsets.only(left: 16, right: 16),
            child: Container(
              decoration: BoxDecoration(
                color: HexColor('#FFFFFF'),

                borderRadius: BorderRadius.circular(4), //border corner radius
              ),
              height: 484,
              child: Column(children: [
                Expanded(child: Text('')),
                Container(
                  height: 0.5,
                  color: Colors.grey,
                ),
                VerticalSpacing(),
                Center(
                  child: Text(
                    'Transfer BI Fast',
                    style: AppTheme.textMarkOT13Reguler212121,
                    textAlign: TextAlign.center,
                  ),
                ),
                VerticalSpacing(
                  height: 8,
                ),
                Center(
                  child: Text(
                    'Rp',
                    style: AppTheme.textMarkOT15RegulerOrange,
                    textAlign: TextAlign.center,
                  ),
                ),
                VerticalSpacing(),
                Container(
                  height: 0.5,
                  color: Colors.grey,
                ),
                VerticalSpacing(),
                Padding(
                  padding: const EdgeInsets.only(left: 20, right: 20),
                  child: Container(
                    height: dummyData.length.toDouble() * 19,
                    child: ListView.builder(
                        padding: EdgeInsets.all(0),
                        itemExtent: 19,
                        itemCount: dummyData.length,
                        itemBuilder: (BuildContext context, int index) {
                          return Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Text(
                                dummyData[index]['key'],
                                style: AppTheme.textMarkOT12Regular666666,
                              ),
                              Text(
                                dummyData[index]['value'],
                                style: AppTheme.textMarkOT12Regular212121,
                              )
                            ],
                          );
                        }),
                  ),
                ),
                VerticalSpacing(),
                Container(
                  height: 0.5,
                  color: Colors.grey,
                ),
                Padding(
                  padding: const EdgeInsets.only(
                      left: 20, right: 20, top: 12, bottom: 12),
                  child: Row(children: [
                    Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Text(
                          "No. Refrensi",
                          style: AppTheme.textMarkOT12Regular666666,
                        ),
                        Text(
                          "ID Transaksi",
                          style: AppTheme.textMarkOT12Regular666666,
                        ),
                        Text(
                          "Tanggal Transaksi",
                          style: AppTheme.textMarkOT12Regular666666,
                        ),
                      ],
                    ),
                    Column(
                      children: [
                        Text(
                          "  :  ",
                          style: AppTheme.textMarkOT12Regular666666,
                        ),
                        Text(
                          "  :  ",
                          style: AppTheme.textMarkOT12Regular666666,
                        ),
                        Text(
                          "  :  ",
                          style: AppTheme.textMarkOT12Regular666666,
                        ),
                      ],
                    ),
                  ]),
                ),
                Container(
                  height: 0.5,
                  color: Colors.grey,
                ),
                VerticalSpacing(),
                Text(
                  Utility.getValueTranslator(
                      " Resi ini merupakan bukti transaksi yang sah.",
                      "This receipt is proof of a valid transaction."),
                  style: AppTheme.textMarkOT9Regular212121,
                ),
                VerticalSpacing(),
                Row(
                  children: [
                    HorizontalSpacing(
                      width: 14,
                    ),
                    Container(
                      // height: 32,
                      // width: 32,
                      // decoration: BoxDecoration(
                      //     color: HexColor('#F58220'),
                      //     borderRadius:
                      //         BorderRadius.circular(100)
                      //more than 50% of width makes circle
                      // ),
                      child: Image.asset(
                        imagePath('ic_ib'),
                        scale: 7 / 3.5,
                        width: 25,
                        height: 25,
                      ),
                    ),
                    HorizontalSpacing(
                      width: 9,
                    ),
                    Expanded(
                      child: Text(
                        Utility.getValueTranslator(
                            " BTPN Syariah berizin dan diawasi oleh OJK dan merupakan peserta penjaminan LPS",
                            "'BTPN Syariah is licensed and supervised by OJK and is an LPS guarantee participant'"),
                        style: AppTheme.textMarkOT9Regular212121,
                      ),
                    ),
                    HorizontalSpacing(
                      width: 26,
                    ),
                    Container(
                      width: 48,
                      height: 42.19,
                      // decoration: BoxDecoration(
                      //     color: HexColor('#F58220'),
                      //     borderRadius:
                      //         BorderRadius.circular(100)
                      //more than 50% of width makes circle
                      // ),
                      child: Image.asset(
                        imagePath('ic_logo_btpn'),
                        // scale: 9 / 3.5,
                        // width: 24,
                        // height: 42.19,
                      ),
                    ),
                    HorizontalSpacing(
                      width: 10,
                    )
                  ],
                ),
                VerticalSpacing(
                  height: 11,
                )
              ]),
            ),
          ),
        ],
      ),
    );
  }

  @override
  Widget footer() {
    return Container(
      height: 80.0,
      color: Color(0xFFF7F7F7),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceAround,
        children: [
          InkWell(
            // onTap: () {
            //   Utility.shareAction(
            //       widget.transfer
            //           .mapTransferOnlineReceipt(),
            //       title: "Transfer ke Bank Lain(Online)",
            //       balance: widget.transfer.amount,
            //       footer: widget.transfer
            //           .mapFooterRefReceipt(context),
            //       isPending:
            //           widget.isSuccess ? false : true);
            // },
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Image.asset(
                  imagePath('ic_share'),
                  height: 25,
                ),
                VerticalSpacing(
                  height: 8,
                ),
                Text(
                  AppLocalization.of(context).getValue(share),
                  style: AppTheme.body2,
                )
              ],
            ),
          ),
          InkWell(
            // onTap: () async {
            //   if (Platform.isAndroid) {
            //     await checkPermission(
            //         Permission.WRITE_EXTERNAL_STORAGE);
            //     await checkPermission(
            //         Permission.READ_EXTERNAL_STORAGE);
            //     if (isAllowedScreenshot) {
            //       Utility.screenshotAction(
            //           _globalKey, _repaintKey);
            //     }
            //   } else {
            //     Utility.screenshotAction(
            //         _globalKey, _repaintKey);
            //   }
            // },
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Image.asset(
                  imagePath('ic_screenshot'),
                  height: 25,
                ),
                VerticalSpacing(
                  height: 8,
                ),
                Text(
                  AppLocalization.of(context).getValue(screenShoot),
                  style: AppTheme.body2,
                )
              ],
            ),
          ),
          InkWell(
            onTap: _addFavoriteTap,

            // _addFavoriteTap,
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Image.asset(
                  imagePath('ic_favorite'),
                  height: 25,
                ),
                VerticalSpacing(
                  height: 8,
                ),
                Text(
                  AppLocalization.of(context).getValue(addFavorite),
                  style: AppTheme.body2,
                )
              ],
            ),
          ),
        ],
      ),
    );
  }

  _addFavoriteTap() {
    showModalBottomSheet(
        isScrollControlled: true,
        context: context,
        backgroundColor: Colors.transparent,
        builder: (context) {
          return StatefulBuilder(
            builder: (BuildContext context, StateSetter setModalState) {
              return Container(
                decoration: BoxDecoration(
                    color: AppTheme.white,
                    borderRadius: BorderRadius.only(
                        topLeft: Radius.circular(30),
                        topRight: Radius.circular(30)),
                    boxShadow: [
                      BoxShadow(color: AppTheme.grey, blurRadius: 8)
                    ]),
                child: Column(
                  mainAxisSize: MainAxisSize.min,
                  children: <Widget>[
                    SizedBox(
                      height: 15,
                    ),
                    Container(
                      height: 5,
                      width: 30,
                      color: AppTheme.grey,
                    ),
                    SizedBox(
                      height: 15,
                    ),
                    Text(
                      Utility.getValueTranslator(
                          "Simpan Sebagai Favorit", "Save As Favorite"),
                      style: AppTheme.subHeader,
                    ),
                    VerticalSpacing(),
                    Padding(
                        padding: MediaQuery.of(context).viewInsets,
                        child: Padding(
                          padding: const EdgeInsets.all(16),
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: <Widget>[
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: <Widget>[
                                  Text(
                                    'Alias',
                                    textAlign: TextAlign.left,
                                  ),
                                  TextFormField(
                                    autofocus: true,
                                    controller: _favController,
                                    decoration: InputDecoration(
                                        labelStyle: AppTheme.formInput),
                                    onChanged: (v) {
                                      setModalState(() {
                                        isFormField = v.isNotEmpty;
                                      });
                                    },
                                    validator: (v) {
                                      if (v.isEmpty || v.trim().length == 0) {
                                        return 'Field tidak boleh kosong!';
                                      }
                                      return null;
                                    },
                                  ),
                                  VerticalSpacing(
                                    height: 25,
                                  ),
                                  isFormField
                                      ? CustomButton(
                                          color: HexColor('#00767A'),
                                          // controller: _buttonController,
                                          onPressed: () {
                                            Navigator.of(context).pop();

                                            ScaffoldMessenger.of(context)
                                                .showSnackBar(SnackBar(
                                              // shape: RoundedRectangleBorder(
                                              //     borderRadius:
                                              //         BorderRadius.all(
                                              //             Radius.circular(8))),
                                              backgroundColor:
                                                  HexColor('#212121'),
                                              behavior:
                                                  SnackBarBehavior.floating,
                                              margin: EdgeInsets.only(
                                                  bottom: 80, top: 650),
                                              content: Center(
                                                  child: Column(
                                                mainAxisAlignment:
                                                    MainAxisAlignment.center,
                                                crossAxisAlignment:
                                                    CrossAxisAlignment.start,
                                                children: [
                                                  Text(
                                                    Utility.getValueTranslator(
                                                        "Rekening berhasil ditambahkan ke favorit",
                                                        "Account has been successfully added to favourites"),
                                                    style: AppTheme
                                                        .textMarkOT13white,
                                                  ),
                                                ],
                                              )),
                                              dismissDirection:
                                                  DismissDirection.down,
                                            ));

                                            // _buttonController.start();
                                            // _refreshTokenBloc.add(RefreshToken());
                                            // _bloc.add(SubmitEvent(
                                            //     destAccNumber: widget
                                            //         .transfer.destAccNumber,
                                            //     destBankCode: widget
                                            //         .transfer.destBankCode,
                                            //     destBankName: widget
                                            //         .transfer.destBankName,
                                            //     alias: _favController.text));
                                          },
                                          text: AppLocalization.of(context)
                                              .getValue(save))
                                      : CustomButtonInactive(
                                          onPressed: () {},
                                          text: AppLocalization.of(context)
                                              .getValue(save))
                                ],
                              )
                            ],
                          ),
                        )),
                  ],
                ),
              );
            },
          );
        });
  }
}