2421zeaman
2421zeaman

Reputation: 3

How to add infinite scroll in Flutter?

I am trying to make my tab scrollable such that if I scroll down, new content should be appearing. So I wanted to know that what we can add or what are the improvement needed.

This is my code:

  class ProductList extends StatelessWidget {
  const ProductList({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Wrap(
      direction: Axis.horizontal,
      alignment: WrapAlignment.start,
      crossAxisAlignment: WrapCrossAlignment.start,
      runAlignment: WrapAlignment.start,
      runSpacing: 8.0,
      spacing: 15.0,
      children: List.generate(10, (index) {        
        return SizedBox(
          width: getProportionateScreenWidth(160),
          child: GestureDetector(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              mainAxisAlignment: MainAxisAlignment.start,
              children: [
                AspectRatio(
                  aspectRatio: 1.02,
                  child: Container(
                      padding: EdgeInsets.all(getProportionateScreenWidth(5)),
                      decoration: BoxDecoration(
                        color: kSecondaryColor.withOpacity(0.3),
                        borderRadius: BorderRadius.circular(15),
                      ),
                      child: null),
                ),
                const SizedBox(height: 10),
              ],
            ),
          ),
        );
      }),
    );
  }
}

Upvotes: 0

Views: 284

Answers (1)

Maikzen
Maikzen

Reputation: 1624

This plugin works like you want: Infinite ListView

Upvotes: 1

Related Questions