Using Inherited Widgets and Gesture Detectors in Dart's Flutter Framework

in #utopian-io6 years ago (edited)

What Will I Learn?

  • You will learn how to reason about a Flutter Widget Tree
  • You will learn how to make use of the Inherited Widget class in Flutter
  • You will learn how to use a Gesture Detector in Flutter
  • You will learn how to use the context of an application to get its state

Requirements

Difficulty

  • Intermediate

Description

In this video tutorial, we look at inherited widgets, the widget tree and gesture detectors in Flutter. Inherited widgets are a idiomatic way of proliferating state, data and actions from one area of the application widget tree to another. They expose their information to the inheriting children widgets as public variables which can be access through the build context object. When an inherited widget's state changes, it calls for the consumer child widget to re-render in the tree which can help us save on performance when we have multiple widgets that share the same state.

Gesture detectors are widgets that detect gestures through the use of gesture recognizer functions. These recognizer functions are callback functions and the behavior of the gesture detector is based on which of these call backs are not null. The gesture detector listens for a stream of data which represent semantic actions such as taps, drags and panning. Based on the actions and the data that is presented to the gesture detector, the widget decides which function to use through various different rules.

All flutter objects are considered widgets. In this way, a flutter application is represented through a tree of widgets. Even the objects that have no form are considered widgets in the flutter application. Optimization of the widget tree can be helpful to make it easy to maintain a flutter application as well as increase the performance of this application.

The source code for this project can be found here

Video Tutorial

Curriculum



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Hey @tensor I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

As always, thanks for moderating my content.

Coin Marketplace

STEEM 0.30
TRX 0.12
JST 0.033
BTC 64534.17
ETH 3150.15
USDT 1.00
SBD 4.01