refresh checklist page

This commit is contained in:
andrei 2021-11-03 18:45:37 -04:00
parent 65636ee956
commit a7f4838ce9
1 changed files with 35 additions and 29 deletions

View File

@ -45,8 +45,8 @@ class _CheckList extends State<CheckList> {
@override
void initState() {
_loadList();
_loadListData();
_loadList();
super.initState();
}
@ -70,35 +70,41 @@ class _CheckList extends State<CheckList> {
]
: [],
),
body: ListView.builder(
itemCount: list.length,
itemBuilder: (context, index) {
return Card(
child: CheckboxListTile(
title: TextFormField(
enabled:
(listData != null && (!listData!.isTemplate! || _editable)),
decoration: InputDecoration(border: InputBorder.none),
initialValue: list[index].text,
onChanged: (value) {
list[index].text = value;
_updateItem(list[index]);
},
),
controlAffinity: ListTileControlAffinity.leading,
value: list[index].value,
onChanged:
(listData != null && (!listData!.isTemplate! || _editable))
? ((value) {
_updateItem(list[index]);
setState(() {
list[index].value = value!;
});
})
: null,
),
);
body: RefreshIndicator(
onRefresh: () async {
_loadListData();
_loadList();
},
child: ListView.builder(
itemCount: list.length,
itemBuilder: (context, index) {
return Card(
child: CheckboxListTile(
title: TextFormField(
enabled: (listData != null &&
(!listData!.isTemplate! || _editable)),
decoration: InputDecoration(border: InputBorder.none),
initialValue: list[index].text,
onChanged: (value) {
list[index].text = value;
_updateItem(list[index]);
},
),
controlAffinity: ListTileControlAffinity.leading,
value: list[index].value,
onChanged:
(listData != null && (!listData!.isTemplate! || _editable))
? ((value) {
_updateItem(list[index]);
setState(() {
list[index].value = value!;
});
})
: null,
),
);
},
),
),
floatingActionButton: FloatingActionButton(
onPressed: () {