Widget inEngTaskBody(BuildContext context) {
return ListView(
scrollDirection: Axis.vertical,
children: <Widget>[
Center(
child: Text(
'General Condition',
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 25,
),
), //Text
), // Center
OutlinedButton(
child: Text(inEngTaskList().genCond[0]),
onPressed: () {},
), //GCbutton1
SizedBox(height: 10),
OutlinedButton(
child: Text(inEngTaskList().genCond[1]),
onPressed: () {},
), //GCbutton2
SizedBox(height: 10),
OutlinedButton(
child: Text(inEngTaskList().genCond[2]),
onPressed: () {},
), //GCbutton3
SizedBox(height: 10),
How do I assign each button an index? Was thinking of using the scrolltoindex() function. I have seen many examples using listview.builder, however, I am making a customized list view. I do not intend to use builder as each button will have a specific task upon onpressed(). Many of the examples are of non-button listview.
Appreciate the help thank you.
This code is to be assigned to the
body: inEngTask(context)
in my main.dart.
Using Bernard Hur's suggestion:

EDIT The texts in each button is stored in a list. If I could index each button, I can create a search bar to compare with the list and scroll to the index of the button. However, I do require some texts as header to some of the buttons, hence the looping listview.builder is a challenge.
