我想在 Flutter 中的聊天气泡中插入图标和文本,但在语法中使用行实际上会使气泡变宽。
我只是想让文字和图标处于正确的位置,并且让气泡形状跟随文字的数量,而不是那样扩展
这是我的代码和结果
Bubble(
margin: BubbleEdges.only(top: 10),
alignment: Alignment.topRight,
nip: BubbleNip.rightTop,
color: Color.fromRGBO(225, 255, 199, 1.0),
child: Column(
children: [
Row(
children: [
Text("Bang kuy, adu bola sama rt beside"),
Icon(Icons.done_all)
],
)
],
)
)
尝试使用 IntrinsicWidth 下面的代码...
Column(
children: [
Align(
alignment: Alignment.topRight,
child: IntrinsicWidth(
child: Container(
margin: EdgeInsets.only(top: 10),
alignment: Alignment.topRight,
// nip: BubbleNip.rightTop,
color: Color.fromRGBO(225, 255, 199, 1.0),
child: Column(
children: [
Row(
children: [Text("Hello"), Icon(Icons.done_all)],
),
],
)),
),
),
Align(
alignment: Alignment.topLeft,
child: IntrinsicWidth(
child: Container(
margin: EdgeInsets.only(top: 10),
alignment: Alignment.topLeft,
// nip: BubbleNip.rightTop,
color: Color.fromRGBO(225, 255, 199, 1.0),
child: Column(
children: [
Row(
children: [Text("Bang kuy, adeside"), Icon(Icons.done_all)],
),
],
)),
),
),
],
),