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

Layout bug with ExtendedText overflowWidget #97

Closed VictorUvarov closed 3 years ago

VictorUvarov commented 3 years ago

Example code to reproduce the bug

import 'package:extended_text/extended_text.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(App());
}

class App extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: ExtendedTextLayoutBug(),
    );
  }
}

class ExtendedTextLayoutBug extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: ExtendedText(
          'ABCDEFG',
          overflow: TextOverflow.ellipsis,
          maxLines: 3,
          overflowWidget: TextOverflowWidget(
            child: Text(' ...more'),
          ),
        ),
      ),
    );
  }
}

Error log


════════ Exception caught by scheduler library ═════════════════════════════════
The following assertion was thrown during a scheduler callback:
Updated layout information required for RenderSemanticsAnnotations#b31d0 NEEDS-LAYOUT NEEDS-PAINT to calculate semantics.
'package:flutter/src/rendering/object.dart':
Failed assertion: line 2658 pos 12: '!_needsLayout'

2

Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=2_bug.md

When the exception was thrown, this was the stack
#2      RenderObject._getSemanticsForParent
package:flutter/…/rendering/object.dart:2658
#3      RenderObject._getSemanticsForParent.<anonymous closure>
package:flutter/…/rendering/object.dart:2680
#4      ContainerRenderObjectMixin.visitChildren
package:flutter/…/rendering/object.dart:3336
#5      RenderObject.visitChildrenForSemantics
package:flutter/…/rendering/object.dart:2765
#6      RenderObject._getSemanticsForParent
package:flutter/…/rendering/object.dart:2675
...
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by Flutter framework ═════════════════════════════════
Bad state: Future already completed
════════════════════════════════════════════════════════════════════════════════
zmtzawqlp commented 3 years ago

please provide the version you use, thanks

VictorUvarov commented 3 years ago

extended_text: ^5.0.2

VictorUvarov commented 3 years ago

I still get this error

════════ Exception caught by scheduler library ═════════════════════════════════
The following assertion was thrown during a scheduler callback:
'package:extended_text/src/extended_render_paragraph.dart': Failed assertion: line 866 pos 12: 'childIndex == children.length': is not true.

When the exception was thrown, this was the stack
#2      ExtendedRenderParagraph.assembleSemanticsNode
package:extended_text/src/extended_render_paragraph.dart:866
#3      _SwitchableSemanticsFragment.compileChildren
package:flutter/…/rendering/object.dart:3728
#4      _SwitchableSemanticsFragment.compileChildren
package:flutter/…/rendering/object.dart:3674
#5      _SwitchableSemanticsFragment.compileChildren
package:flutter/…/rendering/object.dart:3674
#6      _SwitchableSemanticsFragment.compileChildren
package:flutter/…/rendering/object.dart:3720
...
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by scheduler library ═════════════════════════════════
'package:extended_text/src/extended_render_paragraph.dart': Failed assertion: line 866 pos 12: 'childIndex == children.length': is not true.
zmtzawqlp commented 3 years ago

please check package.lock file, make sure you are using 5.0.4. it seems another issue? if yes, please open another issue about it, thanks

VictorUvarov commented 3 years ago

It is a different error, I'll have to figure out why i am getting it. I'll open a different issue once I can reproduce it @zmtzawqlp.