extended_text
extended_text copied to clipboard
TextOverflowWidget的align:TextOverflowAlign.left属性没有效果
如题:期望能显示在最后的文字旁边,即333的旁边
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),
),
],
),
),
),
],
)),
),
);
}
}
as design
有办法让TextOverflowWidget紧挨着文字显示么?
你看看官方的...怎么显示的
https://github.com/fluttercandies/extended_text/blob/51399f6e893412b9dfcaef9c38869d4d43d771d3/lib/src/text_overflow_render_mixin.dart#L395
https://medium.com/@VasyaFromRussia/expanding-text-in-flutter-92736226ace5
应该可以通过RenderParapgraph.getBoxesForSelection
实现跟踪最后一行文字末尾的效果。