颤音:如何使前缀以标记为中心
如何制作prefixicon
以labelText
为中心。
return TextField(
decoration: InputDecoration(
labelText: "Test",
prefixIcon: GestureDetector(
onTap: () {},
child: Container(
color: Colors.red,
child: RichText(
textAlign: TextAlign.justify,
text: TextSpan(
children: <InlineSpan>[
TextSpan(
text: "+49 ",
style: textMontserrat16SpNormal(
ColorPalettes.grey9, FontWeight.w500),
),
WidgetSpan(
alignment: ui.PlaceholderAlignment.middle,
child: SizedBox(
child: SvgPicture.asset(ImageAssets.icArrowDown),
),
),
],
),
),
),
),
),
);
How to make prefixIcon
centered with labelText
.
return TextField(
decoration: InputDecoration(
labelText: "Test",
prefixIcon: GestureDetector(
onTap: () {},
child: Container(
color: Colors.red,
child: RichText(
textAlign: TextAlign.justify,
text: TextSpan(
children: <InlineSpan>[
TextSpan(
text: "+49 ",
style: textMontserrat16SpNormal(
ColorPalettes.grey9, FontWeight.w500),
),
WidgetSpan(
alignment: ui.PlaceholderAlignment.middle,
child: SizedBox(
child: SvgPicture.asset(ImageAssets.icArrowDown),
),
),
],
),
),
),
),
),
);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我试图用“ Row”小部件包装“ RichText”小部件。
由于资源泄漏,我更改了一些代码。
=“ https://i.sstatic.net/6zj52.png” alt =“在此处输入图像说明”>
I tried to wrap 'RichText' widget by 'Row' widget.
I changed some code because of leak of resources.
尝试以下代码:如果您想要在该文本场中的phone_number,则将引用 intl_phone_phone_phone_field_field 和 a> packages
result-&gt;
Try below code: If you want phone_number in that textfield then you will refer
intl_phone_field
andintl_phone_number_input
packagesResult->
在容器上使用对齐:
Use Alignment at Container: