I have a checklist with questions and when I check a question I want to scroll to next question. How will be this possible in Flutter ? Or what widget should I use ? Or maybe is there a library which is already doing exactly what I need ?
Any help or suggestion will be really apreciated !
Here is my code:
Widget _buildBody() {
var dbHelper = DBHelper();
return ListView.builder(
padding: EdgeInsets.all(10),
itemCount: 1,
itemBuilder: (BuildContext context, int index) {
return Card(
child: Column(
children: questionsList
?.map(
(question) => Row(
children: [
Expanded(
flex: 4,
child: Text(
"${question.questionNumber}. ${question.questionDescription}",
style: TextStyle(fontSize: 20),
),
),
Expanded(
flex: 1,
child: IconButton(
icon: Icon(Icons.check_circle_outline),
color: question.questionAnswer == 1
? Colors.green
: Colors.grey,
iconSize: 60,
onPressed: () {
setState(
() {
question.questionAnswer = 1;
dbHelper.updateQuestion(question);
print('Yes');
},
);
},
),
),
Expanded(
flex: 1,
child: IconButton(
icon: Icon(Icons.close),
color: question.questionAnswer == 0
? Colors.red
: Colors.grey,
iconSize: 60,
onPressed: () {
setState(
() {
question.questionAnswer = 0;
dbHelper.updateQuestion(question);
print('No');
},
);
},
),
),
],
),
)
?.toList() ??
[],
),
);
},
);
}
Thanks in advance !