Using Gradients, Fractional Offsets, Page Views and Other Widgets in Dart's Flutter Framework

What Will I Learn?

  • You will learn how to make use of the Page View in the flutter framework
  • You will learn how to use Fractional Offsets for aligning items
  • You will learn how to build a Linear Gradient
  • You will learn how to use the decorated box and material widgets

Requirements

Difficulty

  • Intermediate

Description

In this video tutorial, we build out a simple flutter wallpaper or photo gallery application. The basic concept behind this application was to properly demo how to use the page view widget, factional offsets, make linear gradients, and use other widgets like the material widget and the decorated box widget.

In flutter, we have various different scrolling list style widgets to choose from; the grid view, the list view and the page view. The page view is different because it constrains the view-port so that only one of the pages can be on the screen as a focus at a given moment. It also lazily loads the other pages which makes it optimal for applications that use large infinite lists of data.

Linear gradients are a method of mixing multiple colors in a way that flows from one color to the next. These gradients also use a linear function to define how they transition from one color to the next. In flutter, we can supply our linear gradients infinite colors and we must setup where the gradient starts and ends on our screen. In this application, we use this gradient to slightly overlay on top of our wallpapers to give them a little depth.

Factional offsets are positional coordinates similar to normal offsets. The main difference is that a fractional offset uses a smaller number (typically between -1.0 and 1.0) to represent the various areas of the screen. In this way, fractional offsets are more reactive and more useful for applications that must react to different screen sizes.

The source code for this project can be found here

Video Tutorial

Curriculum



Posted on Utopian.io - Rewarding Open Source Contributors

H2
H3
H4
3 columns
2 columns
1 column
5 Comments