GridView Builder Size issue in Flutter | GridView Height & width Issue in Flutter

researchthinker

GridView Builder Size issue in Flutter Example I

GridView.builder(
            shrinkWrap: true,
            itemCount: 7,
            itemBuilder: (context, index) => InkWell(
              onTap: (){
               //Incase want to click 
              },
              child:Padding(
                padding: const EdgeInsets.all(2.0),
                child: Text("VIEW $index"),
            ),
            gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
              crossAxisCount: 3,
              childAspectRatio: 3,
            ),
          ),

GridView Builder Size issue in Flutter Example II

Another Way to manage Size


SizedBox(
height:100,
child:GridView.builder(
        gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
          crossAxisCount: 2,
          childAspectRatio: MediaQuery.of(context).size.width /
              (MediaQuery.of(context).size.height / 4),
        ),
        itemCount: items.length,
        itemBuilder: (context, index) {
          return GridTile(child: Text(items[index]));
        },
      ),
)

Leave a Reply

Your email address will not be published. Required fields are marked *

web_horizontal
About Us ♢ Disclaimer ♢ Privacy Policy ♢ Terms & Conditions ♢ Contact Us

Copyright © 2023 ResearchThinker.com. All rights reserved.