flutter - 如何在 Wrap Widget 中换行
问题描述
我使用 Wrap Widget 来显示聊天消息,我无法在 Wrap Widgets 中显示新行 '\n'
显示短信:
a *bold*
`highlight`
```pre```
```pre1```
a ```pre2```
a *bold*
然后将 listWidget 包装在 Wrap Widget
Wrap(
children: listWidgets,
)
但文本小部件 ('\ n') 没有按预期进行
是否有人在 Wrap Widget 中有解决方案新行请帮助
解决方案
尝试使用 RichText 小部件:
RichText(
text: TextSpan(
text: '26 Sep 2020\n\n',
style: TextStyle(
color: Colors.black,
fontSize: 12.0,
),
children: <TextSpan>[
TextSpan(
text: 'blablabla',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 16.0,
),
),
],
),
),
推荐阅读
- excel - How to use column of strings to find that same string in another sheet, and paste a corresponding value from sheet 1 next to the found value?
- javascript - 如何在 WebStorm 中使用 jsconfig 路径?
- azure-devops - 递增版本号 android 或 iOS 类库 azure devops
- laravel - 如何在 laravel 中处理 InvalidSignatureException 异常并返回自定义错误 json 响应
- spring-data-rest - 向所有 Spring Data Rest 控制器添加方法
- java - 如何将python表达式转换为android?
- java - Maven Assembly插件fileMode在fileSet上不起作用
- apache-nifi - ExecuteSQL 和 ExecuteSQLRecord 之间的区别
- javascript - 转换适用于 Google Maps Api 的 JSON 响应
- gulp - Browsersync 不注入 css