DEV Community

Discussion on: Flutter onTap Button

Collapse
 
baransel profile image
Baransel
bool clicked = false;

Widget build(BuildContext context) {
    return Scaffold(
        body: Center(
          child: IconButton(
              icon: Icon( clicked ? Icons.celebration : Icons.title),
              onPressed: () {
                setState(() {
                  clicked = !clicked;
                });
              },
          ), //IconButton
        ), //Center
    ); //Scaffold
}
Enter fullscreen mode Exit fullscreen mode
Collapse
 
alade5673 profile image
devlade

from the image, once the user clicks on the fan container, I want it to change to the fan on the right hand side of the image

dev-to-uploads.s3.amazonaws.com/up...