InputLookup constructor

InputLookup({
  1. Key? key,
  2. required String name,
  3. required String label,
  4. required FiltroTelaBase telaPesquisa,
  5. dynamic function(
    1. String valor
    )?,
  6. bool visivel = true,
  7. Map<String, dynamic>? valorinicial,
  8. bool obrigatorio = false,
})

Implementation

InputLookup({
  Key? key,
  required this.name,
  required this.label,
  required this.telaPesquisa,
  this.function,
  this.visivel = true,
  this.valorinicial,
  this.obrigatorio = false,
}) : super(key: key) {
  id = Input(
    name: "ID",
    label: "Codigo",
    width: 90,
    onChanged: (valor) async {
      if (valor.isNotEmpty) {
        if (function != null) {
          function!(valor);
        }
        final res = await telaPesquisa.controller
            .pesquisarid(valor: [int.parse(valor)]);
        if (res != null) {
          descricao.controller.text = res['descricao'];
        } else {
          descricao.controller.text = "";
        }
      } else {
        descricao.controller.text = "";
      }
    },
  );
  descricao = Input(
    name: "DESCRICAO",
    label: label,
    editable: false,
    obrigatorio: obrigatorio,
  );
}