Flutter ElevatedButton Widget

Flutter ElevatedButton Widget

Elevated Button is a Flutter button widget that is simply used to make any action. It is most used flutter widget in any application. The buttons are like building blocks of the apps, without them the flow of the app will not be complete. So usage of flutter buttons plays an important role in any app. The elevated button is a type of flutter button that has a specific properties such as the solid background color, a slight border radius around it to give a defined look and feel. Elevated Buttons are clickable widgets when the button is triggered the specific action is performed.

The GF Flutter Button is a Flutter Elevated button that has a solid background fill color and the button triggers whenever the action is passed into it.

The default GF button shape is set to GFButtonShape.standard so that we will be able to get the standard shaped button with solid background color with slightly rounded corners.

Flutter Elevated Solid Button

By default, button type is set to Flutter Solid ButtonGFButtonType.solid so, we can get buttons that have a solid background color with slightly rounded corners.

The callback is called when the button is tapped. By adding a callback to the onPressed parameter it enables the button.

 import 'package:getwidget/getwidget.dart';

  GFButton(
    onPressed: (){},
    text: "primary",
  ),

Flutter Elevated Disabled Button

Flutter Elevated Disable Button is achieved when the callback and onPressed are null, then the button will be disabled. Default GFButton will be disabled as onPressed is set to null.

import 'package:getwidget/getwidget.dart';

GFButton(
    onPressed: null,
    text: "primary",
 ),

Flutter Elevated Transparent Button

In GFButton by adding type,GFButtonType.transparent we will get the transparent button. Default GFButton type will be GFButtonType.solid.

import 'package:getwidget/getwidget.dart';

GFButton(
    onPressed: (){},
    text: "primary",
    type: GFButtonType.transparent,
 ),

Flutter Elevated Block Button

The Flutter Elevated Block button specifies how wide the button should be. By setting blockButton state,true it will change the button to a full-width block with rounded corners. Default blockButton is set to false.

import 'package:getwidget/getwidget.dart';

GFButton(
    onPressed: (){},
    text: "primary",
    blockButton: true,
 ),

Flutter Elevated Full-Width Button

The Flutter Elevated Full-Width button specifies the button should be in full width of the screen. By setting a fullWidthButton state,true it will change the button to a Full-width button with rounded corners and no border on the left or right side. Default fullWidthButton set to false.

import 'package:getwidget/getwidget.dart';

GFButton(
    onPressed: (){},
    text: "primary",
    fullWidthButton: true,
 ),

Flutter Elevated Button Size

Flutter Elevated Elevated Button size can be varied using the size property, which specifies the size of the button. Default button size set to GFSize.MEDIUM.

import 'package:getwidget/getwidget.dart';

GFButton(
    onPressed: (){},
    text: "primary",
    size: GFSize.SMALL,
 ),

Flutter Elevated Outline Button

The Flutter Elevated Outline Button describes the Button with a transparent background and a visible border. This button can be easily found in GFButton by adding type as GFButtonType.outline.

import 'package:getwidget/getwidget.dart';

GFButton(
    onPressed: (){},
    text: "primary",
    type: GFButtonType.outline,
 ),

Above mentioned properties like size, blockButton, fullWidthButton, enabling and disabling of button works well in Elevated Outline Button also.

Flutter Elevated Outline2x Button

The Flutter Elevated Outline2x Button describes the Button with a transparent background and a visible border with 2x border width. This button can be easily found in GFButton by adding type as GFButtonType.outline2x.

import 'package:getwidget/getwidget.dart';

GFButton(
    onPressed: (){},
    text: "primary",
    type: GFButtonType.outline2x,
 ),

Above mentioned properties like size, blockButton, fullWidthButton, enabling and disabling of button works fine in Outline2x Button also.

FAQ

Q. How to change elevated button background color in flutter?

Elevated button is a flutter button that is simple yet most used widget in any application as when the button is triggered it performs some action. Here, we will be using Elevated button from the getwidget library that has many customisation options to be performed. The user can alter the button according to the need of the application using very less lines of code.

Below is the example of how to change the background color of elevated button in Flutter using the getwidget library.

import 'package:getwidget/getwidget.dart';

GFButton(
    onPressed: (){},
    text: "primary",
    color: GFColors.DANGER,
 ),

Q. How to give color to elevated button in flutter?

Elevated button is used in all the application when the user triggers, it performs the operation. Here, we will be using Elevated button from the getwidget library to change the background color of the button. By using the Getwidget Library we will have very less code lines and it is easy and flexible to use.

import 'package:getwidget/getwidget.dart';

GFButton(
    onPressed: (){},
    text: "primary",
    color: GFColors.SECONDARY,
 ),

Ready to take your Flutter app to the next level? GetWidget's team of expert developers is here to help. Our talented designers and developers can create stunning Elevated Buttons that will set your app apart from the competition. Don't wait any longer - hire Flutter developers today and let us elevate your app's design! Contact us now to get started.

Last Updated: September 21, 2023