简体   繁体   中英

How to place a widget to bottom of page while using listview?

I must use a listview widget to display my widgets. At the bottom of the page there should be a button. Even there is not enough element in the listview the button should be placed to bottom.

I can achieve it by using column and expanded widget but it does not fulfil my needs. I must use a listview. How can I achieve it?

in your list view builder, instead of using 'return' only, use:

if (index != yourlist.length -1) {
  // Not the last list item, so
  // return list item as usual, i.e. your original return statement
} else {
  // Last List Item, so
  // return a column that:
  // First children: last list item
  // Second children: your other widget that you want to put at the bottom
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM