如何在 flutter 上创建这样的卡片?
how to create card like this on flutter?
请大家帮帮我,我正在尝试制作这张卡片,但我无法制作它。
I'm sharing my code and output.
I'm new in flutter and dart language.
class 查看扩展 StatefulWidget {
审查({
键键,
}):超级(键:键);
@override
_ReviewState createState() => _ReviewState();
}
class _ReviewState extends State<Review> {
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
dragStartBehavior: DragStartBehavior.down,
child: Column(
children: [
ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
return Card(
child: Column(
children: [
SizedBox(
height: 10,
),
ListTile(
leading: Image.asset("assets/japan.webp"),
title: Column(
children: [
Text("japan"),
Text(
"PR 211",
style: TextStyle(fontSize: 13),
overflow: TextOverflow.ellipsis,
maxLines: 1,
softWrap: true,
),
],
),
),
ListTile(
leading: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text("07:40 PM"),
Text(
"Web, Aug 12",
style: TextStyle(fontSize: 13),
),
],
),
title: Column(
children: [
Text("Manila"),
Text(
"MNL, Ninoy Aquino International Airport",
style: TextStyle(fontSize: 13),
overflow: TextOverflow.ellipsis,
softWrap: true,
),
],
),
),
ListTile(
leading: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text("08:40 AM"),
Text(
"thu, Aug 13",
style: TextStyle(fontSize: 13),
),
],
),
title: Column(
children: [
Text("Sydney"),
Text(
"SYD, Kingsford Smith Airport",
style: TextStyle(fontSize: 13),
overflow: TextOverflow.ellipsis,
softWrap: true,
),
],
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Text(
"Coach",
style: TextStyle(fontSize: 10),
overflow: TextOverflow.ellipsis,
softWrap: true,
),
VerticalDivider(
thickness: 2,
),
Text(
"333",
style: TextStyle(fontSize: 10),
overflow: TextOverflow.ellipsis,
),
Icon(
Icons.tv,
size: 10,
),
Icon(
Icons.wifi,
size: 10,
),
Icon(
Icons.power,
size: 10,
),
Icon(
Icons.local_dining,
size: 10,
),
],
)
],
),
);
},
itemCount: 3,
),
],
),
);
}
}
I'm trying to make this card and here is my code and output.
it's complex UI for me and I'm learning flutter and dart language.
这有点简单,您基本上可以只使用一列作为 parent,然后您可以在顶部和底部添加两行,航班标题在顶部,详细信息在底部。现在中间部分是您使用步进器小部件创建动态数据的地方。如有疑问,请告诉我。
请大家帮帮我,我正在尝试制作这张卡片,但我无法制作它。
I'm sharing my code and output. I'm new in flutter and dart language.
class 查看扩展 StatefulWidget { 审查({ 键键, }):超级(键:键);
@override
_ReviewState createState() => _ReviewState();
}
class _ReviewState extends State<Review> {
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
dragStartBehavior: DragStartBehavior.down,
child: Column(
children: [
ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
return Card(
child: Column(
children: [
SizedBox(
height: 10,
),
ListTile(
leading: Image.asset("assets/japan.webp"),
title: Column(
children: [
Text("japan"),
Text(
"PR 211",
style: TextStyle(fontSize: 13),
overflow: TextOverflow.ellipsis,
maxLines: 1,
softWrap: true,
),
],
),
),
ListTile(
leading: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text("07:40 PM"),
Text(
"Web, Aug 12",
style: TextStyle(fontSize: 13),
),
],
),
title: Column(
children: [
Text("Manila"),
Text(
"MNL, Ninoy Aquino International Airport",
style: TextStyle(fontSize: 13),
overflow: TextOverflow.ellipsis,
softWrap: true,
),
],
),
),
ListTile(
leading: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text("08:40 AM"),
Text(
"thu, Aug 13",
style: TextStyle(fontSize: 13),
),
],
),
title: Column(
children: [
Text("Sydney"),
Text(
"SYD, Kingsford Smith Airport",
style: TextStyle(fontSize: 13),
overflow: TextOverflow.ellipsis,
softWrap: true,
),
],
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Text(
"Coach",
style: TextStyle(fontSize: 10),
overflow: TextOverflow.ellipsis,
softWrap: true,
),
VerticalDivider(
thickness: 2,
),
Text(
"333",
style: TextStyle(fontSize: 10),
overflow: TextOverflow.ellipsis,
),
Icon(
Icons.tv,
size: 10,
),
Icon(
Icons.wifi,
size: 10,
),
Icon(
Icons.power,
size: 10,
),
Icon(
Icons.local_dining,
size: 10,
),
],
)
],
),
);
},
itemCount: 3,
),
],
),
);
}
}
I'm trying to make this card and here is my code and output. it's complex UI for me and I'm learning flutter and dart language.
这有点简单,您基本上可以只使用一列作为 parent,然后您可以在顶部和底部添加两行,航班标题在顶部,详细信息在底部。现在中间部分是您使用步进器小部件创建动态数据的地方。如有疑问,请告诉我。