Home > front end >  Change the color of ElevatedButton
Change the color of ElevatedButton

Time:10-20

How can I change the background color of the ElevatedButton?

child: ElevatedButton(                 
                  onPressed: (){},
                  child: Text('Get Started', 
                  style: TextStyle(
                    color: Colors.white,
                    fontSize: 20.0,
                  ),),
                ),

CodePudding user response:

Try using a ButtonStyle!

ElevatedButton(
          onPressed: onPressed, 
          child: child, 
          style: ButtonStyle(backgroundColor: color),
        )

It's also got many other options besides backgroundColor if you want to explore it.

CodePudding user response:

You can do it using style as below

    ElevatedButton(
       onPressed: onPressed,
       child: child,
       style: ElevatedButton.styleFrom(
         backgroundColor: Colors.black
     )
    )
  • Related