我有一個帶有圖示的提升按鈕,該圖示使用ElevatedButton.icon. 我真正想要的是將圖示放在文本的右側。我該怎么做我的代碼:
ElevatedButton.icon(
onPressed: onPressed,
icon:Icon(icon,
color: color != null ? color : null,
size: getIconSize(),
),
label: Text(label),
style: buttonStyle);
它看起來如何:

我想要的是 :
下一步 ->
uj5u.com熱心網友回復:
使用 Directionality小部件。做方向rtl。
Directionality(
textDirection: TextDirection.rtl,
child: ElevatedButton.icon(
onPressed: () {},
icon: Icon(
Icons.arrow_back,
),
label: Text("Test"),
//.........
))
現在,你只需要添加你的風格

uj5u.com熱心網友回復:
您可以只使用常規ElevatedButton建構式并傳入 Row 作為其子項,以及您的圖示和文本:
ElevatedButton(
onPressed: onPressed,
style: buttonStyle,
child: Row(mainAxisSize:MainAxisSize.min,
children:
[Text(label),
SizedBox.square(dimension: 4),
Icon(icon,color: color != null ? color : null,size: getIconSize()),
]),)

轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/362914.html
