Mobile

Flutter: How to center the appBar title on Android

Updated: February 4, 2023 By: Augustus

In Flutter, the appBar title on Android is on the left side by default. You can center it by setting the centerTItle property to true, like this: Example: Output: Hope this helps. Further reading: You can…

How to validate email in Flutter without plugins

Updated: January 30, 2023 By: Hadrianus

This article shows you an elegant method to validate email in Flutter. We’ll use the RegExp class of dart:core for working with regular expressions. The email pattern: The Code Create a new Flutter project and replace…

Flutter CupertinoSlider Example

Updated: May 27, 2023 By: Augustus

This article walks you through a complete example of using CupertinoSlider, an iOS-style widget in Flutter that lets the user select from a range of number values. A Prefatory Note A CupertinoSlider widget requires 2 parameters:…

Flutter: A dismissed Dismissible widget is still part of the tree

Updated: February 15, 2023 By: Augustus

This article shows you how to solve a problem when working with the Dismissible widget in Flutter. The Problem When working with the Dismissible widget in Flutter, you may fall into this error: Why does it…

Flutter: Swipe to remove items from a ListView

Updated: February 4, 2023 By: Napoleon

In this tutorial, we’ll build a small Flutter project that contains a ListView to show some fiction products. When the user swipes an item from the list, they can remove it. Overview Which widgets we will…

Flutter: Import only 1 class from a file contains multi classes

Updated: February 14, 2023 By: A Goodman

In Dart and Flutter, if you want to import only one class from a file that contains multiple classes, just use the show keyword. The example below will help you understand this better. Example Let’s say…

Flutter: Search field with magnifying glass inside

Updated: February 5, 2023 By: Augustus

The following examples show you how to create search fields with magnifying glass icons inside in Flutter. Example 1 (Simple) The code: Output: Example 2: Shows the magnifying glass when the field gets focused The code:…

Working with Positioned widget in Flutter

Updated: March 24, 2023 By: Augustus

The Positioned widget in Flutter is used to place a child of a Stack widget in a particular place. Its properties (top, left, right, bottom) can be positive or negative. Examples Example 1 This example creates…

Flutter: Hide current SnackBar before its duration ends

Updated: February 15, 2023 By: Hadrianus

TL;DR You can hide the current SnackBar before the end of its duration by using: This technique is useful in some cases, such as: Complete Example App Preview The sample app we are going to build…

How to draw Bar Charts with fl_chart in Flutter

Updated: February 6, 2023 By: Hadrianus

This article shows you how to draw some simple bar charts in Flutter with fl_chart, one of the most popular chart plugins these days. Installation 1. Install the latest version of fl_chart by running the command…

How to add a TabBar to the AppBar in Flutter

Updated: February 15, 2023 By: Napoleon

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

Updated: February 4, 2023 By: Napoleon

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…

1 33 34 35 36 37 46