
我已經添加了圖示并在其前面寫下了一些文本,但如圖所示,在最后兩個容器中,圖示不是按順序排列的。我希望他們一個低于另一個。他們正在根據文本進行調整。另外還有一個問題,因為它們彼此非常接近,所以我如何能夠在這兩個容器之間留出空間。回傳容器用于 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),
),
],
),
],
),
],
),
);
uj5u.com熱心網友回復:
正如您的代碼結果期望這樣

您將嘗試此代碼
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),
),
],
),
],
),
],
),
)
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/437114.html
