Using this delegate we can define the max-width and height of the child widget in the grid. It takes int as value.Ĭhild: Text("1", style: TextStyle(color: Colors.white,fontSize: 30),),Ĭhild: Text("2", style: TextStyle(color: Colors.white,fontSize: 30),),Ĭhild: Text("3", style: TextStyle(color: Colors.white,fontSize: 30),),Ĭhild: Text("4", style: TextStyle(color: Colors.white,fontSize: 30),), Let’s see them with an example.ĬrossAxisCount : It is used to define the number of columns we want to display in the grid view. It has 5 properties that control the layout of the children. The column count will not change even for devices with more screen width. SliverGridDelegateWithFixedCrossAxisCountĪs the name suggests we can define the crossAxisCount which is nothing but the number of columns in a row. We can use SliverGridDelegateWithFixedCrossAxisCount or SliverGridDelegateWithMaxCrossAxisExtent as value. A delegate that controls the layout of the children within the GridView. It takes sliverGridDelegate object as the value. The important properties of a GridView are : GridDelegate: SliverGridDelegateWithFixedCrossAxisCount( It controls the layout of the child widgets of the grid view. It has one required property which is gridDelegate. We can create a grid view in flutter by calling the constructor of GridView class and providing it with required properties. We will also learn how to customize the widget using different properties. In this tutorial, we will learn how to use a GridView widget in flutter with example. The most common usage of GridView is the gallery app on our mobiles. ![]() ![]() Since it is a scrollable widget we have to specify the scroll direction (horizontal/vertical).įlutter provides a widget called GridView which allows us to add a grid view to our flutter application. We can use any widget to display as a child instead of images. Generally, images or images & text are used as children for a grid view. It allows us to view multiple items in the same screen space as it is a scrollable widget. For example, using grid view we can display products in 2 dimension in e-commerce applications. Gridview in flutter is a widget used to display other widgets in rows and columns. 11 GridView.custom Example In Flutter Flutter GridView
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |