flutter - 将长文本紧紧包裹在容器周围
问题描述
如何将长文本紧紧包裹在容器周围。MS word 有一个紧凑的包装功能。我需要将我的文本包裹在底部容器周围,使其看起来像上传的图像。
Stack(
alignment: Alignment.topRight,
children: [
Padding(
padding: EdgeInsets.only(bottom: 4, left: 4),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Color.fromRGBO(249, 249, 249, 1),
// color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.10),
spreadRadius: 1,
blurRadius: 5,
offset: Offset(3, 3),
)
]),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Column(
children: [
Text(
"we pay close attention to every detail",
style: TextStyle(),
textAlign: TextAlign.right,
),
Container(
alignment: Alignment.topRight,
child: new Text(
"A really long text",
style: TextStyle(),
overflow: TextOverflow.fade,
textAlign: TextAlign.right,
),
),
],
),
),
),
),
Positioned(
bottom: 0,
left: 0,
child: Container(
height: 48,
width: 48,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Color.fromRGBO(196, 196, 196, 1),
// color: Colors.white,
),
),
)
],
);
我得到的输出是:
我需要这样的输出:
解决方案
也许这个包可以帮助你drop_cap_text
DropCapText(
loremIpsumText,
style: TextStyle(
height: 1.3,
fontFamily: 'times',
),
dropCapChars: 2,
indentation: Offset(25, 10),
),
推荐阅读
- visual-studio-code - 在 Visual Studio Code 中设置 outFiles
- typescript - 在 typeorm 中使用函数
- android - 防止Android XML中单词中间的换行
- python - 尝试向文本文件中模式的所有实例添加递增数字
- css - Distill 博客中的 R 代码不在桌面中水平滚动
- grails - 信息 api 未在 grails 4 应用程序中使用 gradle-git-properties 插件显示 git 信息
- amazon-web-services - Terraform 在同一资源中有一个 for_each 和动态块?或者我可以在资源语句中有多个 for_each
- python - 如何将规范化空间应用于 xpath?
- javascript - 如何正确分发 php foreach 的 js 代码?
- windows - 使用 Windows 服务启动 Cassandra 时“创建 Java 失败”