Flutter really shines when it comes to building beautiful UIs.
With Flutter, you build UIs by using widgets and composing them together in a declarative manner. You can think of widgets as UI components that describe what your application looks like.
Flutter offers an extensive set of widgets that closely match the Material Design specification. The Flutter widget catalog also includes Cupertino widgets, which are high-fidelity replicas of all the UI components found on iOS.
Because Flutter controls every pixel on the screen, you can even create your own widgets to deliver a completely custom experience that delights your users.
So, what are some good resources to learn about widgets & layouts?
Getting started with widgets is easy, but after a little while, some questions may pop up in your head:
- What is a
- Should I create new widget classes or create helper methods?
To answer these questions, the Flutter team has created a series on YouTube called Decoding Flutter, and I highly recommend it. It even has dedicated videos for the two questions above:
A good place to start is this official guide about Layouts in Flutter, showing you how to build some common layouts with useful illustrations.
- Flutter Widget of the week: This is truly an amazing video series from the Flutter team. Most videos are 1-to-2 minutes long and help you learn about the most useful widgets. You don’t need to watch the entire series in one go, but I won’t stop you if you do 😀. And sometimes, knowing that a widget exists means that you don’t have to create one yourself.
In addition to this, I have also made some video walkthroughs of the most useful layout widgets:
- Flutter Layouts Walkthrough: Row, Column, Stack, Expanded, Padding
- Flutter Layouts Walkthrough: PageView, ListView, GridView, Slivers, CustomScrollView
And if you want to create more complex layouts with a lot of scrollable elements, my slivers tutorials have you covered:
- Flutter Slivers Overview: SliverAppBar, SliverPersistentHeader
- Flutter Slivers Overview: SliverList, SliverGrid, SliverToBoxAdapter, SliverFillRemaining
All the links above are enough to build common layouts on mobile.
But sooner or later, you may encounter some layout errors (bottom overflow, anyone? 😅). To get past that, I highly recommend this guide, which explains how constraints work in Flutter:
Once you need to support multiple form factors, you’ll need to learn about responsive layouts and how to implement them in Flutter.
For that, I recommend this tutorial:
I have also created a detailed tutorial explaining how to create a split view on large screens and drawer navigation on mobile:
Once you have covered the basics and want to tackle complex responsive layouts, then it’s advisable to look for packages that can do some of the heavy lifting for you. Here are a couple of good ones:
Want to go beyond this and build apps that are truly adaptive and consider multiple input devices (mouse, keyboard)?
Here’s an in-depth guide:
Daily Challenge - Build a Flutter layout
If you’re looking for the basics, here’s a step-by-step tutorial on how to build a basic layout:
Once you’re comfortable with the basics, you can level-up and take a bigger UI challenge.
For example, here’s a sample design for a point-of-sale tablet UI:
Try working out what is the layout hierarchy of this design. Create some custom widget classes for all the UI elements that you can identify, and compose them together to form the entire UI.
And why not upload your project on GitHub and share it with others?