Photo by Sonika Agarwal on Unsplash

The GridTile in Flutter is a subclass of Stateless Widget, which is a scrollable grid of tiles. And GridTile typically uses GridTileBar Widget either in header or footer. Not both, at the same time.

Also GridTile must have a child. However, the GridTileBar stateless widget that returns an IconButton widget.

Suppose we're going to build a book buying e-cart flutter app.

In such a scenario, we can have a scrollable grid of tiles that will place the Book items first. Next, moreover, on each book image we can have two GridTileBar widgets.

Certainly, without the help of GridView widget, we couldn't make that. So let us start from the Material design section.

Widget build(BuildContext context) {     return ChangeNotifierProvider.value(       value: Books(),       child: MaterialApp(         title: 'Book Shop',         theme: ThemeData(           primarySwatch: Colors.purple,           primaryColor: Colors.deepOrange,         ),         home: const BooksOverviewScreen(),         routes: {           BookDetailScreen.routeName: (ctx) => const BookDetailScreen(),         },       ),     ); } // the code is incomplete for brevity 

As we can see, the Books overview screen displays the book items using three main stateless widgets.

They are GridTile, GridTileBar and GridView.

We're going to the glimpse of the code snippets. For full code, please visit the respective ARTICLE in my website.


This free site is ad-supported. Learn more