Skip to content

Commit

Permalink
todo Widget patch fixed commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gani2267 committed Jul 26, 2022
1 parent 70d14df commit 48a4cef
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion lib/screens/taskpage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,40 @@ class _TaskPageState extends State<TaskPage> {
),
),
),
Expanded(
child: FutureBuilder(
initialData: [],
future: _dbHelper.getTodo(_taskId),
builder: (context, snapshot){
return ScrollConfiguration(
behavior: ScrollNoGlowBehavior(),
child: ListView.builder(
itemCount: snapshot.data.length,
itemBuilder: (context,index){
return GestureDetector(
onTap: () async {

if(snapshot.data[index].isDone == 0){
await _dbHelper.updateTodoDone(snapshot.data[index].id, 1);
} else {
await _dbHelper.updateTodoDone(snapshot.data[index].id, 0);
}
setState(() {

});
},
child: TodoWidget(
text: snapshot.data[index].title,
isDone: snapshot.data[index].isDone == 0 ? false: true,
),
);
},
));
},
),
),

// code below has error
// Expanded(
// child: FutureBuilder(
// initialData: [],
Expand Down Expand Up @@ -181,7 +215,7 @@ class _TaskPageState extends State<TaskPage> {
// },
// child: TodoWidget(
// text: snapshot.data[index].title,
// isDone: snapshot.data[index].isDone == 0 ? false: true,
// isDone: snapshot.data[index].isDone == 0 ? false: true,
// ),
// );
// },
Expand Down

0 comments on commit 48a4cef

Please sign in to comment.