水平滾動串列的一部分不在基線上,這里Icefields, Alberta與大小框的頂部對齊。如何解決?整個串列視圖應該在同一水平面上。

SizedBox(
width: double.maxFinite,
height: 50,
child: ListView(
scrollDirection: Axis.horizontal,
children: [
const Icon(...),
const SizedBox(...),
AppText(
text: detail.place.location,
color: AppColors.textColor1,
),
const SizedBox(...),
Row(
children: [
Wrap(
children: List.generate(5, (index) {
return Icon(...);
}),
),
const SizedBox(...),
AppText(
text:
detail.place.stars.toString() '.0',
color: AppColors.textColor2,
),
],
),
],
),
),
uj5u.com熱心網友回復:
AppText用小部件包裹Center。
....
Center(
child: AppText(
text: detail.place.location,
color: AppColors.textColor1,
),
),
....
uj5u.com熱心網友回復:
另一種解決方案是將位置AppText放在Row:
Row(
children: [
AppText(
text: detail.place.location,
color: AppColors.textColor1,
),
Wrap(
children: List.generate(5, (index) {
return Icon(...);
}),
),
const SizedBox(...),
AppText(
text:
detail.place.stars.toString() '.0',
color: AppColors.textColor2,
),
],
)
這樣,所有小部件Row都對齊相同。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/412707.html
標籤:
上一篇:Flutter將堆疊中的物件放在該堆疊之外的容器頂部
下一篇:如何在給定時間啟用按鈕?撲
