テキストが長くなるにつれてテキストを折り返したいです。検索して、ほぼすべての折り返しを試しましたが、テキストは 1 行のままで、画面からはみ出てしまいます。これを実現する方法をご存知の方はいらっしゃいますか? ご協力いただければ幸いです。
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,
style: new TextStyle(
color: widget.caption.color,
fontSize: widget.caption.fontSize),
softWrap: true,
),
),
));
ベストアンサー1
うまくFlexible
いく
new Container(
child: Row(
children: <Widget>[
Flexible(
child: new Text("A looooooooooooooooooong text"))
],
));
これは公式ドキュメントですhttps://flutter.dev/docs/development/ui/layout#lay-out-multiple-widgets-vertical-and-horizontallyウィジェットを配置する方法について説明します。
Flexible
また、 は、の理由により、、またはExpanded
内でのみ使用する必要があることに注意してください。Column
Row
Flex
Incorrect use of ParentDataWidget
解決策は単なるFlexible