import 'package:brasil_fields/brasil_fields.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

import '../componentes/appbar_custom.dart';
import '../componentes/buttom_custom.dart';
import '../componentes/input_text.dart';
import '../utils/cores.dart';
import '../utils/dimensoes.dart';

class TelaCadastro extends StatefulWidget {
  const TelaCadastro({Key? key}) : super(key: key);

  @override
  State<TelaCadastro> createState() => _TelaCadastroState();
}

class _TelaCadastroState extends State<TelaCadastro> {

  final inputCPF = TextEditingController();
  final inputSenha = TextEditingController();
  final inputRepita = TextEditingController();
  final inputCodigo = TextEditingController();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBarCustom().appbar(context, 'CADASTRO'),
      body: Container(
        padding: EdgeInsets.all(Dimensoes.width*0.15),
        width: Dimensoes.width,
        height: Dimensoes.height,
        alignment: Alignment.center,
        child: ListView(
          children: [
            Container(
                child: Image.asset("assets/images/logoEduca.png",width:Dimensoes.width * 0.4,height: Dimensoes.height * 0.12)
            ),
            Container(
              width: Dimensoes.width>900? Dimensoes.width * 0.18:Dimensoes.width*0.7,
              child: InputText(
                inputFormatters: [
                  FilteringTextInputFormatter.digitsOnly,
                  CpfInputFormatter(),
                ],
                textInputType: TextInputType.number,
                controller: inputCPF,
                title: 'CPF',
                width: Dimensoes.width>900? Dimensoes.width * 0.18:Dimensoes.width*0.7,
                colorBorder: PaletaCores.branco,
              ),
            ),
            Container(
              width: Dimensoes.width>900? Dimensoes.width * 0.18:Dimensoes.width*0.7,
              child: InputText(
                inputFormatters: [],
                obscure: true,
                controller: inputSenha,
                title: 'Senha',
                width: Dimensoes.width>900? Dimensoes.width * 0.18:Dimensoes.width*0.7,
                colorBorder: PaletaCores.branco,
              ),
            ),
            Container(
              width: Dimensoes.width>900? Dimensoes.width * 0.18:Dimensoes.width*0.7,
              child: InputText(
                inputFormatters: [],
                obscure: true,
                controller: inputRepita,
                title: 'Repetir Senha',
                width: Dimensoes.width>900? Dimensoes.width * 0.18:Dimensoes.width*0.7,
                colorBorder: PaletaCores.branco,
              ),
            ),
            Container(
              width: Dimensoes.width>900? Dimensoes.width * 0.18:Dimensoes.width*0.7,
              child: InputText(
                inputFormatters: [],
                controller: inputCodigo,
                title: 'Código Cidade',
                width: Dimensoes.width>900? Dimensoes.width * 0.18:Dimensoes.width*0.7,
                colorBorder: PaletaCores.branco,
              ),
            ),
            SizedBox(height: 20,),
            ButtonCustom(
              widthCustom: 0.7,
              heightCustom: 0.07,
              text: "Cadastrar",
              fontsize: 14.0,
              colorText: PaletaCores.branco,
              colorButton: PaletaCores.corPrimaria,
              colorBorder: PaletaCores.corPrimaria,
              onPressed: (){},
            ),
          ],
        ),
      ),
    );
  }
}
