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

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?