Flutter Tutorial: Building An Expense Manager App – 1

In this Flutter tutorial series, we will be building an expense manager app from scratch. If you have never developed any apps with Flutter, start here!


This is the first part of our series “Building An Expense Manager App In Flutter“. The series is aimed towards introducing all the important concepts for building production ready Flutter applications.

If you have never developed any apps on Flutter before, this tutorial will help you get started and put you to speed. Even if you have already been working with Flutter for a while, you can learn about advanced topics in Flutter here.

Topics Covered By This Advanced Flutter Tutorial

  • Essential Flutter widgets
  • Styling widgets
  • State management with Inhertied widgets
  • Working with async data and stream builders
  • Offline Database
  • JSON serialization with built value
  • BLoC pattern implementation
  • etc. etc. and etc.

Prerequisites For Building First Flutter App

Before beginning this series, it is assumed that you are familiar with basic concepts of object oriented programming. All Flutter related prerequisites will be addressed on this series itself, either via describing them here or by providing links for further reading.

App For iOS Or Android

We can build apps for both iOS and Android with Flutter. However, to build iOS apps, you will need a mac computer. You can connect your phone directly or setup an emulator/simulator for testing the development.

In this series, we will assume you are on Android. But even if you are developing for iOS, the steps described here are pretty much same for both the platforms.

Expense Manager App Features

So what will we be building here?

We will build an app that will help us keep track of our expenses. We all know how important it is to keep those expenses in check right 😉

This is a list of features that we would like to have in our Flutter app.

Category Related

As a user I should be able to:

  • Create new Expense Categories.
  • Update Expense Categories.
  • Delete Expense Categories.
  • Set Icon for Category.

Expense Related

As a user I should be able to:

  • Add expense under a category for selected date.
  • Enter expenses for past dates.
  • Edit created expenses.
  • Delete expenses.

Reporting Related

As a user I should be able to:

Become A Flutter Expert With This Course

  • View total expenses for each category.
  • View total expenses for a given date range.

Setup Your First Flutter App

Once you have Flutter installed on your machine, run the following command in the terminal.

The command creates a Flutter project directory called expense_manager that contains a simple demo app.

Enter into the project directory and run the application.

The command launches Flutter app on your connected device.

Flutter Template Project
Flutter Template Project

Now, open the project folder in your favorite code editor and let’s start building the expense manager app with Flutter!

Start Development

In the lib\main.dart file, you will find the boiler plate code created by Flutter. Delete everything from this file and replace with:

The void main function is the main function from where a Dart application begins to execute. If you run the app right now, you will see nothing but a blank app. This is because we have not added any widgets here.

Widgets In Flutter

Similar to React and React Native applications, in Flutter everything is a widget. You place one widget inside another creating a hierarchy of widgets. They describe how the user interface view should look like.

Checkout Flutter v/s React Native

In Flutter, widgets can be Stateful or Stateless. A Stateful widget can rebuild it’s UI based on the state of data that it contains.

Let’s create a widget for our app.

The MyApp class extends from StatelessWidget so it must override the widget’s build method. Every widget receives a BuildContext in it’s build method which represents the context in which the widget is building.

With the help of BuildContext, a child widget can receive data of the parent widget without having to pass parameters around.

Build Context In Flutter
Build Context In Flutter (Image Src: Medium

Ok, back to development.

Adding A MaterialApp Widget

Next, we will create another widget for the dashboard of the application. We will wrap that widget by a MaterialApp widget so that the app can inherit Material designs.

A Materail App
A Materail App

We are using the default theme provided by Flutter for this application. Now that we have a dashboard page to work upon. Let’s add some UI components here.

So what will we have in the dashboard page? At the bare minimum, we would probably have following UI components in our Flutter app:

  • List of expenses added for current day.
  • A date picker to change selected date.
  • An icon button to add new expense.
  • Links to expense categories and view reports.

Designing Dashboard Page Of Expense Manager

For navigation from the dashboard screen, we will use a tab bar. So, let’s set it up.

Setup A Tab Controller

When working with tabs, we will basically have three things:

  • Icons to represent tabbed pages – TabBar widget
  • Controller to load tabbed pages – TabController widget
  • Tabbed pages – TabBarView widget

To add a tab bar, let’s first convert the HomePage widget into a Stateful widget.

A tab controller requires a TickerProvider in it’s constructor for tab animation. For this, we will need to implement the SingleTickerProviderStateMixin mixin.

So, let’s make the changes required:

We have initialized a tab controller. Next, let’s setup a simple tabbed page for the application.

Tab Controller In Flutter
Tab Controller In Flutter

Wrapping Up Part 1 Of Tutorial

In this post, we have introduced the scope of our flutter tutorial. We identified what we will be building and also mentioned what you can expect from the end of this tutorial.

So far we have just created a basic tabbed page application. Let’s continue further development in the next articles.

Part 2

About the author