随着文本的增长,我想要包装文本.我搜索并尝试用几乎所有东西包裹,但仍然文本保持一行并从屏幕溢出.
有谁知道如何实现这一目标?
任何帮助都非常感谢!
有谁知道如何实现这一目标?
任何帮助都非常感谢!
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,));
@R_301_323@
在我的项目中,我将文本实例包装在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]为容器添加了宽度约束