How can I have the GridView.builder build from the top when placed in a container in Flutter?
remove its default pading :
GridView.builder(
itemCount: 50,
//add this line ---------<
padding: EdgeInsets.zero,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 5,
),
itemBuilder: (context, index) => Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
color: Colors.orange,
),
),
),
MediaQuery.removePadding(
context: context,
removeTop: true,
child: GridViewContainer(),
)
Add this before GridView