buttonsrtoys
buttonsrtoys

Reputation: 2781

GridView without the scrolling?

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?

Upvotes: 2

Views: 146

Answers (1)

WSBT
WSBT

Reputation: 36373

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

physics: const NeverScrollableScrollPhysics()

Upvotes: 2

Related Questions