flutter - 星星出现在容器的末尾
问题描述
我正在制作一个应用程序,但我不知道如何使评论中的星星出现在该容器的末尾(并且不使用 sizedBox(width:50) )任何想法?我已经尝试在行中使用 crossAligmentAxis 和 Main.. 但它没有帮助。
return Container(
margin: EdgeInsets.only(right:12, top:8 , bottom:0),
width: MediaQuery.of(context).size.width - 140,
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black
.withOpacity(0.1),
blurRadius: 2,
spreadRadius: 1)
],
borderRadius:
BorderRadius.circular(4)),
child: Column(
children: [
Row(
children: [
CircleAvatar(
backgroundImage:
NetworkImage(snapshot
.data
.documents[index]
.data["avatarUrl"]),
),
SizedBox(width: 8),
Text(
snapshot
.data
.documents[index]
.data["name"],
style: TextStyle(
fontWeight:
FontWeight.bold)),
SizedBox(width:50),
Row(
children: [
_buildRatingStars(snapshot
.data
.documents[index]
.data["rating"]),
],
)
],
),
解决方案
有一些miss的概念,这里你不要直接在row下使用children,我们应该尝试如下:
Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
CircleAvatar(
backgroundImage:
NetworkImage(snapshot
.data
.documents[index]
.data["avatarUrl"]),
),
SizedBox(width: 8),
Text(
snapshot
.data
.documents[index]
.data["name"],
style: TextStyle(
fontWeight:
FontWeight.bold)),
SizedBox(width:50),
Text(snapshot
.data
.documents[index]
.data["rating"])
],
),
推荐阅读
- javascript - 使用 react 获取 json api ( useeffect )
- sqlite - 在 Tcl 中加入包含希伯来语的列表?
- sqlite - 添加连接条件时 SQLite TOTAL 查询增加
- oracle - 使用 PutSQL 插入 Oracle 表会返回 sql.generated.key 属性的 rowid 值,而不是生成的序列 id
- python-3.x - 日语推特学术研究
- java - 如何在 JOOQ 中模拟 meta()
- angular - 如何在treegrid angular中绑定许多子任务?
- java - Java HashSet 通过其哈希码删除项目
- java - Gradle:在 gradle 版本 > 7.0 中相当于 complieOnly
- c++ - 是否可以创建一个只有 lambda 的概念?