Home > Software design >  Flutter Change Button Color
Flutter Change Button Color

Time:10-04

Any suggestions to change the color of the ElevateButton below?

child: ElevatedButton(
                                child: Text(
                                  'Subscribe',
                                  style: TextStyle(
                                      color: gray900,
                                      fontFamily: 'Lexend Exa',
                                      fontSize: 20),
                                ),
                                onPressed: fetchOffersMonthly,
                              ),

CodePudding user response:

Use ButtonStyle to change the color

 ElevatedButton(
    style: ButtonStyle(
    backgroundColor: MaterialStateProperty.all<Color>(Colors.green)),
    onPressed: () {  }, 
    child: Text(""),
 ),

CodePudding user response:

ElevatedButton(
        child: Text('Subscribe'),
        onPressed: () {},
        style: ElevatedButton.styleFrom(
            primary: Colors.purple,
            textStyle: TextStyle(
            fontSize: 30,
        fontWeight: FontWeight.bold)),

)

CodePudding user response:

Try below code hope its helpful to you. refer documentation Image

  • Related