refresh checklist page
This commit is contained in:
parent
65636ee956
commit
a7f4838ce9
|
|
@ -45,8 +45,8 @@ class _CheckList extends State<CheckList> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
_loadList();
|
|
||||||
_loadListData();
|
_loadListData();
|
||||||
|
_loadList();
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -70,35 +70,41 @@ class _CheckList extends State<CheckList> {
|
||||||
]
|
]
|
||||||
: [],
|
: [],
|
||||||
),
|
),
|
||||||
body: ListView.builder(
|
body: RefreshIndicator(
|
||||||
itemCount: list.length,
|
onRefresh: () async {
|
||||||
itemBuilder: (context, index) {
|
_loadListData();
|
||||||
return Card(
|
_loadList();
|
||||||
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,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
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(
|
floatingActionButton: FloatingActionButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue