santa112358 / hashtagable

Widgets and functions to implement hashTag decorated text.
https://pub.dev/packages/hashtagable
MIT License
30 stars 50 forks source link

HashTagText() is broken ? #19

Closed FareedR closed 4 years ago

FareedR commented 4 years ago

Upgrade from 0.0.4 to 0.1.1

flutter: The following assertion was thrown building HashTagText(dirty): flutter: 'package:flutter/src/widgets/basic.dart': Failed assertion: line 5076 pos 15: 'textAlign != null': flutter: is not true. flutter: flutter: The relevant error-causing widget was: flutter: HashTagText file:///Users/FareedR/Sites/lambung-flutter/lib/timeline/timeline.dart:413:35 flutter: flutter: When the exception was thrown, this was the stack: flutter: #2 new RichText (package:flutter/src/widgets/basic.dart:5076:15) flutter: #3 HashTagText.build (package:hashtagable/hashtag_text.dart:43:12) flutter: #4 StatelessElement.build (package:flutter/src/widgets/framework.dart:4576:28) flutter: #5 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4502:15) flutter: #6 Element.rebuild (package:flutter/src/widgets/framework.dart:4218:5) flutter: #7 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4481:5) flutter: #8 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4476:5) flutter: #9 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14) flutter: #10 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5947:32) flutter: #11 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14) flutter: #12 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5947:32) flutter: ... Normal element mounting (33 frames) flutter: #45 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14) flutter: #46 Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18) flutter: #47 SliverMultiBoxAdaptorElement.updateChild (package:flutter/src/widgets/sliver.dart:1162:36) flutter: #48 SliverMultiBoxAdaptorElement.createChild. (package:flutter/src/widgets/sliver.dart:1147:20) flutter: #49 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2607:19) flutter: #50 SliverMultiBoxAdaptorElement.createChild (package:flutter/src/widgets/sliver.dart:1140:11) flutter: #51 RenderSliverMultiBoxAdaptor._createOrObtainChild. (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:354:23) flutter: #52 RenderObject.invokeLayoutCallback. (package:flutter/src/rendering/object.dart:1866:58) flutter: #53 PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:918:15) flutter: #54 RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:1866:13) flutter: #55 RenderSliverMultiBoxAdaptor._createOrObtainChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:343:5) flutter: #56 RenderSliverMultiBoxAdaptor.addInitialChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:427:5) flutter: #57 RenderSliverList.performLayout (package:flutter/src/rendering/sliver_list.dart:79:12) flutter: #58 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7) flutter: #59 RenderSliverEdgeInsetsPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:135:11) flutter: #60 RenderSliverPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:375:11) flutter: #61 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7) flutter: #62 RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:452:13) flutter: #63 RenderShrinkWrappingViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1783:12) flutter: #64 RenderShrinkWrappingViewport.performLayout (package:flutter/src/rendering/viewport.dart:1741:20) flutter: #65 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7) flutter: #66 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13) flutter: #67 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7) flutter: #68 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13) flutter: #69 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7) flutter: #70 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13) flutter: #71 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7) flutter: #72 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13) flutter: #73 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7) flutter: #74 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13) flutter: #75 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7) flutter: #76 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13) flutter: #77 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7) flutter: #78 RenderFlex.performLayout (package:flutter/src/rendering/flex.dart:746:15) flutter: #79 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7) flutter: #80 _RenderSingleChildViewport.performLayout (package:flutter/src/widgets/single_child_scroll_view.dart:512:13) flutter: #81 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7) flutter: #82 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13) flutter: #83 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7) flutter: #84 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13) flutter: #85 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7) flutter: #86 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13) flutter: #87 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7) flutter: #88 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13) flutter: #89 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7) flutter: #90 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13) flutter: #91 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7) flutter: #92 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13) flutter: #93 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7) flutter: #94 MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:171:11) flutter: #95 _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:484:7) flutter: #96 MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:240:7) flutter: #97 RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:399:14) flutter: #98 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7) flutter: #99 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13) flutter: #100 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7) flutter: #101 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13) flutter: #102 _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1248:11) flutter: #103 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7) flutter: #104 MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:171:11) flutter: #105 _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:484:7) flutter: #106 MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:240:7) flutter: #107 RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:399:14) flutter: #108 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1630:7) flutter: #109 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:887:18) flutter: #110 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:402:19) flutter: #111 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:884:13) flutter: #112 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:284:5) flutter: #113 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1113:15) flutter: #114 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1052:9) flutter: #115 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:968:5) flutter: #119 _invoke (dart:ui/hooks.dart:261:10) flutter: #120 _drawFrame (dart:ui/hooks.dart:219:3) flutter: (elided 5 frames from class _AssertionError and dart:async)

Row( children: <Widget>[ Padding( padding: EdgeInsets.symmetric( horizontal: 20.0, vertical: 2), child: Text( activePost.user.username, style: TextStyle(fontSize: 16), )), HashTagText( text: activePost.description, basicStyle: TextStyle( fontSize: 14, color: Colors.red), decoratedStyle: TextStyle( fontSize: 14, color: Colors.black), ) )

santa112358 commented 4 years ago

@FareedR Thank you for creating issue and reporting this. You can use getHashtagTextSpan() in RichText instead of using HashtagText(). If you want to fix the problem in your project as soon as possible, I recommend you to do that. Seems like critical bug but not hard to solve. I will update the package to fix this in 24 hours.

santa112358 commented 4 years ago

@FareedR Sorry for being late to fix this. Now I updated the package to v0.1.2.