import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:Intaleq/constant/colors.dart';
import 'package:Intaleq/constant/style.dart';
import 'package:Intaleq/controller/auth/register_controller.dart';
import 'package:Intaleq/views/widgets/elevated_btn.dart';
import 'package:Intaleq/views/widgets/my_scafold.dart';

class VerifyEmailPage extends StatelessWidget {
  const VerifyEmailPage({super.key});

  @override
  Widget build(BuildContext context) {
    Get.put(RegisterController());
    return MyScafolld(
      title: 'Verify Email'.tr,
      body: [
        Positioned(
            top: 10,
            left: 20,
            right: 20,
            child: Text(
              'We sent 5 digit to your Email provided'.tr,
              style: AppStyle.title.copyWith(fontSize: 20),
            )),
        GetBuilder<RegisterController>(
            builder: (controller) => Positioned(
                  top: 100,
                  left: 80,
                  right: 80,
                  child: Padding(
                    padding: const EdgeInsets.all(10),
                    child: Column(
                      children: [
                        SizedBox(
                          width: 100,
                          child: TextField(
                            controller: controller.verifyCode,
                            decoration: InputDecoration(
                              labelStyle: AppStyle.title,
                              border: const OutlineInputBorder(),
                              hintText: '5 digit'.tr,
                              counterStyle: AppStyle.number,
                              hintStyle: AppStyle.subtitle
                                  .copyWith(color: AppColor.accentColor),
                            ),
                            maxLength: 5,
                            keyboardType: TextInputType.number,
                          ),
                        ),
                        const SizedBox(
                          height: 30,
                        ),
                        MyElevatedButton(
                            title: 'Send Verfication Code'.tr,
                            onPressed: () => controller.sendVerifications())
                      ],
                    ),
                  ),
                )),
      ],
      isleading: true,
    );
  }

  Padding verifyEmail() {
    return Padding(
      padding: const EdgeInsets.symmetric(horizontal: 10),
      child: Container(
        decoration: BoxDecoration(
          border: Border.all(
            color: AppColor.accentColor,
            width: 2,
          ),
          borderRadius: BorderRadius.circular(8),
        ),
        child: const Padding(
          padding: EdgeInsets.all(10),
          child: SizedBox(
            width: 20,
            child: TextField(
              maxLength: 1,
              keyboardType: TextInputType.number,
            ),
          ),
        ),
      ),
    );
  }
}
