extended_text icon indicating copy to clipboard operation
extended_text copied to clipboard

TextOverflowWidget的align:TextOverflowAlign.left属性没有效果

Open miduobao opened this issue 3 years ago • 6 comments

如题:期望能显示在最后的文字旁边,即333的旁边 left class BackgroundTextDemo extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('nick background for text'), ), body: SingleChildScrollView( child: Container( color: Colors.green, width: 400, padding: const EdgeInsets.all(20.0), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ ExtendedText.rich( TextSpan( text: '11111111111111111111111111111111\n', ), TextSpan( text: '222222212222222222222222222222222222222\n', ), TextSpan( text: '3333\n', ), TextSpan( text: '444444\n', ), ]), maxLines: 3, overflow: TextOverflow.visible, overflowWidget: TextOverflowWidget( align:TextOverflowAlign.left, position: TextOverflowPosition.end, debugOverflowRectColor: Colors.red.withOpacity(0.1), child: Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment:MainAxisAlignment.end, children: const <Widget>[ Text( '...', ), Text( '全文', style: TextStyle( height: 1, fontSize: 16, color: Colors.amber), ), ], ), ), ), ], )), ), ); } }

miduobao avatar May 17 '21 14:05 miduobao

as design

zmtzawqlp avatar May 17 '21 14:05 zmtzawqlp

有办法让TextOverflowWidget紧挨着文字显示么?

miduobao avatar May 18 '21 02:05 miduobao

你看看官方的...怎么显示的

zmtzawqlp avatar May 18 '21 02:05 zmtzawqlp

https://github.com/fluttercandies/extended_text/blob/51399f6e893412b9dfcaef9c38869d4d43d771d3/lib/src/text_overflow_render_mixin.dart#L395

zmtzawqlp avatar May 18 '21 04:05 zmtzawqlp

https://medium.com/@VasyaFromRussia/expanding-text-in-flutter-92736226ace5 应该可以通过RenderParapgraph.getBoxesForSelection实现跟踪最后一行文字末尾的效果。

Oklahomawhore avatar May 31 '21 09:05 Oklahomawhore