Search code examples
flutterdartflutter-layout

How I add larger size of image in IconButton on flutter?


In IconButton has "icon:_isRecording " boolean and I added an image and I gave the size of the image as 50 but then show me this error.

enter image description here

I choose IconButton for this in the IconButton we can pass the boolean value as I did. I tried to pass in a column widget but that didn't work. So I used IconButton. How to resolve it? my code.

   IconButton(
              icon: _isRecording
                  ? Column(
                      children: const [
                        Icon(
                          Icons.pause,
                          size: 30,
                        ),
                        LinearProgressIndicator(
                            semanticsLabel: 'Linear progress indicator'),
                      ],
                    )
                  : Column(
                      children: const [
                        ImageIcon(
                          AssetImage("assets/mic2.png"),
                          size: 50,
                        ),
                      ],
                    ),
              onPressed: _onRecordButtonPressed,
            ),      


Solution

  • You can use iconSize from IconButton, default value is 24

    IconButton(
      iconSize: x,// based on your need
      ),