Compare commits
No commits in common. "14c23baa7589ebf10d995e2bc14f631842e7fa9c" and "a7f4838ce910893c4724ee4ce60c1572bff7e17d" have entirely different histories.
14c23baa75
...
a7f4838ce9
|
|
@ -33,15 +33,6 @@ class _CheckList extends State<CheckList> {
|
||||||
listData = (rows.isNotEmpty) ? data.List.fromMap(rows[0]) : null;
|
listData = (rows.isNotEmpty) ? data.List.fromMap(rows[0]) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _addItem() async {
|
|
||||||
var item = data.Check("", false, listID: listData!.id!);
|
|
||||||
int id = await DBHelper.dbHelper.insertItem(item);
|
|
||||||
item.id = id;
|
|
||||||
setState(() {
|
|
||||||
list.add(item);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void _updateItem(data.Check item) async {
|
void _updateItem(data.Check item) async {
|
||||||
DBHelper.dbHelper.updateItem(item);
|
DBHelper.dbHelper.updateItem(item);
|
||||||
}
|
}
|
||||||
|
|
@ -61,9 +52,8 @@ class _CheckList extends State<CheckList> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return GestureDetector(
|
// TODO: implement build
|
||||||
onTap: () => FocusScope.of(context).unfocus(),
|
return Scaffold(
|
||||||
child: Scaffold(
|
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text((listData != null) ? listData!.name : 'Check List: $id'),
|
title: Text((listData != null) ? listData!.name : 'Check List: $id'),
|
||||||
actions: (listData != null && listData!.isTemplate! && !_editable)
|
actions: (listData != null && listData!.isTemplate! && !_editable)
|
||||||
|
|
@ -102,8 +92,8 @@ class _CheckList extends State<CheckList> {
|
||||||
),
|
),
|
||||||
controlAffinity: ListTileControlAffinity.leading,
|
controlAffinity: ListTileControlAffinity.leading,
|
||||||
value: list[index].value,
|
value: list[index].value,
|
||||||
onChanged: (listData != null &&
|
onChanged:
|
||||||
(!listData!.isTemplate! || _editable))
|
(listData != null && (!listData!.isTemplate! || _editable))
|
||||||
? ((value) {
|
? ((value) {
|
||||||
_updateItem(list[index]);
|
_updateItem(list[index]);
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|
@ -124,14 +114,12 @@ class _CheckList extends State<CheckList> {
|
||||||
..showSnackBar(SnackBar(content: Text("Template is locked")));
|
..showSnackBar(SnackBar(content: Text("Template is locked")));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_addItem();
|
// TODO implment adding items to lists
|
||||||
// TODO switch focus to new card
|
|
||||||
},
|
},
|
||||||
child: const Icon(Icons.check_box_outlined),
|
child: const Icon(Icons.check_box_outlined),
|
||||||
tooltip: "Add Item",
|
tooltip: "Add Item",
|
||||||
),
|
),
|
||||||
floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
|
floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,12 +77,6 @@ class DBHelper {
|
||||||
return db.insert("List", l.toMap());
|
return db.insert("List", l.toMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> insertItem(data.Check item) async {
|
|
||||||
Database db = await database;
|
|
||||||
|
|
||||||
return db.insert("Item", item.toMap());
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<int> updateItem(data.Check item) async {
|
Future<int> updateItem(data.Check item) async {
|
||||||
Database db = await database;
|
Database db = await database;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue