Table of contents
1.
Introduction
2.
Flutter
3.
Icon Widget Properties
4.
Syntax
5.
Example
6.
Frequently Asked Questions
6.1.
What is Flutter, and why it is used?
6.2.
Is Flutter a programming language?
6.3.
Why is flutter so popular?
6.4.
To utilize Flutter, how much programming expertise do I need?
6.5.
What types of apps can I create with Flutter?
7.
Conclusion
Last Updated: Mar 27, 2024

Flutter Icons Class

Author Komal Shaw
0 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

A graphic image representing a program or any specific thing with meaning for the user is known as an icon. It can be both selected and inaccessible. The company's logo, for example, is not selectable. It may also provide a link to another page. It also serves as a symbol in lieu of a full description of the actual entity.

Flutter

To build icons in our apps, Flutter includes an Icon Widget. Flutter allows us to build icons using either built-in or custom icons. The Icons class in Flutter gives a list of all icons. We'll learn how to use Flutter icons in the application in this tutorial.

Icon Widget Properties

Properties

Description

icon It is used to set the name of the icon that will appear in the program. Material design icons are symbols for typical actions and items used by Flutter.
color It is used to specify the color of the icon.
size It is used to specify the size of the icons in pixels.
textDirection It is used to specify in which direction the icon will be rendered.

 

Syntax

The Flutter icon class is used to display various icons in our app. We may utilize the Icon class to incorporate an icon into our app instead of developing an image for it. You must ensure that you have established uses before using this class. -material-design: true in your object's pubsec.yml file.

 

Syntax:

Icon(
      key key,
      size,
      color,
      semanticLabel,
      textDirection
)

Example

Flutter application with three icon widgets.

 

import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// main application widget
class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);
  static const String _title = 'Flutter Application';
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: _title,
      home: Scaffold(
        appBar: AppBar(title: const Text(_title)),
        body: const MyStatelessWidget(),
      ),
    );
  }
}
/// stateless widget that the main application instantiates
class MyStatelessWidget extends StatelessWidget {
  const MyStatelessWidget({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.stretch,
      children: const <Widget>[
        Icon(
          Icons.audiotrack,
          size: 100.0,
          color: Colors.green,
        ),
        Icon(
          Icons.account_balance,
          size: 100.0,
          color: Colors.red,
        ),
        Icon(
          Icons.airplanemode_active,
          size: 200.0,
          color: Colors.deepPurple
        ),
      ],
    );
  }
}

Output:-

Source

 

Frequently Asked Questions

What is Flutter, and why it is used?

Flutter is a portable UI toolkit from Google that lets you create attractive natively built apps for mobile, web, and desktop from a single codebase. Flutter is free and open-source, and it works with existing code. It is utilized by developers and organizations all over the world.

Is Flutter a programming language?

Flutter, on the other hand, is not a programming language. It's a prewritten software development kit (SDK) that includes ready-to-use and customizable widgets and libraries, tools, and documentation, all of which help developers create cross-platform apps.

Why is flutter so popular?

The majority of businesses are now enthused about Flutter. It's because a single codebase can be used to create apps for Android, iOS, Windows, Mac, Linux, and the web. Despite its rapid development and versatile user interface, many developers prefer React Native..

To utilize Flutter, how much programming expertise do I need?

Flutter is accessible to programmers familiar with object-oriented and imperative programming ideas (classes, methods, variables, and so on) (loops, conditionals, etc.).

People with no programming knowledge have been able to learn and utilize Flutter for prototyping and app development.

What types of apps can I create with Flutter?

Flutter is built to handle both Android and iOS mobile apps and interactive apps that you can embed in your websites or run on your desktop. (Windows desktop support is now available on the stable channel; macOS and Linux support is still in beta, although a snapshot of the beta is also accessible on the stable channel.)

Flutter is exceptionally well suited for apps that require highly branded designs. On the other hand, Flutter allows you to develop pixel-perfect experiences that are compatible with both Android and iOS design languages.

Conclusion

In this article we discussed the Flutter Icons Class. We had also seen some examples.

We hope that our blog has helped you enhance your knowledge regarding Flutter Icons Class. Please check out these articles to improve your understanding of Flutter: Flutter TableFlutter TabbarFlutter RichTextFlutter Stateful and Stateless Widgets.
 

Please refer to our guided paths on Coding Ninjas Studio to learn more about DSA, Competitive Programming, JavaScript, System Design, etc. And also, enrol in our courses and refer to the mock test and problems available. Have a look at the interview experiences and interview bundle for placement preparations.
 

Please upvote our blog to help other ninjas grow.

Happy Coding!

Live masterclass