- séparation des taches faite et non,
- rapettisage de la taille des taches
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user