Flutter-聊天气泡方法溢出
Flutter - chat bubble method overflow
我想知道(聊天气泡)如何调整发送或接收消息的大小,当它太长时它会溢出并从容器中出来而不是去第二行,第三行等等 .. ,
我怎样才能让它在第一行被填满的时候换行?
child: ChatBubble(
clipper: ChatBubbleClipper6(
nipSize: 0,
radius: 20,
type: BubbleType.receiverBubble,
),
margin: EdgeInsets.only(top:10),
child: Container(
constraints: BoxConstraints(
maxWidth: MediaQuery.of(context).size.width *0.6,
),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
data['msg'],
style: TextStyle(
fontSize: 15,
),
maxLines: 100,
overflow: TextOverflow.ellipsis,
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
data['createdDate'] == null
? DateTime.now().toString()
:data['createdDate']
.toDate().toString(),
],
),
],
),
),
),
用Expanded换行Text
。
A widget that expands a child of a Row, Column, or Flex so that the child fills the available space.
我想知道(聊天气泡)如何调整发送或接收消息的大小,当它太长时它会溢出并从容器中出来而不是去第二行,第三行等等 .. , 我怎样才能让它在第一行被填满的时候换行?
child: ChatBubble(
clipper: ChatBubbleClipper6(
nipSize: 0,
radius: 20,
type: BubbleType.receiverBubble,
),
margin: EdgeInsets.only(top:10),
child: Container(
constraints: BoxConstraints(
maxWidth: MediaQuery.of(context).size.width *0.6,
),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
data['msg'],
style: TextStyle(
fontSize: 15,
),
maxLines: 100,
overflow: TextOverflow.ellipsis,
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
data['createdDate'] == null
? DateTime.now().toString()
:data['createdDate']
.toDate().toString(),
],
),
],
),
),
),
用Expanded换行Text
。
A widget that expands a child of a Row, Column, or Flex so that the child fills the available space.