如何使用图像 Flutter 创建简单的 Listview
How to create simple Listview with image Flutter
我想知道如何实现类似或接近于此的东西
image 而不是使用卡片
任何示例代码将不胜感激
试试这个代码
ListView.builder(
itemCount: 2,
itemBuilder: (BuildContext context, int index) {
return Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Row(
children: <Widget>[
SizedBox(width: 10.0),
Image.asset(
'Your Asset',
height: 100,
),
SizedBox(width: 20.0),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
'Title Here',
style: TextStyle(
color: Colors.black,
fontSize: 18.0,
fontWeight: FontWeight.w500,
),
),
SizedBox(width: 6.0),
Text(
'Subtitle Here',
style: TextStyle(
color: Colors.black,
fontSize: 15.0,
fontWeight: FontWeight.w300,
),
),
],
),
),
],
),
Divider(
color: Colors.black,
thickness: 1.5,
),
],
);
},
),
我想知道如何实现类似或接近于此的东西 image 而不是使用卡片 任何示例代码将不胜感激
试试这个代码
ListView.builder(
itemCount: 2,
itemBuilder: (BuildContext context, int index) {
return Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Row(
children: <Widget>[
SizedBox(width: 10.0),
Image.asset(
'Your Asset',
height: 100,
),
SizedBox(width: 20.0),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
'Title Here',
style: TextStyle(
color: Colors.black,
fontSize: 18.0,
fontWeight: FontWeight.w500,
),
),
SizedBox(width: 6.0),
Text(
'Subtitle Here',
style: TextStyle(
color: Colors.black,
fontSize: 15.0,
fontWeight: FontWeight.w300,
),
),
],
),
),
],
),
Divider(
color: Colors.black,
thickness: 1.5,
),
],
);
},
),