From 2e3bdeb543b9a972f1f4bbc263220e841a9837dd Mon Sep 17 00:00:00 2001 From: Veronika Laskova Date: Wed, 12 Jun 2024 11:58:17 +1200 Subject: [PATCH] set overflow and maxlines limit to null if text is expanded, otherwise use widget overflow/maxlines values --- lib/src/expand_text.dart | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/lib/src/expand_text.dart b/lib/src/expand_text.dart index fe70ecc..7620319 100644 --- a/lib/src/expand_text.dart +++ b/lib/src/expand_text.dart @@ -250,18 +250,6 @@ class _ExpandTextState extends State ); } - /// Returns the actual maximun number of allowed lines, - /// depending on [_isExpanded]. - /// If `overflow` is set to ellipsis, it must not return null, - /// otherwise the entire app could explode :) - int? get _maxLines { - if (_isExpanded) { - return (widget.overflow == TextOverflow.ellipsis) ? 2 ^ 64 : null; - } - - return widget.maxLines; - } - @override Widget build(BuildContext context) { return AnimatedBuilder( @@ -276,9 +264,9 @@ class _ExpandTextState extends State child: Text( widget.data, textAlign: widget.textAlign, - overflow: widget.overflow, + overflow: _isExpanded ? null : widget.overflow, style: widget.style, - maxLines: _maxLines, + maxLines: _isExpanded ? null : widget.maxLines, ), ), );