Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

want some extra space while scroll list to bottom so that floatingactionbutton does not overview on list last item?

I have a list.generate and a floating action button,

here my list showing all transactions , but facing a problem that when I scroll down to last transaction, I can’t see right side of transaction as floating action button coming on transaction card

so I want a more some space only while I reach at bottom of list..

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

here is my simple code

class ShowTransactionWidget extends StatelessWidget {
  final List<Transaction> mylist;

  ShowTransactionWidget({required this.mylist});

  //Todo add little bit more space while scrolling


  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      children: [
        Padding(
          padding: EdgeInsets.only(left: 20, right: 20),
          child: Column(
            children: List.generate(mylist.length, (index) {
              return Column(
                children: [
                  TransactionCard(transaction: mylist[index],),
                  const Padding(
                    padding: const EdgeInsets.only(left: 20.0, top: 8.0),
                    child: Divider(
                      thickness: 0.9,
                    ),
                  )
                ],
              );
            }),
          ),
        ),
      ],
    );
  }

}

I have attached an image regarding itenter image description here

>Solution :

You can add another widget on Column based on last index like

children: List.generate(mylist.length, (index) {
  return Column(
    children: [
      .....
      if (index == mylist.length - 1)
        SizedBox(
          height: 20,
        ),
    ],
  );
}),

Based on your UI. I will prefer using ListView.separated and ListView provides padding.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading