Flutter中Row内Text与IconButton垂直对齐失效问题求助
Flutter Row组件内元素垂直对齐异常问题
我无法让Row组件中的Text、IconButton和Text实现垂直对齐,已尝试设置crossAxisAlignment: CrossAxisAlignment.center但问题仍未解决。对应的Row代码如下:
Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ Text(DateFormat('dd-MM-yyyy').format(wd.date!), style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16), textAlign: TextAlign.left), IconButton( iconSize: 17, padding: EdgeInsets.all(3), onPressed: wd.resetRequested ?? false ? null : () async { showConfirm(context, wd, reloadMonthCallback); }, icon: Icon(Icons.delete) ), Text("${wd.totalHourCount.toStringAsFixed(2)}h", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 13), textAlign: TextAlign.right) ], ),
当前显示效果(垂直对齐失效):
注:基于Flutter Web开发。
更新:尝试使用Expanded包裹元素后,桌面端显示恢复正常,但Android端PWA仍存在轻微对齐偏差:
内容的提问来源于stack exchange,提问作者raquelhortab
相关产品推荐
相关产品推荐

