大佬教程收集整理的这篇文章主要介绍了如何将 CircleAvatar 添加到 Flutter TextField?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
尝试创建一个帖子屏幕,用户可以在其中选择图像并发布文本。 我遇到的主要问题是我需要在 textFIEld 的左侧为用户添加一个 Cirlce 头像,并提示“在此处插入您的文本”
这是我目前取得的成就:
class CityRecommendations extends StatelessWidget {
@overrIDe
Widget build(BuildContext context) {
return Scaffold(
appbar: PreferredSize(
preferredSize: const Size.fromHeight(100),child: DropdownAppbar(),),body: column(
mainAxisAlignment: MainAxisAlignment.end,children: <Widget>[
TextFIEld(
decoration: inputdecoration(
hintText: "Insert your message",scrolLPADding: EdgeInsets.all(20.0),autofocus: true,messageBox(),],);
}
}
如何为用户添加圆形头像?
我不确定这是你想要的
Row(
children: <Widget>[
CircleAvatar(child: Icon(Icons.person)),Expanded(
child: Padding(
padding: EdgeInsets.all(8),child: TextField(
decoration: InputDecoration(
hintText: "Insert your message",),scrolLPADding: EdgeInsets.all(20.0),autofocus: true,))
],
,
您可以为此使用 CircleAvatar 小部件。
代表用户的圆圈。
通常与用户的个人资料图片一起使用,或者在没有此类图片的情况下与用户的姓名首字母一起使用。为保持一致性,给定用户的姓名首字母应始终与相同的背景颜色配对。
如果foregroundImage 失败,则使用BACkgroundImage。如果 BACkgroundImage 也失败,则使用 BACkgroundColor。
如果 BACkgroundImage 为 null,则 onBACkgroundImageError 参数必须为 null。如果 foregroundImage 为 null,则 onForegroundImageError 参数必须为 null。
,你可以用 CircleAvater 包裹你的 TextField
以上是大佬教程为你收集整理的如何将 CircleAvatar 添加到 Flutter TextField?全部内容,希望文章能够帮你解决如何将 CircleAvatar 添加到 Flutter TextField?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。