How to create a Home Screen grid view menu so that it is swappable and also gridview in flutter, like an example screenshot below.
how to make swapping home screen grid view in flutter
302 Views Asked by Diificult Ranger At
2
There are 2 best solutions below
0
On
use scrollDirection: Axis.horizontal, in gridview
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
class GridViewDemo extends StatefulWidget {
const GridViewDemo({Key? key}) : super(key: key);
@override
State<GridViewDemo> createState() => _GridViewDemoState();
}
class _GridViewDemoState extends State<GridViewDemo> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Flutter GridView Demo"),
backgroundColor: Colors.red,
),
body: Container(
padding: EdgeInsets.all(12.0),
child: GridView.builder(
itemCount: 50,
scrollDirection: Axis.horizontal,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 4.0,
mainAxisSpacing: 4.0
),
itemBuilder: (BuildContext context, int index){
return Image.network("");
},
)),
);
}
}

you can use
PageVieworPageView.builderPageView accepts children, so wrap with it yourgridViewwidgets, set thescrollDirectionto Axis.vertical like :for the indicators you can wrap that
PageViewwith aStackwidget and and add your indicator widget that will be controller by a PageControllerHope it helps