0

I created this using two columns and split the list into two parts. But it got so ugly. Any suggestions on how I can create something like this more elegantly?

ListView of cards with differents heights

1

1 Answer 1

2

You can use flutter_staggered_grid_view with QuiltedGridTile

class TAA extends StatelessWidget {
  const TAA({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: GridView.custom(
        gridDelegate: SliverQuiltedGridDelegate(
          crossAxisCount: 2,
          mainAxisSpacing: 4,
          crossAxisSpacing: 4,
          repeatPattern: QuiltedGridRepeatPattern.inverted,
          pattern: [
            QuiltedGridTile(2, 1),
            QuiltedGridTile(1, 1),
          ],
        ),
        childrenDelegate:
            SliverChildBuilderDelegate((context, index) => Container(
                  color: Colors.red,
                )),
      ),
    );
  }
}

enter image description here

You can decorate the way you want.

Sign up to request clarification or add additional context in comments.

1 Comment

If you need to reduce item height, increase crossAxisCount: 4, and for this pattern:[ QuiltedGridTile(2, 2), QuiltedGridTile(1, 2),] needed to maintain. Check more on doc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.