Meh*_*ini 1 text frameworks flutter
我是 flutter 的新手,现在我正在设计一个应用程序
但在这部分项目中,我想在标题下方的新行中设置价格,我在这里寻找类似的问题,但我无法解决
这是代码:
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,
)),
),
)),
);
Run Code Online (Sandbox Code Playgroud)
}
@Mehrdad Hosseini,您必须将一列有两个孩子的卡片作为副标题,并将两个文本小部件作为两个孩子。请在您的代码中进行以下更改。
@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,
)),
),
)),
);
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1864 次 |
最近记录: |