如何按顺序排列图标?
How can I arrange icons in a sequence?
我添加了图标并在其前面写下了一些文字,但如图所示,在最后两个容器中,图标没有按顺序排列。我想要一个在另一个下面。他们正在根据文本进行调整。另外还有一个问题,我如何能够在这两个容器之间给出 space,因为它们彼此非常接近。 return 容器用于 if else 条件的 else 部分。因此 Expanded 不适用于此处。
buttonPress == true ? StreamBuilder<QuerySnapshot>(
stream: _firestore.collection('Uploading Vehicle Details').where('City', isEqualTo: city).where('Vehicle', isEqualTo: dropdownvalue).snapshots(),
//code
);
},
): Container(),
return Container(
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 2,
blurRadius: 5,
offset: Offset(0, 3),
),],
color: Colors.white.withOpacity(0.9),
borderRadius: BorderRadius.circular(10.0),
),
child: Row(
children: [
Icon(
Icons.car_rental,
size: 40,
color: Colors.black,
),
SizedBox(
width: 20,
),
Column(
children: [
Row(
children: [
Icon(
Icons.location_city,
color: Colors.black,
),
SizedBox(
width: 20,
),
Text(
"${data['City']}",
style: TextStyle(color: Colors.black),
),
],
),
Row(
children: [
Icon(
Icons.description,
color: Colors.black,
),
SizedBox(
width: 20,
),
Text(
"${data['Description']}",
style: TextStyle(color: Colors.black),
),
],
),
Row(
children: [
Icon(
Icons.phone,
color: Colors.black,
),
SizedBox(
width: 20,
),
Text(
"${data['Phone.No#']}",
style: TextStyle(color: Colors.black),
),
],
),
Row(
children: [
Text(
"${data['Vehicle']}",
style: TextStyle(color: Colors.black),
),
],
),
],
),
],
),
);
因为你的代码结果期望是这样的
您将尝试此代码
Container(
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 2,
blurRadius: 5,
offset: const Offset(0, 3),
),
],
color: Colors.white.withOpacity(0.9),
borderRadius: BorderRadius.circular(10.0),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Icon(
Icons.car_rental,
size: 40,
color: Colors.black,
),
const SizedBox(
width: 20,
),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: const [
Icon(
Icons.location_city,
color: Colors.black,
),
SizedBox(
width: 20,
),
Text(
data['City'],
style: TextStyle(color: Colors.black),
),
],
),
Row(
children: const [
Icon(
Icons.description,
color: Colors.black,
),
SizedBox(
width: 20,
),
Text(
data['Description'],
style: TextStyle(color: Colors.black),
),
],
),
Row(
children: const [
Icon(
Icons.phone,
color: Colors.black,
),
SizedBox(
width: 20,
),
Text(
data['Phone.No#'],
style: TextStyle(color: Colors.black),
),
],
),
Row(
children: const [
Text(
data['Vehicle'],
style: TextStyle(color: Colors.black),
),
],
),
],
),
],
),
)
我添加了图标并在其前面写下了一些文字,但如图所示,在最后两个容器中,图标没有按顺序排列。我想要一个在另一个下面。他们正在根据文本进行调整。另外还有一个问题,我如何能够在这两个容器之间给出 space,因为它们彼此非常接近。 return 容器用于 if else 条件的 else 部分。因此 Expanded 不适用于此处。
buttonPress == true ? StreamBuilder<QuerySnapshot>(
stream: _firestore.collection('Uploading Vehicle Details').where('City', isEqualTo: city).where('Vehicle', isEqualTo: dropdownvalue).snapshots(),
//code
);
},
): Container(),
return Container(
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 2,
blurRadius: 5,
offset: Offset(0, 3),
),],
color: Colors.white.withOpacity(0.9),
borderRadius: BorderRadius.circular(10.0),
),
child: Row(
children: [
Icon(
Icons.car_rental,
size: 40,
color: Colors.black,
),
SizedBox(
width: 20,
),
Column(
children: [
Row(
children: [
Icon(
Icons.location_city,
color: Colors.black,
),
SizedBox(
width: 20,
),
Text(
"${data['City']}",
style: TextStyle(color: Colors.black),
),
],
),
Row(
children: [
Icon(
Icons.description,
color: Colors.black,
),
SizedBox(
width: 20,
),
Text(
"${data['Description']}",
style: TextStyle(color: Colors.black),
),
],
),
Row(
children: [
Icon(
Icons.phone,
color: Colors.black,
),
SizedBox(
width: 20,
),
Text(
"${data['Phone.No#']}",
style: TextStyle(color: Colors.black),
),
],
),
Row(
children: [
Text(
"${data['Vehicle']}",
style: TextStyle(color: Colors.black),
),
],
),
],
),
],
),
);
因为你的代码结果期望是这样的
您将尝试此代码
Container(
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 2,
blurRadius: 5,
offset: const Offset(0, 3),
),
],
color: Colors.white.withOpacity(0.9),
borderRadius: BorderRadius.circular(10.0),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Icon(
Icons.car_rental,
size: 40,
color: Colors.black,
),
const SizedBox(
width: 20,
),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: const [
Icon(
Icons.location_city,
color: Colors.black,
),
SizedBox(
width: 20,
),
Text(
data['City'],
style: TextStyle(color: Colors.black),
),
],
),
Row(
children: const [
Icon(
Icons.description,
color: Colors.black,
),
SizedBox(
width: 20,
),
Text(
data['Description'],
style: TextStyle(color: Colors.black),
),
],
),
Row(
children: const [
Icon(
Icons.phone,
color: Colors.black,
),
SizedBox(
width: 20,
),
Text(
data['Phone.No#'],
style: TextStyle(color: Colors.black),
),
],
),
Row(
children: const [
Text(
data['Vehicle'],
style: TextStyle(color: Colors.black),
),
],
),
],
),
],
),
)