I have this Widget function :
static Widget mainButton(String title){
return MaterialButton(
textColor: Colors.white,
splashColor: Colors.white54,
elevation: 8.0,
child: Container(
width: 244,
height: 66,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/images/home_button_bg.png'),
fit: BoxFit.cover),
),
child: Center(
child: Text(
title,
style: TextStyle(
fontSize: 20.0,
),
),
),
),
onPressed: (){
print('pressed');
},
);
}
and I want to write onPressed() function differently each time I want to call mainButton() function.
how can I write it ?