Flutter IconButton Size
The IconButton class represents a material design icon button. IconButton is a
picture printed on a material widget that reacts to touches by filling with
color. The flutter developers commonly used the Icon buttons in the AppBar
actions field, but IconButtons can be used in many other places as well. The
flutter app developers can leave the onPressed callback null to disable an
IconButton, then it will not react to touch.
The following flutter app development tutorial will demonstrate how to set or change the IconButton widget size. Here we used the IconButton class’s iconSize property to change an IconButton widget’s size.
The flutter developers must not override the icon's size with its Icon.size parameter when creating an IconButton widget. Instead, the flutter developers have to use the IconButton class’s iconSize parameter to set the IconButton widget’s size.
The IconButton class’s iconSize property value is a double instance that defines the size of the icon inside the button. The default size is 24.0.
So finally, the flutter app developers can change an IconButton widget’s size by passing a double data type value to the IconButton class’s iconSize property.
The following flutter app development tutorial will demonstrate how to set or change the IconButton widget size. Here we used the IconButton class’s iconSize property to change an IconButton widget’s size.
The flutter developers must not override the icon's size with its Icon.size parameter when creating an IconButton widget. Instead, the flutter developers have to use the IconButton class’s iconSize parameter to set the IconButton widget’s size.
The IconButton class’s iconSize property value is a double instance that defines the size of the icon inside the button. The default size is 24.0.
So finally, the flutter app developers can change an IconButton widget’s size by passing a double data type value to the IconButton class’s iconSize property.
main.dart
import 'package:flutter/material.dart';
void main(){
runApp(
MaterialApp(
theme: ThemeData(primarySwatch: Colors.indigo),
home: Scaffold(
appBar: AppBar(
title: const Text("Flutter - IconButton Size")
),
body: Center(
child: IconButton(
iconSize: 96,
icon: const Icon(Icons.favorite),
onPressed: (){},
color: Colors.blueAccent
)
)
),
),
);
}