Flutter Tutorials

Flutter app development tutorials


flutter – GridView disable scroll

main.dart


import 'package:flutter/material.dart';

void main() {
  runApp(
      MaterialApp(
          theme: ThemeData(primarySwatch: Colors.blue),
          home: Scaffold(
              appBar: AppBar(
                  title: const Text("Flutter - GridView Disable Scroll")
              ),
              body: bodyContent()
          )
      )
  );
}

bodyContent(){
  return GridView.count(
      physics: const NeverScrollableScrollPhysics(), // disable scrolling
      crossAxisCount: 3,
      children: List.generate(125, (index){
        return Card(
            color: Colors.indigo.shade600,
            child: Center(
                child: Text(
                    "${index+1}",
                    style: const TextStyle(
                        color: Colors.white70,
                        fontWeight: FontWeight.bold
                    )
                )
            )
        );
      })
  );
}

More flutter tutorials



About Me

Flutter Developer

Design a site like this with WordPress.com
Get started