flutter - 如何在行中固定位置子小部件?扑
问题描述
我正在尝试制作评论卡。有一个问题。当评论高度增加时,我的头像和按钮不固定
我想固定头像图像和按钮的位置。
我怎样才能做到这一点?
import 'package:flutter/material.dart';
import '../../size_config.dart';
class CommentItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 10),
child: Row(
children: <Widget>[
CircleAvatar(
radius: 25,
child: ClipOval(
child: SizedBox(
height: 1000,
width: 1000,
child: Image.asset(
'assets/images/img2.jpg',
fit: BoxFit.cover,
),
),
),
),
Expanded(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text('123',
style:
TextStyle(fontWeight: FontWeight.bold, fontSize: 17)),
SizedBox(height: 3),
Text(
'. If you want to keep these changes, it is re',
style: TextStyle(color: Colors.grey),
maxLines: 4,
),
],
),
),
),
ClipOval(
child: Material(
color: Colors.blue, // button color
child: InkWell(
splashColor: Colors.red, // inkwell color
child: SizedBox(
width: SizeConfig.widthMultiplier * 8.8,
height: SizeConfig.heightMultiplier * 5,
child: Icon(
Icons.person_add,
size: SizeConfig.imageSizeMultiplier * 5.5,
color: Colors.white,
)),
onTap: () {},
),
),
)
],
),
);
}
}
看起来您的帖子主要是代码;请添加更多细节,看起来您的帖子主要是代码;请添加更多细节,看起来您的帖子主要是代码;请添加更多详细信息
解决方案
您是否尝试过使用 crossAxisAlignment?
Row(
crossAxisAlignment: CrossAxisAlignment.start,
推荐阅读
- html - SVG中的视图框重要吗?
- angular - Identity Server 4 在帐户/登录时向 Angular 客户端响应 403(禁止)
- flutter - video_player 依赖项不起作用 api 19
- mongodb-.net-driver - 如何使用 C# mongodb 驱动程序防止 SQL 注入?
- ios - Swift 防止“0”成为 1 个特定 uiTextField 的第一个字符
- javascript - 为什么在使用 post 请求获取时我无法重定向到我的 get 路由器?
- google-maps - 谷歌地方 api 实施期间的警告(颤振)
- java - 如何在 iText 7 中为泰国双标设置字母上方的 GPOS
- quantum-computing - 如何训练输出状态向量的 TensorFlow Quantum 模型?
- python - 如何根据类型自动拆分 Python 列表?