What Will I Learn?
- You will learn how to use flutter expanded widgets to fill out areas
- You will learn how to make use of axis alignment in flutter
- You will learn how to use text styling to manipulate the font properties of text widgets
- You will learn how to make classes that generate widgets to save code
Requirements
- IDEA intellij or Visual Studio Code with the Dart/Flutter Plugins
- The Dart SDK and the Flutter SDK
- A fair understanding of Mobile development and Imperative or Object Oriented Programming
Difficulty
- Intermediate
Description
In this video tutorial, we build out a simple calculator layout using the flutter framework. The purpose of this exercise is to showcase the some of the layout properties in the flutter framework such as the expanded widget, the flex property, cross and main axis alignment and text styling. A calculator is a perfect choice for looking at these types of widgets because it requires the use of multiple rows of buttons and a display. Rather then using a simple grid view widget, we can easily manipulate the spacial relationship of our buttons and display by using a combination of these various different widgets.
The expanded widget is a widget that allows us to directly effect how elements fill the space of a larger widget. We can achieve this by setting up the flex of each of the expanded widgets inside of the parent container. The flex directly allows us to change how much room a child widget will take up inside of that parent widget. We can then fine tune the spacial relationships of these items using the cross and main axis alignment properties. The cross axis is the column reverse axis which runs horizontal to the main axis which is the vertical axis. Flutter's text styling allows us to change the font size, font weight, font color, and a few other properties. We can also add a third party font to the project to further customize our fonts.
We also make use of a class that can help us generate a list of widgets to fit inside of a column. In this way we can programmatically generate the buttons of the calculator by just putting in a character representation for the button. For buttons that use more then one character, we can use a ternary operator to replace the original one character representation for user clarity.
The source code for this project can be found here
Video Tutorial
Curriculum
- Dart Flutter Cross Platform Chat Application Tutorial
- Building a Multi-Page Application with Dart's Flutter Mobile Framework
- Making Http requests and Using Json in Dart's Flutter Framework
- Building Dynamic Lists with Streams in Dart's Flutter Framework
- Using GridView, Tabs, and Steppers in Dart's Flutter Framework
- Using Global Keys to get State and Validate Input in Dart's Flutter Framework
- The Basics of Animation with Dart's Flutter Framework
- Advanced Physics Based Animations in Dart's Flutter Framework
- Building a Drag and Drop Application with Dart's Flutter Framework
- Building a Hero Animation and an Application Drawer in Dart's Flutter Framework
- Building a Temperature Conversion Application using Dart's Flutter Framework
- Using Inherited Widgets and Gesture Detectors in Dart's Flutter Framework
- Using Gradients, Fractional Offsets, Page Views and Other Widgets in Dart's Flutter Framework
Posted on Utopian.io - Rewarding Open Source Contributors