flutter - 我们如何在flutter中创建一个带有长标签的复选框?
问题描述
在此处输入图像描述 我正在尝试实现这样的目标。我是 Flutter 的新手。
我努力了
Wrap(
// alignment: WrapAlignment.center,
crossAxisAlignment: WrapCrossAlignment.center,
direction: Axis.horizontal,
children: <Widget>[
Checkbox(value: false, onChanged: null),
RichText(
overflow: TextOverflow.visible,
textAlign: TextAlign.left,
text: TextSpan(
text: 'By continuing you agree to our ',
style: TextStyle(
color: Colors.grey,
fontWeight: FontWeight.normal,
fontSize: 14),
children: [
TextSpan(
text: 'Terms of Service, Privacy Policy,',
style: TextStyle(
color: Theme.of(context).primaryColor,
fontWeight: FontWeight.w600,
fontSize: 14),
),
TextSpan(
text: 'and our ',
style: TextStyle(
color: Colors.grey,
fontWeight: FontWeight.w600,
fontSize: 14),
),
TextSpan(
text: 'Notification Settings.',
style: TextStyle(
color: Theme.of(context).primaryColor,
fontWeight: FontWeight.w600,
fontSize: 14),
),
]),
),
],
),
这就是我得到的2
3这是我尝试过的代码,但我越来越喜欢这样了。是否有任何其他方法可以将文本和复选框水平对齐,并将其余文本包裹起来。
解决方案
尝试使用CheckboxListTile,它内容 标题和 副标题属性
推荐阅读
- laravel - 如何在 laravel 5.3 中的 where 子句中使用 OR 和 AND?
- php - 如果左侧操作数是表达式中的数字,为什么只识别十六进制而不识别八进制和字节
- python - 插入数据帧的 Pandas 系列被读取为 NaN
- r - 使用 ggplot2 在 R 中具有正态分布的直方图进行说明
- java - 如何跳转到 Intellij 中变量的初始化
- ionic-framework - 深层链接不起作用 - 离子
- python - 二维矩阵中的python索引
- logstash - 使用grok提取日志数据
- ruby - 获取字符串格式的黄瓜片段不是Ruby中的常规Exp
- html - 在图像悬停时,覆盖原始图像并显示文本