I am new in flutter , and now I'm working on design an application
but in this part of project I want to set price in new line below the title , I have looking for similar question here but I can't solve it
Here is code:
Widget build(BuildContext context) {
return Card(
child: Hero(
tag: prod_name,
child: Material(
child: InkWell(
onTap: () {},
child: GridTile(
footer: Container(
color: Colors.white,
child: ListTile(
leading: Text(
prod_name,
textAlign: TextAlign.left,
style: TextStyle(color: Colors.grey, fontSize: 12),
),
title: Text("\$$prod_old_price"),
subtitle: Text(
"\$$prod_price",
style: TextStyle(fontWeight: FontWeight.w800,),
),
),
),
child: Image.asset(
prod_pic,
fit: BoxFit.fitHeight,
)),
),
)),
);
}
@Mehrdad Hosseini, You have to take one column with two children for subtitle of card and give the two text widgets as two children. Please go through the below changes in your code.
@override
Widget build(BuildContext context) {
return Card(
child: Hero(
tag: prod_name,
child: Material(
child: InkWell(
onTap: () {},
child: GridTile(
footer: Container(
color: Colors.white,
child: ListTile(
title: Text(
prod_name,
textAlign: TextAlign.left,
style: TextStyle(color: Colors.grey, fontSize: 12),
),
subtitle: Column(
children: <Widget>[
Text("\$$prod_old_price"),
Text(
"\$$prod_price",
style: TextStyle(fontWeight: FontWeight.w800,),
),
],
),
),
),
child: Image.asset(
prod_pic,
fit: BoxFit.fitHeight,
)),
),
)),
);
}
Is this what you are trying to achieve?

ListTile(
title: Text('$prod_name'),
subtitle: Text(
'''\$$old_price\n\$$prod_price''',
style: TextStyle(
fontWeight: FontWeight.w800,
),
),
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With