fluttercandies / extended_text

A powerful extended official text for Flutter, which supports Speical Text(Image,@somebody), Custom Background, Custom overFlow, Text Selection.
MIT License
664 stars 134 forks source link

Failed assertion: 'textPainter.width >= lastChild.size.width': is not true. #78

Closed avvari-da closed 4 years ago

avvari-da commented 4 years ago

I have been getting the following error recently, but it is happening only if the content is more than the maxLines and the last line's text is more than certain character count. Am on extended_text version 4.0.0 Please help me figure out a solution for this. Not sure what am doing wrong. Thanks in advance!

Another exception was thrown: 'package:extended_text/src/extended_render_paragraph.dart': Failed assertion: line 946 pos 14: 'textPainter.width >= lastChild.size.width': is not true.

Am using a package for some highlighting. The following is my widget code:

final content = ParsedText(
  alignment: TextAlign.start,
  text: contentText,
  style: contentStyle,
  overflow: TextOverflow.ellipsis,
  maxLines: 3
  parse: [
    MatchText(
      type: ParsedType.CUSTOM,
      pattern: Hashtag.REGEX,
      style: TextStyle(color: Colors.blueAccent),
      onTap: null,
    ),
    MatchText(
      type: ParsedType.URL,
      style: TextStyle(color: Colors.blueAccent),
      onTap: null,
    ),
  ],
  overflowWidget: TextOverflowWidget(
    child: RichText(
      text: TextSpan(
        text: ' \u2026',
        children: <TextSpan>[
          TextSpan(
            text: "see more",
            recognizer: TapGestureRecognizer()..onTap = null,
          ),
        ],
        style: TextStyle(
          color: Colors.blueAccent,
          fontSize: 12.0,
        ),
      ),
    ),
  ),
);
flutter doctor -v ``` [✓] Flutter (Channel stable, 1.20.2, on Mac OS X 10.15.6 19G2021, locale en-IN) • Flutter version 1.20.2 at /Users/dheeraj2dj/flutter • Framework revision bbfbf1770c (2 weeks ago), 2020-08-13 08:33:09 -0700 • Engine revision 9d5b21729f • Dart version 2.9.1 [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2) • Android SDK at /Users/dheeraj2dj/Library/Android/sdk • Platform android-30, build-tools 29.0.2 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 11.6) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.6, Build version 11E708 • CocoaPods version 1.9.3 [✓] Android Studio (version 4.0) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 48.1.2 • Dart plugin version 193.7361 • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593) [!] IntelliJ IDEA Community Edition (version 2020.2.1) • IntelliJ at /Applications/IntelliJ IDEA CE.app ✗ Flutter plugin not installed; this adds Flutter specific functionality. ✗ Dart plugin not installed; this adds Dart specific functionality. • For information about installing plugins, see https://flutter.dev/intellij-setup/#installing-the-plugins [✓] VS Code (version 1.36.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.4.1 [✓] Connected device (1 available) • xxxxxxxxxxxxxxx ! Doctor found issues in 1 category. ```
zmtzawqlp commented 4 years ago

don't support TextOverflowWidget is longer than one line. we can't layout it at right place