Mobile UX Design -ListView, GridView and Gradient

ListView is the Flutter widget commonly used scrolling widget, It displays children one after another in a scrolling page. children scrolling on the main axis and also it has to fill the cross axis of the listview.

If the item value is non-null the item auto adjust in a scrolling way, Specifying an item extension  is more efficient than letting the children determine their own extent because the scrolling machinery can make use of the foreknowledge of the children’s extent to save work

There are four-way to create a ListView

  1. Using Default Constructor
  2. Using ListView.builder 
  3. Using ListView .separated
  4. Using ListView.custom

ListView Creation using default constructor:——-

It takes a list of children of the widget

This is efficient when you have a limited number of a child because all item preloaded in memory 

ListView Creation Using ListView.builder:——-

ListView.builder constructor takes indexedwidgetBuilder which build child dynamically

This is efficient when you have a large number of a child because the builder method execute only for those elements which are showing on the screen

ListView Creation Using ListView .separated:——

ListView.separated constructor takes two parameter 

  1. indexWidgetBuilder:itemBuilder
  2. separaterBuilder

site builder build child on demand and separaterBuilder build separate between the child 

ListView Creation using ListView.custom:——-

Listview, the custom constructor takes silver child delegate which provides the ability to create a custom child model

Child element lifecycle:——

  1. Creation
  2. Destruction


When the child displaying on the screen, called the creation phase


When a child scrolling out of view it automatically destroys and erases from memory


GridView is a widget in a flutter that used to display the element one after another or we can say  that GridView is used to display the child in 2-D Array 

GridView can implement in a various way:—

  1. Using count 
  2. Using builder
  3. Using extent

Using GridView.count()

GridView.count is commonly used way because we have known child-size so developer know about the number of row and column 

Parameters of GridView.count()

  1. crossAxisCount: it is used to declare the number of column in the view 
  2. crossAxisSpacing:- it is used to declare the spacing the between child listed in cross-axis 
  3. mainaxisspacing:- it is used to declare the spacing the between child listed in the main axis 
  4. scrollDirection:- is used to define the scrolling direction of child
  5. reverse:-it reverse the list in the opposite direction
  6. physics:-it used to determine how list behave when we reach start to end 



GridView.builder comes in role when we have large amount of data. the GridView.builder() construct takes SliverGridDelegateWithFixedCrossAxisCount and SliverGridDelegateWithMaxCrossAxisExtent

The common attribute used 

Itemcount:-the number of child you want to display 

gridDelegate:- it determines the grid, its argument should not be null 

itemBuilder:-it is used to create the item that will be displayed on the screen

Note :-t will be called only when the indices >= zero && indices < itemCount.


GridView.extent() is used to customize the view with custom  extent means each tile has maximum tile extent

Linear Gradient

Linear gradient as per name this gradient flows over a simple linear stretch. Over this stretch is a smooth color transition, This  is  used in BoxDecoration for decoration of child, it consists of two main parameters as

  1. Begin       value lie between 0.0 and 1.0
  2. End          value lies between 0.0 and 1.0

Note:- the value is infraction so the same gradient use for varying sized boxes without changing the parameter.

The color describes by the list of color objects, There must be at least two colors in two colors. it specifies the fraction of vector from start to end between 0.0 and 1.0 for each color. if the value will null color uniformly distribution happen.


splashColor: Theme.of(context).primaryColor,

child: Container(padding: EdgeInsets.all(15),
  child: Text(title),
  decoration: BoxDecoration(

    gradient: LinearGradient(colors: [color.withOpacity(.7),color.withOpacity(.5)],
    end:Alignment.bottomRight ),
    borderRadius: BorderRadius.circular(15)

Radial Gradient:—

This is another very important key for designing, This type of gradient changes its color with respect to the center point.

Like linear-gradient, color class contain at least two-color, and values should lie between 0.0 and 1.0


Leave a Reply