GridView without the scrolling?

Viewed 27

I need a simple grid of widgets but without scrolling, similar to how I coded GridView below.

GridView.count(
    padding: const EdgeInsets.all(20.0),
    crossAxisCount: 2,
    crossAxisSpacing: 20,
    shrinkWrap: true,
    // mainAxisSpacing: 20,
    children: [
      _TextField0(focusNode: focusNode),
      _TextField1(focusNode: focusNode),
      _TextField2(focusNode: focusNode),
      _TextField3(focusNode: focusNode),
    ],
  ),
)

Is there a way to disable scrolling in GridView or is there another widget I should be looking at?

1 Answers

Yes, GridView (or ListView) has a parameter for scroll behavior. In your case, simply pass in:

physics: const NeverScrollableScrollPhysics()

Related