I'm new to flutter. There was a repetitive construction, I separated it as a method, but I had a problem with the button part. Can you help me?
TextButton buildSportSection(String sport_screen,String sport_name,String name) {
return TextButton(
onPressed: () {
** Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
$sport_screen()));
},**
child: Container(
height: 100,
decoration: BoxDecoration(
color: Color(0xFFF7F8F8),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(50),
topRight: Radius.circular(50),
),
),
child: Row(
children: [
Image.asset('assets/images/$name.png'),
Text("$sport_name",
style: GoogleFonts.abhayaLibre(fontSize: 20))
],
),
),
);
}
}
There was no problem in the method of the design of this part, but I could not make the text button part.