Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
4.9 kB
3
Indexable
  showOtpDialog() {
    final first = TextEditingController(),
        second = TextEditingController(),
        third = TextEditingController(),
        forth = TextEditingController();
    showGeneralDialog(
      context: Get.context!,
      barrierDismissible: true,
      // barrierColor: Colors.transparent,
      barrierLabel: "",
      pageBuilder: (context, animation, secondaryAnimation) {
        return Scaffold(
          backgroundColor: Colors.transparent,
          body: SingleChildScrollView(
            child: Container(
              width: double.infinity,
              margin: const EdgeInsets.symmetric(horizontal: 20, vertical: 120),
              decoration: const BoxDecoration(
                  borderRadius: BorderRadius.all(Radius.circular(25)),
                  color: Colors.white),
              padding: const EdgeInsets.all(25),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                mainAxisSize: MainAxisSize.min,
                children: [
                  Row(
                    mainAxisAlignment: MainAxisAlignment.end,
                    children: [
                      GestureDetector(
                          onTap: () {
                            Get.back();
                          },
                          child: Icon(Icons.close, color: Colors.black)),
                    ],
                  ),
                  SizedBox(
                    height: MediaQuery.of(context).size.height * 0.05,
                  ),
                  Text(
                    translate(context).otp_sent,
                    style: Style.montserratBoldStyle().copyWith(
                        color: BaseColors.textBlackColor, fontSize: 21.sp),
                  ),
                  SizedBox(
                    height: 0.5.h,
                  ),
                  Text(
                    translate(context).enter_4_digit_otp,
                    style: Style.montserratRegularStyle().copyWith(
                        color: const Color(0xff6B6B6B),
                        fontSize: 16.sp,
                        height: 1.5),
                  ),
                  SizedBox(
                    height: 0.5.h,
                  ),
                  Text(
                    "05xx-xxxxxxxx",
                    style: Style.montserratRegularStyle().copyWith(
                        color: const Color(0xff6B6B6B),
                        fontSize: 16.sp,
                        height: 1.5),
                  ),
                  SizedBox(
                    height: 0.5.h,
                  ),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      OTPInputBox(
                          controller: first,
                          autoFocus: true,
                          size: MediaQuery.of(context).size),
                      OTPInputBox(
                          controller: second,
                          autoFocus: false,
                          size: MediaQuery.of(context).size),
                      OTPInputBox(
                          controller: third,
                          autoFocus: false,
                          size: MediaQuery.of(context).size),
                      OTPInputBox(
                          controller: forth,
                          autoFocus: false,
                          size: MediaQuery.of(context).size),
                    ],
                  ),
                  SizedBox(
                    height: 5.h,
                  ),
                  Center(
                    child: RichText(
                      text: TextSpan(
                        text: ' ${translate(context).didnt_recive_otp}',
                        style: Style.montserratBoldStyle().copyWith(
                            color: const Color(0xff7C7C7C), fontSize: 16.sp),
                        children: <TextSpan>[
                          TextSpan(
                              text: ' ${translate(context).sent_again}',
                              style: Style.montserratBoldStyle().copyWith(
                                  color: BaseColors.primaryColor,
                                  fontSize: 16.sp)),
                        ],
                      ),
                    ),
                  ),
                  SizedBox(
                    height: 10.h,
                  ),
                  Center(
                    child: BaseButton(
                      btnType: mediumButton,
                      title: translate(context).submit_btn_txt,
                      onPressed: () {
                        Navigator.pop(context);
                      },
                      borderRadius: 20,
                    ),
                  ),
                ],
              ),
            ),
          ),
        );
      },
    );
  }