Reputation: 757
I am confused about using the widget that is most appropriate for this display
Upvotes: 1
Views: 550
Reputation: 1402
You can use a ListView
widget this is best for this. like so
Scaffold(
appBar: AppBar(title: Text('Something'),),
body: ListView(
children: <Widget>[
buildListTile(Icons.phone, 'Telepon', "Kode verfikasi akan dikirim melalui telepon", Icons.arrow_forward_ios),
Divider(), // <-- this is added
buildListTile(Icons.chat_bubble, 'SMS', "Lorem ipsum dolor sit amet, consectetur", Icons.arrow_forward_ios),
Divider(), // <-- this is added
],
),
)
);
}
ListTile buildListTile(leadingIcon, titleText, subtitleText, trailingIcon) {
return ListTile(
leading: Icon(leadingIcon),
title: Text(titleText),
subtitle: Text(subtitleText),
trailing: Icon(trailingIcon),
);
}
Upvotes: 1
Reputation: 29468
You can use ListTile
for each element and Divider
between them
ListView.builder(
itemBuilder: (context, i) {
if (i.isOdd)
return Divider();
final index = i ~/ 2;
return buildRow(index);
},
itemCount: [your_items].length * 2,
controller: controller,
);
Widget buildRow(int index) {
return ListTile(
leading: /* your icon */,
title: /* title */,
subtitle: /* subtitle */,
trailing: /* right arrow */,
)
}
Upvotes: 4