Book Image

Cross-Platform UIs with Flutter

By : Ryan Edge, Alberto Miola
Book Image

Cross-Platform UIs with Flutter

By: Ryan Edge, Alberto Miola

Overview of this book

Flutter is a UI toolkit for building beautiful, natively compiled applications for mobile, web, desktop, and embedded devices from a single code base. With Flutter, you can write your code once and run it anywhere using a single code base to target multiple platforms. This book is a comprehensive, project-based guide for new and emerging Flutter developers that will help empower you to build bulletproof applications. Once you start reading book, you’ll quickly realize what sets Flutter apart from its competition and establish some of the fundamentals of the toolkit. As you work on various project applications, you’ll understand just how easy Flutter is to use for building stunning UIs. This book covers navigation strategies, state management, advanced animation handling, and the two main UI design styles: Material and Cupertino. It’ll help you extend your knowledge with good code practices, UI testing strategies, and CI setup to constantly keep your repository’s quality at the highest level possible. By the end of this book, you'll feel confident in your ability to transfer the lessons from the example projects and build your own Flutter applications for any platform you wish.
Table of Contents (12 chapters)

Creating the Todo application

In this section, we’ll build a Todo application that relies on an InheritedWidget – specifically, InheritedNotifier – to share and modify a list of todos using a ChangeNotifier. You will be able to create a Todo, mark it as completed, or delete it.

The starting point of this section is an application that already contains TodoController, which we will be sharing with our InheritedNotifier. Once we have dealt with InheritedWidget and have a clear understanding of how everything works, we will move on to the Provider exercise.

Using InheritedWidget for state management

Before we begin refactoring our starting application to use InheritedWidget to share data, let’s get familiar with the process of sharing information by forwarding properties down the widget tree.

Starting with property passing

Open the main.dart file; you will discover that we are creating our TodosController and passing it into our TodosApp:

...