Button With Image Background Flutter


Answer :

the "RaisedButton" is a material component , its take it shape depends on "material design" roles , you can create your own custom button widget

    GestureDetector(       child: Container(        width:120,        height: 40,        decoration: BoxDecoration(          color: Colors.black,          image: DecorationImage(            image:AssetImage("assets/background_button.png"),             fit:BoxFit.cover          ),        child: Text("clickMe") // button text        )       ),onTap:(){        print("you clicked me");       }     ) 

If anyone else come here looking for this, MaterialButton works perfectly.

      MaterialButton(         padding: EdgeInsets.all(8.0),         textColor: Colors.white,         splashColor: Colors.greenAccent,         elevation: 8.0,         child: Container(           decoration: BoxDecoration(             image: DecorationImage(                 image: AssetImage('assets/button_color.png'),                 fit: BoxFit.cover),           ),           child: Padding(             padding: const EdgeInsets.all(8.0),             child: Text("SIGN OUT"),           ),         ),         // ),         onPressed: () {           print('Tapped');         },       ), 

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable