What are Widgets Available in Flutter?
Last Updated :
24 Apr, 2025
Flutter is a mobile app development framework that allows developers to create beautiful and responsive user interfaces with ease. This is made possible through the use of Flutter widgets, which are the building blocks of every Flutter application. In Flutter, widgets are the fundamental building blocks of the user interface. They are a collection of reusable user interface elements that can be combined to create complex layouts and interactions. The power of Flutter widgets lies in their ability to be customized, composed, and animated to create visually stunning and responsive user interfaces.
There are two main types of Flutter widgets - stateful and stateless. Stateless widgets are those that don't change their properties over time and are therefore static. They are typically used for displaying simple information such as text or images. On the other hand, stateful widgets can change their properties and be rebuilt based on those changes. They are typically used for displaying dynamic information and for adding interactivity to the user interface.
Example:
The Layout Tree of the basic app screen using Stateless Widgets.
Dart
import 'package:flutter/material.dart';
class MyStatelessWidget extends StatelessWidget {
final String text;
MyStatelessWidget({this.text});
@override
Widget build(BuildContext context) {
return Container(
child: Text(text),
);
}
}
To use this widget in your app, you can simply create an instance of it and pass in the desired text:
Dart
MyStatelessWidget(text: 'GeeksforGeeks')
Example:
The Layout Tree of the basic app screen using Stateful Widgets.
Dart
import 'package:flutter/material.dart';
class MyStatefulWidget extends StatefulWidget {
@override
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
}
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
int counter = 0;
void incrementCounter() {
setState(() {
counter++;
});
}
@override
Widget build(BuildContext context) {
return Column(
children: [
Text('Counter: $counter'),
RaisedButton(
child: Text('Increment'),
onPressed: incrementCounter,
),
],
);
}
}
To use this widget in your app, you can simply create an instance of it:
Dart
These are some of the most commonly used Flutter widgets:
1. Container Widget
The Container widget is used to create a box-shaped element that can be used to contain other widgets. It can be customized with properties such as padding, margin, border, and background color.
Dart
Container(
padding: EdgeInsets.all(18.0),
margin: EdgeInsets.symmetric(vertical: 18.0),
decoration: BoxDecoration(
border: Border.all(color: Colors.black),
borderRadius: BorderRadius.circular(9.0),
color: Colors.green,
),
child: Text('GeeksforGeeks'),
)
2. Text Widget
The Text widget is used to display text in a Flutter application. It can be customized with properties such as font size, font weight, color, and alignment.
Dart
Text(
'GFG',
style: TextStyle(
fontSize: 26.0,
fontWeight: FontWeight.bold,
color: Colors.black,
),
)
3. Image Widget
The Image widget is used to display images in a Flutter application. It can be used to display both local and network images. The Image widget can also be customized with properties such as size, fit, and alignment.
Dart
Image.asset(
'assets/images/image.png',
width: 175.0,
height: 175.0,
fit: BoxFit.cover,
)
4. Row and Column Widgets
The Row and Column widgets are used to create horizontal and vertical layouts, respectively. They can be used to combine multiple widgets into a single row or column and are useful for creating complex user interfaces. The Row and Column widgets can also be customized with properties such as main-axis alignment and cross-axis alignment.
Dart
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Hello'),
SizedBox(width: 16.0),
Text('World'),
],
)
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Hello'),
SizedBox(height: 16.0),
Text('World'),
],
)
5. ListView Widget
The ListView widget is used to create a scrollable list of widgets. It's commonly used to display large amounts of data in a Flutter application. The ListView widget can be customized with properties such as scroll direction, padding, and item builder.
Dart
ListView.builder(
itemCount: items.length,
itemBuilder: (BuildContext context, int index) {
return ListTile(
leading: Icon(Icons.star),
title: Text(items[index]),
);
},
)
These are just a few examples of the many types of Flutter widgets available for creating beautiful and responsive user interfaces.
Similar Reads
Draggable Widget in Flutter
In Flutter, a Draggable widget can be used to allow users to interact with a widget by dragging it around the screen. To create a Draggable widget, you can use the Draggable class and pass it to a child widget to be rendered, along with a feedback widget that will be displayed while the user is drag
4 min read
Expandable Widget in Flutter
The expandable widgets do not have a fixed size, they expand on the screen according to the available areas on the screen. Due to size constraints, certain widgets can throw rendering errors, so widgets are made expandable. The one use of expandable widgets is cards that include images, texts, and t
3 min read
What is Widgets in Flutter?
Flutter is Google's UI toolkit for crafting beautiful, natively compiled iOS and Android apps from a single code base. To build any application we start with widgets - The building block of Flutter applications. Widgets describe what their view should look like given their current configuration and
5 min read
Animated Widgets in Flutter
The animations are considered hard work and take time to learn. Flutter made it easy with its packages. To animate the widgets without much effort, we can wrap them inside different defined animated widgets in the animate_do package. In this article, we will see how with the animate_do package we ca
4 min read
Flutter - Fade a Widget In and Out
The AnimatedOpacity widget in Flutter allows you to animate the opacity (transparency) of a child widget. You can use it to smoothly fade in or out a widget. In this article, we are going to implement the AnimatedOpacity Widget in Flutter and see the basic syntax of it. A sample video is given below
4 min read
Drawer Widget in Flutter
Drawer widget is used to provide access to different destinations and functionalities provided in your application. It is represented by three horizontal parallel lines on the upper end of the scaffold. It has a horizontal movement from the edge of the Scaffold that navigates the link to different r
5 min read
Flutter - Flexible Widget
Flexible is a built-in widget in flutter which controls how a child of base flex widgets that are Row, Column, and Flex will fill the space available to it. The Expanded widget in flutter is shorthand of Flexible with the default fit of FlexFit.tight. Flexible widget plays a very important part in m
8 min read
Align Widget in Flutter
Align Widget is the widget that is used to align its child within itself and optionally sizes itself based on the child's size. Align Widget is quite flexible and can change its size according to the size of its child. Constructor of Align class: Syntax: Align({Key key, AlignmentGeometry alignment:
2 min read
endDrawer Widget in Flutter
The endDrawer is the panel displayed to the side of the body (Scaffold Widget). It is generally hidden in mobile devices. We can open it by swiping in from right to left, or we can customise it to open on-press of an icon or a button. This widget is similar to the already present Drawer widget in fl
2 min read
Flutter - Folding Cell Widget
Folding Cell is the Flutter Widget that can be fold and unfold, It uses the frontWidget to show the front data, and the innerWidget to show the hidden data. Hidden is shown when the Folding cell is unfolded. When the widget is unfolded the innerWidget renders its data. When the widget is folded the
3 min read