飞镖 – 缠绕文字
发布时间:2020-12-14 14:51:18 所属栏目:百科 来源:网络整理
导读:随着文本的增长,我想要包装文本.我搜索并尝试用几乎所有东西包裹,但仍然文本保持一行并从屏幕溢出. 有谁知道如何实现这一目标? 任何帮助都非常感谢! Positioned( left: position.dx,top: position.dy,child: new Draggable( data: widget.index,onDragStar
随着文本的增长,我想要包装文本.我搜索并尝试用几乎所有东西包裹,但仍然文本保持一行并从屏幕溢出.
有谁知道如何实现这一目标? 任何帮助都非常感谢! Positioned( left: position.dx,top: position.dy,child: new Draggable( data: widget.index,onDragStarted: widget.setDragging,onDraggableCanceled: (velocity,offset) { setState(() { position = offset; widget.secondCallback(offset,widget.index); widget.endDragging(); }); },child: new GestureDetector( onTap: () { widget.callback(widget.caption,widget.index); },child: new Text( widget.caption.caption,style: new TextStyle( color: widget.caption.color,fontSize: widget.caption.fontSize,),feedback: new Material( type: MaterialType.transparency,child: new Text( widget.caption.caption,fontSize: widget.caption.fontSize),softWrap: true,)); 解决方法
在我的项目中,我将文本实例包装在Containers周围.此特定代码示例具有两个堆叠的Text对象.
这是一个代码示例. //80% of screen width double c_width = MediaQuery.of(context).size.width*0.8; return new Container ( padding: const EdgeInsets.all(16.0),width: c_width,child: new Column ( children: <Widget>[ new Text ("Long text 1 Long text 1 Long text 1 Long text 1 Long text 1 Long text 1 Long text 1 Long text 1 Long text 1 Long text 1 Long text 1 Long text 1 Long text 1 Long text 1 ",textAlign: TextAlign.left),new Text ("Long Text 2,Long Text 2,Long Text 2",],); [edit]为容器添加了宽度约束 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |