1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] how to create a gradient color in elevated button in flutter?

Discussão em 'Mobile' iniciado por Stack, Outubro 18, 2024 às 00:13.

  1. Stack

    Stack Membro Participativo

    I trying to create a gradient button in flutter but in ElevatedButton shows some shadow or its strucuture there even when the color was set to transparent.

    Here I have used DecoratedBox for applying gradient color is there any way to apply gradient in ElevatedButton?

    The Code I have used

    child: DecoratedBox(
    decoration: BoxDecoration(
    gradient: LinearGradient(
    colors: [
    Colors.red,
    Colors.blue,
    ],
    begin: Alignment.topLeft,
    end: Alignment.bottomRight,
    )),
    child: ElevatedButton(
    onPressed: () {
    // Navigator.of(context).push(MaterialPageRoute(
    // builder: (BuildContext context) => RegisterScreen()));
    },
    style: ElevatedButton.styleFrom(
    primary: Colors.transparent,
    onPrimary: Colors.transparent),
    child: Text(
    "Register",
    style: TextManager.btnText,
    )),
    ),


    by setting elevation to 0 resolved but when I click the button the thing is also visible. Setting splash color to transparent also didn't work.

    The output button is here

    [​IMG]

    Continue reading...

Compartilhe esta Página