5 Flutter Widgets That Every App Developer Needs to Know
Published: 2022-04-25 09:15:56


## **5 Flutter Widgets That Every App Developer Needs to Know**

***Flutter is Google’s UI toolkit for creating beautiful Android and iOS apps from a single codebase. It’s an emerging technology in app development.***

***But do you know what Flutter widgets are, why they are everywhere, and what are the basic widgets you need to know before starting your flutter app development?***

***If not, this article will help you to find out everything about Flutter widgets.***

![](https://cdn-images-1.medium.com/max/2560/0*hvP2VCKsnz6MIlC-)

## **About Flutter Widgets?**

***Widgets are the basic building blocks of the Flutter application that define the look and the feel of your app according to its configurations and states. Therefore, the view of the flutter application completely depends on which widgets you use and their sequence in the app.***

When the state of the widget changes, it rebuilds its description. This description is further distinguished by the framework from the previous description. It is done to determine the minimum state changes required for the base rendering tree to move from one state to another.

There are multiple Flutter widgets such as flutter text widget, flutter container widget, flutter row, and column widget, and so on. You can easily find Flutter widgets based on their category (Flutter widgets are classified [into 14 basic categories](https://flutter.dev/docs/development/ui/widgets)).

Let’s dive deep into some of the powerful Flutter widgets that every Flutter developer should know.

1. **Flutter [SafeArea ](https://api.flutter.dev/flutter/widgets/SafeArea-class.html)widget**

Flutter SafeArea widget prevents its child widgets from interfering with the operating system elements by adding sufficient paddings, such as the status bar, notch, and bottom iPhone bar.

For example, this will indent the child enough to avoid the status bar at the top of the screen.

It will also indent the child by the amount necessary to avoid The Notch on the iPhone X or other similar creative physical features of the display.

Displaying the child widget without SafeArea looks like this.

    // Using SafeArea Widget to display text properly
    SafeArea(
      left: true,
      top: true,
      right: true,
      bottom: true,
      child: Text('My Widget: ...'),
    ),

2. **Flutter [Future Builder](https://api.flutter.dev/flutter/widgets/FutureBuilder-class.html) and [Stream Builder](https://api.flutter.dev/flutter/widgets/StreamBuilder-class.html)**

***Future ***(async operation in a Dart) must be obtained earlier. It must not be created during the ***State.build*** or ***StatelessWidget.build*** method call, while constructing the ***FutureBuilder***. If the ***Future ***is created at the same time as the ***FutureBuilder,*** the asynchronous task will be restarted every time the FutureBuilder’s parent is rebuilt.

***FutureBuilder*** is needed if you want to show the widgets only after ***Future*** is resolved, it allows you to show a widget based on a Future state.

    FutureBuilder(
      builder: (ctx, snapshot) {
        ... some code here
            
        // Displaying LoadingSpinner to indicate waiting state
        return Center(
          child: CircularProgressIndicator(),
        );
      },
        
      // Future that needs to be resolved
      // inorder to display something on the Canvas
      future: getData(),
    ),

Similar to the Future builder, ***StreamBuilder*** is used for multiple streams rather than a single asynchronous request.

3. **Flutter [Expanded](https://api.flutter.dev/flutter/widgets/Expanded-class.html) widget**

An expanded widget in Flutter is beneficial when we want a child of Row, Column, or Flex to fill the available space along with the main axis. If you wish to expand children’s widgets, the available space is divided among them according to the flex factor.

Expanded widgets work similar to the Flexible widget, but if you want to build a responsive application then it is better to use Flexible widgets.

    // Using Expanded for the second container in the column  
    Expanded(
                child: Container(
                  child: Center(
                    child: Text(
                      'Second widget',
                      style: TextStyle(
                        color: Colors.white,
                      ),
                    ),
                  ),
                  color: Colors.amber,
                  width: 200,
                ),
              ),

4. **Flutter[ Flexible ](https://api.flutter.dev/flutter/widgets/Flexible-class.html)widget**

A flexible widget allows you to control whether the child element should fill the entire space or not with its ***fit ***property in the main axis, but unlike ***Expanded***, a ***Flexible*** widget does not require the child to fill available space.

A Flexible widget must be a descendant of Row, Column, or Flex, and the path from the Flexible widget to the enclosing Row, Column, or Flex must contain ***StatelessWidget*** or ***StatefulWidgets.***

With flexible widgets, you can build responsive applications with the same look and feel across different multiple device sizes.

    Flexible(
              fit: FlexFit.loose,
              child: Container(
                width: 200,
                color: Colors.pink,
                alignment: Alignment.center,
                child: const Text(
                  'Loose',
                  style: TextStyle(fontSize: 20),
                ),
              ),
            ),

5. **Flutter[ Image](https://api.flutter.dev/flutter/widgets/Image-class.html) widget**

The Flutter Image widget is used to display the images. These images can be Network images, Asset images, or any image from memory. For using asset images you need to declare the image folder first. If you are using Network Image use ***LoadingBuilder***, to show the user’s image is loading.

It provides several constructors for the various ways that an image can be specified:

* **new Image**, for obtaining an image from an **ImageProvider**.

* **new Image.asset**, for obtaining an image from an AssetBundle using a key.

* **new Image.network**, for obtaining an image from a URL.

* **new Image.file**, for obtaining an image from a File.

* **new Image.memory**, for obtaining an image from a Uint8List.

Here is an example of how to display an image from the root directory.

    // Display image from assets
    import 'package:flutter/material.dart';
     
    void main() => runApp(MyApp());
     
    class MyApp extends StatelessWidget {
      [@override](http://twitter.com/override)
      Widget build(BuildContext context) {
        return MaterialApp(
          home: Scaffold(
            appBar: AppBar(
              title: Text("Image from assets"),
            ),
            body: Image.asset('assets/images/image1.jpg'), // <---image
          ),
        );
      }
    }

## How can you speed up your Flutter app development with [DhiWise?](https://www.dhiwise.com/?utm_campaign=blog&utm_source=dev.to&utm_medium=cms&utm_term=flutter)

For any development team, on-time app delivery and deployment is a critical aspect that potentially affects overall app success.

This is because, the faster you deliver the code, the earlier you get the feedback from app users, making you realize what the user demands and work in that way.

So, how can you speed up app development and deliver your app faster?

Here you can trust DhiWise- An ultimate world-first ProCode platform that enables you to build enterprise-grade applications in minimal time.

You might be wondering how?

Well, let’s find it out.

## What DhiWise Offers?

[DhiWise Flutter App Builder](https://www.dhiwise.com/flutter/?utm_campaign=blog&utm_source=dev.to&utm_medium=cms&utm_term=flutter) offers advanced features to build scalable and beautiful apps. Some of them are:

 1. Intuitive platform

 2. Figma to Flutter code generator

 3. Support for customization

 4. Action creator

 5. API manager

 6. Collaborative workspace and so on.

Watch out for our YouTube video to know more about Flutter Builder.

👉 [“Introduction to DhiWise Flutter Builder”](https://www.youtube.com/watch?v=JS_dAz7Q5pE&t=6s)

Moreover, working with DhiWise has its own benefits that encourage and empower developers to build a high-quality, customizable app using a single platform.

**Benefits of Investing in DhiWise**

* Accelerates code development and simplifies code maintenance

* Supports cross-platform app building

* Ability to manage animated UI, regardless of complexity

* Seamless logic implementation

* Simplified code sharing and accessibility

* Constant roadmap upgrades

* On-boarding support

***Visit [DhiWise](https://www.dhiwise.com/?utm_campaign=blog&utm_source=dev.to&utm_medium=cms&utm_term=flutter) to explore more and [sign up](https://app.dhiwise.com/sign-up?utm_campaign=blog&utm_source=dev.to&utm_medium=cms&utm_term=flutter) to build your next Flutter app in a few steps.***