![]() |
VOOZH | about |
A floating action button, commonly abbreviated as FAB, is a primary action button that has a fixed position hovering over an app without altering the contents of the screen. Speed dial is a transition type of FAB, where it emits multiple entities as an action of an FAB on the same screen.
FAB has three parts. They are containers, icons, and text. Based on these parts, FAB is classified into two types.
FAB containers have two default sizes. They are default (56 x 56 dp) and mini (40 x 40 dp). FAB container’s shape or width are of two types.
By default, a basic container is circular, where the icon is placed in the centre.
FAB’s visibility, motion, and even animations are highly customizable, making it quite relevant and easy to access on a screen. As mentioned above, FABs are fixed, but they hover over the content, making it completely out of context from the screen’s content. So, using the relevant FABs for a particular screen is highly recommended.
FABs when clicked perform actions that either happen on the same screen or in a different one. The FAB transitions can be in the following forms:
Speed dial is a transition type of FAB, where a stack of actions emits from an FAB when clicked, in the same screen. These actions are in the form of FABs with icons and labels on them. A speed dial can be achieved by using a plugin/dependency named “flutter_speed_dial”.
Create a new Flutter application using the command Prompt. To create a new app, write the below command and run it.
flutter create app_nameTo know more about it refer this article: Creating a Simple Application in Flutter
To add the dependency to the pubspec.yaml file, add flutter_speed_dial as a dependency in the dependencies part of the pubspec.yaml file, as shown below:
Now run the below command in the terminal
flutter pub getUse the below line of code in the main.dart file, to import the flutter_speed_dial dependency :
import 'package:flutter_speed_dial/flutter_speed_dial.dart';-
-
main.dart:
Note: The onTap: () => print(“Pressed”), command will be executed in the flutter console.