- séparation des taches faite et non,

- rapettisage de la taille des taches
This commit is contained in:
2023-10-10 20:20:27 +02:00
parent 979fcfa2a1
commit 7d391194f5
13 changed files with 141 additions and 42 deletions

View File

@@ -23,7 +23,6 @@ class _MyHomePageState extends State<MyHomePage> {
@override
void initState() {
// TODO: implement initState
// first time
if (_myBox.get('todos') == null) {
db.createInitialData();
@@ -74,17 +73,43 @@ class _MyHomePageState extends State<MyHomePage> {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
centerTitle: true,
),
body: Column(
children: [
Expanded(
child: ListView.builder(
itemCount: db.todoList.length,
itemBuilder: (context, index) {
return db.todoList[index][1] == false
? ToDoTile(
taskName: db.todoList[index][0],
taskCompleted: db.todoList[index][1],
onChanged: (value) => checkBoxChanged(value, index),
deleteFunction: (context) => deleteTask(index),
)
: SizedBox.shrink();
}),
),
Text(
"Tache complété : ${db.todoList.where((element) => element[1] == true).length}"),
//task completed
Expanded(
child: ListView.builder(
itemCount: db.todoList.length,
itemBuilder: (context, index) {
return db.todoList[index][1] == true
? ToDoTile(
taskName: db.todoList[index][0],
taskCompleted: db.todoList[index][1],
onChanged: (value) => checkBoxChanged(value, index),
deleteFunction: (context) => deleteTask(index),
)
: Container();
}),
),
],
),
body: ListView.builder(
itemCount: db.todoList.length,
itemBuilder: (context, index) {
return ToDoTile(
taskName: db.todoList[index][0],
taskCompleted: db.todoList[index][1],
onChanged: (value) => checkBoxChanged(value, index),
deleteFunction: (context) => deleteTask(index),
);
}),
floatingActionButton: FloatingActionButton(
onPressed: createNewTask,
tooltip: 'Increment',