这是群聊中聊天消息的单行。我需要它看起来像这样:
(circular area for a small icon) username
(empty space below icon) message
(empty space below icon) timestamp (when message is clicked on)
圆形区域将保存来自assets/profileIcons
的一组图像资产中的任何一个。我尝试使用下面的代码模拟圆形区域(临时),但是无论我选择什么颜色,图标都不会显示。我只看到一片白色。此外,用户名没有整齐地与消息字段对齐。我很困惑我希望有一种方法可以用GUI来构建它,因为小部件的级联child
s读起来真的很烦人。
return Column(
children: [
Row(
children: [
Expanded(flex: 5,
child: Container(
margin: EdgeInsets.all(50.0),
decoration: BoxDecoration(
color: Colors.red,
shape: BoxShape.circle
),
)
),
Expanded(flex: 8, child: Text(username)),
Expanded(flex: 15, child: Text('')),
],
),
Row(
children: [
SizedBox(width: 20,),
Container(
constraints: BoxConstraints(maxWidth: MediaQuery.of(context).size.width * 0.5),
padding: EdgeInsets.only(left: 15, top: 15, right: 15, bottom: 15),
decoration: BoxDecoration(
color: Color.fromRGBO(66, 135, 245, 100.0),
borderRadius: BorderRadius.circular(30),
),
child: Wrap(
children: [
Text(text),
],
),
),
],
),
],
);
1条答案
按热度按时间0x6upsns1#
Heading ##listtile ##leading ##chat ## return Scaffold(