Skip to content

Commit

Permalink
lISTA
Browse files Browse the repository at this point in the history
  • Loading branch information
wjrcode committed Oct 15, 2022
1 parent b2fa4e1 commit 6fdf5a0
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 28 deletions.
4 changes: 2 additions & 2 deletions lib/Model/API/APIModel.dart
Original file line number Diff line number Diff line change
@@ -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<String, String> headers = {
"Content-Type": "application/json",
Expand Down
24 changes: 9 additions & 15 deletions lib/components/dialogs/listas/listaCadastroDialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Future<dynamic> criarLista(BuildContext context,

itens = lista.itens;

_controllers = [];

itens!.map((item) {
var controllerNome = TextEditingController();
controllerNome.text = (item!.nome ?? '');
Expand Down Expand Up @@ -102,19 +104,6 @@ Future<dynamic> 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!();
// }
},
),
),
Expand All @@ -126,8 +115,13 @@ Future<dynamic> criarLista(BuildContext context,
clicar: () async {
List<ItemModel?>? 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);
Expand Down
35 changes: 24 additions & 11 deletions lib/components/dialogs/listas/listaDialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ Future<dynamic> 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 ?? '',
Expand All @@ -51,17 +52,29 @@ Future<dynamic> 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),
Expand Down

0 comments on commit 6fdf5a0

Please sign in to comment.