【发布时间】:2022-11-18 01:21:55
【问题描述】:
我在这里创建一个基本的聊天应用程序
我的聊天气泡在长消息上显示溢出错误,如何用多行显示整条消息
有没有办法让我知道它是多行消息还是单行消息,bcz 我想在多行消息时更改设计,我的意思是长消息...
这是我的代码
class MessageCardWidget extends StatelessWidget {
final MessageModel msgmodel;
final bool sendbyme;
const MessageCardWidget(
{Key? key, required this.msgmodel, required this.sendbyme})
: super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.only(bottom: 20, left: 40),
child: Row(
mainAxisAlignment:
sendbyme ? MainAxisAlignment.end : MainAxisAlignment.start,
children: [
Container(
decoration: BoxDecoration(
boxShadow: const [
BoxShadow(
color: Color.fromRGBO(0, 0, 255, 0.2),
offset: Offset(1, 1),
spreadRadius: 2,
blurRadius: 1)
],
borderRadius: BorderRadius.circular(10),
color: sendbyme ? Colors.green[100] : Colors.white,
),
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 20),
child: Column(
crossAxisAlignment:
sendbyme ? CrossAxisAlignment.end : CrossAxisAlignment.start,
children: [
Text(
msgmodel.msg.toString(),
style: TextStyle(fontSize: 20, color: Colors.black),
),
SizedBox(
height: 2,
),
Text(
DateFormat('hh-mm').format(msgmodel.createdon!).toString(),
style: TextStyle(fontSize: 12, color: Colors.grey),
)
],
),
)
],
),
);
}
}
【问题讨论】:
标签: flutter