How to add a TabBar to the AppBar in Flutter
This short article shows you how to add a TabBar to the bottom area of an AppBar in Flutter with DefaultTabController, TabBar, and Tab. Example Preview We’ll make a small Flutter app that contains 2 screens:…
How to make rounded corners TextField in Flutter
This practical article walks you through a couple of examples that demonstrate how to make rounded-corners text fields in Flutter. Using OutlineInputBorder borderRadius You can create a rounded TextField by setting the borderRadius property of the…
Flutter: Set an image background for a Container
To set an image background for a Container widget in Flutter, we set its decoration property like this: You can use either NetworkImage or AssetImage. If you have the plan to use AssetImage, you need to…
How to implement SimpleDialog in Flutter
Summary This is a short and straight-to-the-point guide to the SimpleDialog widget (that renders a basic material dialog with some options) in Flutter. In general, the SimpleDialog widget isn’t often used directly. Instead, it’s shown by…
Flutter image loading builder example
This article shows you how to use the loadingBuilder property when working with Image.network() in Flutter. Overview When an image takes too much time to load (caused by a bad internet connection, big file size, etc.),…
How to Handle Network Image Loading Error in Flutter
This article shows you how to handle error network images in Flutter. If you use Image.network() to display an online image and that image is broken (404 not found, 403 forbidden, etc.), you can use the…
Flutter: Call a void function from another file
To call a void function from another file in Flutter, there are 2 points you need to know: Example Create a file called test.dart in the lib folder in your Flutter project: Call the doSomething function…
Working with AlertDialog in Flutter
AlertDialog is a built-in widget in Flutter that has an optional title, optional content, and an optional list of actions. In general, the AlertDialog widget is used with the showDialog() function (a built-in function of Flutter)…
Flutter: Using same-name classes imported from different files
To use same-name classes, widgets, or functions imported from different files in a Flutter project without changing their names, you can use the as keyword with a prefix (the name of the prefix is up to…
Working with dynamic Checkboxes in Flutter
When developing real-world applications, you often have to work with dynamic data retrieved from servers or databases. There will be cases where you need to deal with a list where each item in the list will…
Flutter: GridView.builder() Example
If your Flutter app needs to display a grid view of a large or infinite number of items (a list of products fetched from API, for instance) then you should use GridView.builder() instead of GridView(). The…
How to make Comments in Flutter & Dart
This is a concise article about commenting in Flutter and Dart. Single-Line Comment (Format Comment) Just put two slash symbols at the beginning of the line you want to comment out. Multi-Line Comment (Block Comment) Syntax:…