diff --git a/lib/Model/API/APIModel.dart b/lib/Model/API/APIModel.dart index 4f9932a..fe198a3 100644 --- a/lib/Model/API/APIModel.dart +++ b/lib/Model/API/APIModel.dart @@ -1,7 +1,7 @@ class ApiModel { - static const ApiUrl = "http://10.0.0.91:4444"; + //static const ApiUrl = "http://10.0.0.91:4444"; //static const ApiUrl = "http://192.168.100.74:4444"; - // static const ApiUrl = "http://189.10.2.165:4444"; + static const ApiUrl = "http://192.168.100.82:4444"; static const String _token = "fd7bc88b7c0149adbc134d5d0a919814"; static const Map headers = { "Content-Type": "application/json", diff --git a/lib/components/dialogs/listas/listaCadastroDialog.dart b/lib/components/dialogs/listas/listaCadastroDialog.dart index d562f6a..f53cec0 100644 --- a/lib/components/dialogs/listas/listaCadastroDialog.dart +++ b/lib/components/dialogs/listas/listaCadastroDialog.dart @@ -27,6 +27,8 @@ Future criarLista(BuildContext context, itens = lista.itens; + _controllers = []; + itens!.map((item) { var controllerNome = TextEditingController(); controllerNome.text = (item!.nome ?? ''); @@ -102,19 +104,6 @@ Future criarLista(BuildContext context, itens!.add(ItemModel()); _controllers.add(new TextEditingController()); }); - - // bool succes = await listaController.saveLista(); - - // if (succes == true) { - // var nav = Navigator.of(context); - // nav.pop(); - - // if (lista?.id != null) { - // //nav.pop(); - // nav.pop(); - // } - // fecharDialog!(); - // } }, ), ), @@ -126,8 +115,13 @@ Future criarLista(BuildContext context, clicar: () async { List? listaitens = []; - _controllers.map((item) { - listaitens.add(ItemModel(nome: (item.text))); + _controllers.asMap().entries.map((item) { + listaitens.add( + ItemModel( + nome: (item.value.text), + concluido: false, + id: itens![item.key]!.id), + ); }).toList(); listaController.listaItens(listaitens); diff --git a/lib/components/dialogs/listas/listaDialog.dart b/lib/components/dialogs/listas/listaDialog.dart index 2fb0f7a..e404476 100644 --- a/lib/components/dialogs/listas/listaDialog.dart +++ b/lib/components/dialogs/listas/listaDialog.dart @@ -33,7 +33,8 @@ Future visualizarLista(BuildContext context, child: Form( key: listaController.formKey, child: Container( - height: MediaQuery.of(context).size.height, + // height: MediaQuery.of(context).size.height * + // lista.itens!.length, margin: const EdgeInsets.only(top: 24), child: DialogPersonalizado( nome: lista.nome ?? '', @@ -51,17 +52,29 @@ Future visualizarLista(BuildContext context, ); return Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, children: [ - Checkbox( - value: lista.itens![index]!.concluido, - onChanged: (bool? value) async { - setState(() { - lista.itens![index]!.concluido = value!; - }); - itemController.itemId(item.id); - await itemController.concluirItem( - lista.itens![index]!.concluido); - }, + Padding( + padding: const EdgeInsets.only(bottom: 1.0), + child: Checkbox( + //tristate: true, + activeColor: Color( + int.tryParse(lista.cor ?? '') ?? + 0xFF6385C3), + side: const BorderSide( + width: 2, color: Colors.black), + value: lista.itens![index]!.concluido, + onChanged: (bool? value) async { + setState(() { + lista.itens![index]!.concluido = + value; + }); + itemController.itemId(item.id); + await itemController.concluirItem( + lista.itens![index]!.concluido); + }, + ), ), Padding( padding: const EdgeInsets.only(bottom: 16),