Flutter minus icon

Flutter Minus Icon

In Flutter, you can use the built-in Icons class to display various icons, including the minus icon. The minus icon represents subtraction or reducing a value.

Icon Widget

The Icon widget in Flutter is used to display icons. To use the minus icon, you can use the following code:

    
      Icon(
        Icons.remove,
        color: Colors.black,
        size: 24,
      )
    
  

In the above code, we provide the `Icons.remove` as the icon, which represents the minus sign. We also specify the color of the icon as black and the size as 24 pixels. You can modify the color and size according to your requirement.

Example Usage

Here’s an example of using the minus icon in a button:

    
      RaisedButton.icon(
        onPressed: () {
          // Perform subtraction operation
        },
        icon: Icon(
          Icons.remove,
          color: Colors.white,
          size: 18,
        ),
        label: Text(
          'Subtract',
          style: TextStyle(color: Colors.white),
        ),
        color: Colors.blue,
      )
    
  

In this example, we use the `RaisedButton.icon` widget to create a button. The minus icon is set as the button’s icon using the `Icon` widget. The label of the button is set as “Subtract” with white text color. The button has a blue background color. On pressing the button, you can perform subtraction or any other related operation.

You can place the above code snippets in a suitable Flutter widget such as `Scaffold` or `Container` to see the minus icon in action.

Leave a comment