simc / auto_size_text

Flutter widget that automatically resizes text to fit perfectly within its bounds.
https://pub.dev/packages/auto_size_text
MIT License
2.05k stars 236 forks source link

Not working when i wrap it with Expanded() inside a Row #28

Open Basher7 opened 5 years ago

Basher7 commented 5 years ago

Version

Code sample

Row(
   mainAxisAlignment: MainAxisAlignment.start,
   children: <Widget>[
        Expanded(
             flex: 1,
             child: Icon(
                 Icons.camera,
                  color: Colors.black,
                ),
             ),
             Expanded(
                 flex: 6,
                 child: Container(
                    padding: EdgeInsets.only(left: 10),
                    child: AutoSizeText(
                      "Product Image",
                      maxLines: 2,
                      style: TextStyle(
                        color: Colors.white,
                        fontWeight: FontWeight.bold,
                      ),
                      minFontSize: 12,
                      maxFontSize: double.infinity,
                      ),
                    ),
                  )
                ],
              ),

I/flutter (11414): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════ I/flutter (11414): The following assertion was thrown during performLayout(): I/flutter (11414): LayoutBuilder does not support returning intrinsic dimensions. I/flutter (11414): Calculating the intrinsic dimensions would require running the layout callback speculatively, which I/flutter (11414): might mutate the live render object tree. I/flutter (11414): I/flutter (11414): When the exception was thrown, this was the stack: I/org.webrtc.Logging(11414): EglRenderer: Duration: 4001 ms. Frames received: 0. Dropped: 0. Rendered: 0. Render fps: .0. Average render time: NA. Average swapBuffer time: NA. I/org.webrtc.Logging(11414): EglRenderer: Duration: 4005 ms. Frames received: 0. Dropped: 0. Rendered: 0. Render fps: .0. Average render time: NA. Average swapBuffer time: NA. I/flutter (11414): #0 _RenderLayoutBuilder._debugThrowIfNotCheckingIntrinsics. I/flutter (11414): #1 _RenderLayoutBuilder._debugThrowIfNotCheckingIntrinsics I/flutter (11414): #2 _RenderLayoutBuilder.computeMaxIntrinsicWidth I/flutter (11414): #3 RenderBox._computeIntrinsicDimension. I/flutter (11414): #4 InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #5 RenderBox._computeIntrinsicDimension I/flutter (11414): #6 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #7 RenderPadding.computeMaxIntrinsicWidth I/flutter (11414): #8 RenderBox._computeIntrinsicDimension. I/flutter (11414): #9 InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #10 RenderBox._computeIntrinsicDimension I/flutter (11414): #11 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #12 RenderFlex.computeMaxIntrinsicWidth. I/flutter (11414): #13 RenderFlex._getIntrinsicSize I/flutter (11414): #14 RenderFlex.computeMaxIntrinsicWidth I/flutter (11414): #15 RenderBox._computeIntrinsicDimension. I/flutter (11414): #16 InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #17 RenderBox._computeIntrinsicDimension I/flutter (11414): #18 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #19 RenderShiftedBox.computeMaxIntrinsicWidth I/flutter (11414): #20 RenderBox._computeIntrinsicDimension. I/flutter (11414): #21 InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #22 RenderBox._computeIntrinsicDimension I/flutter (11414): #23 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #24 RenderPadding.computeMaxIntrinsicWidth I/flutter (11414): #25 RenderBox._computeIntrinsicDimension. I/flutter (11414): #26 InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #27 RenderBox._computeIntrinsicDimension I/flutter (11414): #28 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #29 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.computeMaxIntrinsicWidth I/flutter (11414): #30 RenderBox._computeIntrinsicDimension. I/flutter (11414): #31 InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #32 RenderBox._computeIntrinsicDimension I/flutter (11414): #33 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #34 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.computeMaxIntrinsicWidth I/flutter (11414): #35 RenderBox._computeIntrinsicDimension. I/flutter (11414): #36 InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #37 RenderBox._computeIntrinsicDimension I/flutter (11414): #38 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #39 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.computeMaxIntrinsicWidth I/flutter (11414): #40 RenderBox._computeIntrinsicDimension. I/flutter (11414): #41 InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #42 RenderBox._computeIntrinsicDimension I/flutter (11414): #43 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #44 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.computeMaxIntrinsicWidth I/flutter (11414): #45 RenderBox._computeIntrinsicDimension. I/flutter (11414): #46 InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #47 RenderBox._computeIntrinsicDimension I/flutter (11414): #48 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #49 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.computeMaxIntrinsicWidth I/flutter (11414): #50 RenderBox._computeIntrinsicDimension. I/flutter (11414): #51 InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #52 RenderBox._computeIntrinsicDimension I/flutter (11414): #53 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #54 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.computeMaxIntrinsicWidth I/flutter (11414): #55 RenderConstrainedBox.computeMaxIntrinsicWidth I/flutter (11414): #56 RenderBox._computeIntrinsicDimension. I/flutter (11414): #57 InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #58 RenderBox._computeIntrinsicDimension I/flutter (11414): #59 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #60 _RenderInputPadding.computeMaxIntrinsicWidth I/flutter (11414): #61 RenderBox._computeIntrinsicDimension. I/flutter (11414): #62 InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #63 RenderBox._computeIntrinsicDimension I/flutter (11414): #64 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #65 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.computeMaxIntrinsicWidth I/flutter (11414): #66 RenderBox._computeIntrinsicDimension. I/flutter (11414): #67 InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #68 RenderBox._computeIntrinsicDimension I/flutter (11414): #69 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #70 RenderPadding.computeMaxIntrinsicWidth I/flutter (11414): #71 RenderBox._computeIntrinsicDimension. I/flutter (11414): #72 InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #73 RenderBox._computeIntrinsicDimension I/flutter (11414): #74 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #75 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.computeMaxIntrinsicWidth I/flutter (11414): #76 RenderConstrainedBox.computeMaxIntrinsicWidth I/flutter (11414): #77 RenderBox._computeIntrinsicDimension. I/flutter (11414): #78 InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #79 RenderBox._computeIntrinsicDimension I/flutter (11414): #80 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #81 RenderFlex.computeMaxIntrinsicWidth. I/flutter (11414): #82 RenderFlex._getIntrinsicSize I/flutter (11414): #83 RenderFlex.computeMaxIntrinsicWidth I/flutter (11414): #84 RenderBox._computeIntrinsicDimension. I/flutter (11414): #85 InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #86 RenderBox._computeIntrinsicDimension I/flutter (11414): #87 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #88 RenderFlex.computeMaxIntrinsicWidth. I/flutter (11414): #89 RenderFlex._getIntrinsicSize I/flutter (11414): #90 RenderFlex.computeMaxIntrinsicWidth I/flutter (11414): #91 RenderBox._computeIntrinsicDimension. I/flutter (11414): #92 InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #93 RenderBox._computeIntrinsicDimension I/flutter (11414): #94 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #95 _RenderSingleChildViewport.computeMaxIntrinsicWidth I/flutter (11414): #96 RenderBox._computeIntrinsicDimension. I/flutter (11414): #97 InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #98 RenderBox._computeIntrinsicDimension I/flutter (11414): #99 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #100 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.computeMaxIntrinsicWidth I/flutter (11414): #101 RenderBox._computeIntrinsicDimension. I/flutter (11414): #102 InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #103 RenderBox._computeIntrinsicDimension I/flutter (11414): #104 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #105 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.computeMaxIntrinsicWidth I/flutter (11414): #106 RenderBox._computeIntrinsicDimension. I/flutter (11414): #107 InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #108 RenderBox._computeIntrinsicDimension I/flutter (11414): #109 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #110 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.computeMaxIntrinsicWidth I/flutter (11414): #111 RenderBox._computeIntrinsicDimension. I/flutter (11414): #112 InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #113 RenderBox._computeIntrinsicDimension I/flutter (11414): #114 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #115 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.computeMaxIntrinsicWidth I/flutter (11414): #116 RenderBox._computeIntrinsicDimension. I/flutter (11414): #117 InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #118 RenderBox._computeIntrinsicDimension I/flutter (11414): #119 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #120 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.computeMaxIntrinsicWidth I/flutter (11414): #121 RenderBox._computeIntrinsicDimension. I/flutter (11414): #122 InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #123 RenderBox._computeIntrinsicDimension I/flutter (11414): #124 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #125 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.computeMaxIntrinsicWidth I/flutter (11414): #126 RenderBox._computeIntrinsicDimension. I/flutter (11414): #127 InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #128 RenderBox._computeIntrinsicDimension I/flutter (11414): #129 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #130 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.computeMaxIntrinsicWidth I/flutter (11414): #131 RenderBox._computeIntrinsicDimension. I/flutter (11414): #132 InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #133 RenderBox._computeIntrinsicDimension I/flutter (11414): #134 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #135 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.computeMaxIntrinsicWidth I/flutter (11414): #136 RenderBox._computeIntrinsicDimension. I/flutter (11414): #137 InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #138 RenderBox._computeIntrinsicDimension I/flutter (11414): #139 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #140 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.computeMaxIntrinsicWidth I/flutter (11414): #141 RenderBox._computeIntrinsicDimension. I/flutter (11414): #142 InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #143 RenderBox._computeIntrinsicDimension I/flutter (11414): #144 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #145 RenderPadding.computeMaxIntrinsicWidth I/flutter (11414): #146 RenderBox._computeIntrinsicDimension. I/flutter (11414): #147 InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #148 RenderBox._computeIntrinsicDimension I/flutter (11414): #149 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #150 RenderFlex.computeMaxIntrinsicWidth. I/flutter (11414): #151 RenderFlex._getIntrinsicSize I/flutter (11414): #152 RenderFlex.computeMaxIntrinsicWidth I/flutter (11414): #153 RenderBox._computeIntrinsicDimension. I/flutter (11414): #154 __InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:281:23) I/flutter (11414): #155 RenderBox._computeIntrinsicDimension I/flutter (11414): #156 RenderBox.getMaxIntrinsicWidth I/flutter (11414): #157 RenderIntrinsicWidth.performLayout I/flutter (11414): #158 RenderObject.layout I/flutter (11414): #159 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout I/flutter (11414): #160 RenderObject.layout I/flutter (11414): #161 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout I/flutter (11414): #162 RenderObject.layout I/flutter (11414): #163 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout I/flutter (11414): #164 _RenderCustomClip.performLayout I/flutter (11414): #165 RenderObject.layout I/flutter (11414): #166 RenderConstrainedBox.performLayout I/flutter (11414): #167 RenderObject.layout I/flutter (11414): #168 RenderPositionedBox.performLayout I/flutter (11414): #169 RenderObject.layout I/flutter (11414): #170 RenderPadding.performLayout I/flutter (11414): #171 RenderObject.layout I/flutter (11414): #172 RenderPadding.performLayout I/flutter (11414): #173 RenderObject.layout I/flutter (11414): #174 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout I/flutter (11414): #175 RenderObject.layout I/flutter (11414): #176 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout I/flutter (11414): #177 RenderObject.layout I/flutter (11414): #178 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout I/flutter (11414): #179 RenderObject.layout I/flutter (11414): #180 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout I/flutter (11414): #181 RenderObject.layout I/flutter (11414): #182 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout I/flutter (11414): #183 RenderObject.layout I/flutter (11414): #184 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout I/flutter (11414): #185 RenderObject.layout I/flutter (11414): #186 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout I/flutter (11414): #187 RenderOffstage.performLayout I/flutter (11414): #188 RenderObject.layout I/flutter (11414): #189 RenderStack.performLayout I/flutter (11414): #190 RenderObject._layoutWithoutResize I/flutter (11414): #191 PipelineOwner.flushLayout I/flutter (11414): #192 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding.drawFrame I/flutter (11414): #193 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame I/flutter (11414): #194 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback I/flutter (11414): #195 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback I/flutter (11414): #196 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame I/flutter (11414): #197 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame I/flutter (11414): #201 _invoke (dart:ui/hooks.dart:219:10) I/flutter (11414): #202 _drawFrame (dart:ui/hooks.dart:178:3) I/flutter (11414): (elided 3 frames from package dart:async) I/flutter (11414): I/flutter (11414): The following RenderObject was being processed when the exception was fired: I/flutter (11414): RenderIntrinsicWidth#e6f5b relayoutBoundary=up5 NEEDS-LAYOUT NEEDS-PAINT I/flutter (11414): creator: IntrinsicWidth ← DefaultTextStyle ← AnimatedDefaultTextStyle ← I/flutter (11414): _InkFeatures-[GlobalKey#759c7 ink renderer] ← NotificationListener ← I/flutter (11414): CustomPaint ← _ShapeBorderPaint ← PhysicalShape ← _MaterialInterior ← Material ← ConstrainedBox ← I/flutter (11414): Center ← ⋯ I/flutter (11414): parentData: (can use size) I/flutter (11414): constraints: BoxConstraints(280.0<=w<=453.3, 0.0<=h<=743.3) I/flutter (11414): size: MISSING I/flutter (11414): stepWidth: null I/flutter (11414): stepHeight: null I/flutter (11414): This RenderObject had the following descendants (showing up to depth 5): I/flutter (11414): RenderFlex#c077d NEEDS-LAYOUT NEEDS-PAINT I/flutter (11414): RenderPadding#97390 NEEDS-LAYOUT NEEDS-PAINT I/flutter (11414): RenderSemanticsAnnotations#c1d20 NEEDS-LAYOUT NEEDS-PAINT I/flutter (11414): RenderFlex#e223e NEEDS-LAYOUT NEEDS-PAINT I/flutter (11414): RenderParagraph#05686 NEEDS-LAYOUT NEEDS-PAINT I/flutter (11414): RenderConstrainedBox#a5fbb NEEDS-LAYOUT NEEDS-PAINT I/flutter (11414): RenderPadding#2b5ee NEEDS-LAYOUT NEEDS-PAINT I/flutter (11414): RenderRepaintBoundary#8a521 NEEDS-LAYOUT NEEDS-PAINT I/flutter (11414): RenderCustomPaint#1778d NEEDS-LAYOUT NEEDS-PAINT I/flutter (11414): RenderRepaintBoundary#cfec9 NEEDS-LAYOUT NEEDS-PAINT I/flutter (11414): RenderPadding#ffc6c NEEDS-LAYOUT NEEDS-PAINT I/flutter (11414): RenderFlex#dcdfd NEEDS-LAYOUT NEEDS-PAINT I/flutter (11414): RenderPadding#354dc NEEDS-LAYOUT NEEDS-PAINT I/flutter (11414): RenderSemanticsAnnotations#736aa NEEDS-LAYOUT NEEDS-PAINT I/flutter (11414): RenderPadding#a4cb0 NEEDS-LAYOUT NEEDS-PAINT I/flutter (11414): RenderSemanticsAnnotations#88516 NEEDS-LAYOUT NEEDS-PAINT I/flutter (11414): ════════════════════════════════════════════════════════════════════════════════════════════════════ I/flutter (11414): Another exception was thrown: RenderBox was not laid out: RenderIntrinsicWidth#e6f5b relayoutBoundary=up5 NEEDS-PAINT I/flutter (11414): Another exception was thrown: RenderBox was not laid out: _RenderInkFeatures#408dd relayoutBoundary=up4 NEEDS-PAINT I/flutter (11414): Another exception was thrown: RenderBox was not laid out: RenderCustomPaint#d0cac relayoutBoundary=up3 NEEDS-PAINT I/flutter (11414): Another exception was thrown: RenderBox was not laid out: RenderPhysicalShape#1f231 relayoutBoundary=up2 NEEDS-PAINT I/flutter (11414): Another exception was thrown: 'package:flutter/src/rendering/shifted_box.dart': Failed assertion: line 314 pos 12: 'child.hasSize': is not true. I/flutter (11414): Another exception was thrown: RenderBox was not laid out: RenderLeaderLayer#f741d NEEDS-LAYOUT NEEDS-PAINT I/flutter (11414): Another exception was thrown: RenderBox was not laid out: RenderLeaderLayer#6a6ce NEEDS-LAYOUT NEEDS-PAINT I/flutter (11414): Another exception was thrown: RenderBox was not laid out: RenderLeaderLayer#c1f2a NEEDS-LAYOUT NEEDS-PAINT I/flutter (11414): Another exception was thrown: RenderBox was not laid out: RenderPhysicalShape#1f231 relayoutBoundary=up2 I/flutter (11414): Another exception was thrown: LayoutBuilder does not support returning intrinsic dimensions. I/flutter (11414): Another exception was thrown: RenderBox was not laid out: RenderIntrinsicWidth#e6f5b relayoutBoundary=up5 NEEDS-PAINT I/flutter (11414): Another exception was thrown: RenderBox was not laid out: _RenderInkFeatures#408dd relayoutBoundary=up4 NEEDS-PAINT I/flutter (11414): Another exception was thrown: RenderBox was not laid out: RenderCustomPaint#d0cac relayoutBoundary=up3 NEEDS-PAINT I/flutter (11414): Another exception was thrown: RenderBox was not laid out: RenderPhysicalShape#1f231 relayoutBoundary=up2 NEEDS-PAINT I/flutter (11414): Another exception was thrown: 'package:flutter/src/rendering/shifted_box.dart': Failed assertion: line 314 pos 12: 'child.hasSize': is not true. I/flutter (11414): Another exception was thrown: RenderBox was not laid out: RenderPhysicalShape#1f231 relayoutBoundary=up2 I/flutter (11414): Another exception was thrown: LayoutBuilder does not support returning intrinsic dimensions. I/flutter (11414): Another exception was thrown: RenderBox was not laid out: RenderIntrinsicWidth#e6f5b relayoutBoundary=up5 NEEDS-PAINT I/flutter (11414): Another exception was thrown: RenderBox was not laid out: _RenderInkFeatures#408dd relayoutBoundary=up4 NEEDS-PAINT I/flutter (11414): Another exception was thrown: RenderBox was not laid out: RenderCustomPaint#d0cac relayoutBoundary=up3 NEEDS-PAINT I/flutter (11414): Another exception was thrown: RenderBox was not laid out: RenderPhysicalShape#1f231 relayoutBoundary=up2 NEEDS-PAINT I/flutter (11414): Another exception was thrown: 'package:flutter/src/rendering/shifted_box.dart': Failed assertion: line 314 pos 12: 'child.hasSize': is not true. I/flutter (11414): Another exception was thrown: RenderBox was not laid out: RenderPhysicalShape#1f231 relayoutBoundary=up2 Application finished. Exited (sigterm)

Ahmadre commented 5 years ago

Did you try FittedBox ?

Sent from my Pixel 2 XL using FastHub

simc commented 5 years ago

Your code works fine for me. Could you please share a small sample project which shows the error?

Basher7 commented 5 years ago

Did you try FittedBox ?

Sent from my Pixel 2 XL using FastHub

yes, not working FittedBox

Basher7 commented 5 years ago

Your code works fine for me. Could you please share a small sample project which shows the error?

After Upgrade Flutter sdk version from 1.5.4-hotfix.2 to 1.7.8+hotfix.4 it's working fine for small android devices. But large android device (ex: TAB) it's not working.

Sample Project

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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.green,
        buttonColor: Colors.green,
        backgroundColor: Colors.green[300],
      ),
      debugShowCheckedModeBanner: false,
      home: MyHomePage(title: 'Flutter Demo'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  BuildContext _context;
  double mainWidth = 0.0;
  double mainHeight = 0.0;
  bool smallDevice = false;

  TextEditingController inputCtrlr = new TextEditingController();

  @override
  void initState() {
    super.initState();
  }

  _addnewProduct() {
    showDialog(
        context: _context,
        barrierDismissible: false,
        builder: (_) => new AlertDialog(
              title: Column(
                children: <Widget>[
                  new Text("New Product"),
                  Divider(),
                ],
              ),
              content: Row(
                mainAxisAlignment: MainAxisAlignment.start,
                children: <Widget>[
                  Expanded(
                    flex: 2,
                    child: TextFormField(
                      autofocus: true,
                      controller: inputCtrlr,
                      keyboardType: TextInputType.number,
                      decoration: InputDecoration(labelText: "Quantity *"),
                    ),
                  ),
                  Expanded(
                    flex: 2,
                    child: Container(
                      height: 45,
                      padding: EdgeInsets.only(left: 10),
                      child: _takeImageBtn("Product Image"),
                    ),
                  )
                ],
              ),
              actions: <Widget>[
                FlatButton(
                    child: const Text('Done'),
                    onPressed: () {
                      Navigator.pop(context);
                    }),
              ],
            ));
  }

  Widget _takeImageBtn(String title) {
    return RaisedButton(
      padding: EdgeInsets.only(left: 5),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.start,
        children: <Widget>[
          Expanded(
            flex: 1,
            child: Icon(
              Icons.camera,
              color: Colors.black,
              size: smallDevice ? 18 : 23,
            ),
          ),
          Expanded(
            flex: 6,
            child: Container(
              padding: EdgeInsets.only(left: 10),
              child: AutoSizeText(
                title,
                softWrap: true,
                style: TextStyle(
                  color: Colors.white,
                  fontWeight: FontWeight.bold,
                ),
                maxLines: 2,
                overflow: TextOverflow.clip,
                minFontSize: 10,
                maxFontSize: double.infinity,
              ),
            ),
          )
        ],
      ),
      onPressed: () {
        print("Working fine...");
      },
    );
  }

  @override
  Widget build(BuildContext context) {
    _context = context;
    mainWidth = MediaQuery.of(_context).size.width;
    mainHeight = MediaQuery.of(_context).size.height;
    smallDevice = mainWidth < 450 ? true : false;
    return Scaffold(
        appBar: AppBar(
          title: Text(widget.title),
        ),
        body: SafeArea(
          top: false,
          bottom: false,
          child: SingleChildScrollView(
              physics: NeverScrollableScrollPhysics(),
              child: Center(
                child: RaisedButton(
                  child: AutoSizeText(
                    "Details",
                    softWrap: true,
                    style: TextStyle(
                      color: Colors.white,
                      fontWeight: FontWeight.bold,
                    ),
                    maxLines: 1,
                    overflow: TextOverflow.clip,
                    minFontSize: 12,
                    maxFontSize: double.infinity,
                  ),
                  onPressed: _addnewProduct,
                ),
              )),
        ));
  }
}

@leisim

Thanks in advance

narcodico commented 5 years ago

This is an actual issue. If maxFontSize is properly set it will work fine. But that defeats the purpose of the AutoSizeText being able to adjust based on available space. At the moment AutoSizeText inside an Expanded placed in a Row will overflow, unless a proper maxFontSize is set. Any plans on fixing this @leisim ?

simc commented 5 years ago

@RollyPeres

Thanks for verifying. I'm going to fix it.

PixsaOJ commented 4 years ago

Is this fixed ? what should I do? I have Expanded>Column>Flatbutton and trying to do label: AutoSizeText() . I added maxFontSize but still not working.

tudor07 commented 4 years ago

Still happening, any updates?

tudor07 commented 4 years ago

For me I had to specify minFontSize to make it work

Bryanx commented 4 years ago

You can wrap AutoSizeText in a ConstrainedBox and give it a max width.

RosilBelli commented 4 years ago

It is still happening here with me. I'm on Flutter beta 1.21.

rohan20 commented 3 years ago

I wrapped the Row inside a SizedBox and gave it a width of double.maxFinite to make it work:

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      width: double.maxFinite,
      child: Row(
        mainAxisSize: isSmall ? MainAxisSize.min : MainAxisSize.max,
        children: [
          ...
          SizedBox(width: 16),
          Expanded(
            flex: isSmall ? 0 : 1,
            child: AutoSizeText(text, maxLines: 1, textAlign: TextAlign.center),
          ),
          SizedBox(width: 16),
          ...,
        ],
      ),
    );
maares commented 3 years ago

Hi everyone, has someone come across with an alternative to resize the text?. @Basher7, as it seems this issue is live for a very long time.

thanks in advance

PixsaOJ commented 3 years ago

I probably stopped using Flutter because of this

ventr1x commented 2 years ago

Sadly this plugin is massively bugged. using it 5 minutes I found 3 major bugs.

Most of the reported issues can be fixed with LayoutBuilder around the widget to get the constraints. Any kind of flex layout and this will become like russian roulette.

This is very far from production ready and also seem to be abadonded on top of it. I suggest visiting a school for simple math education first before publishing widgets.

simc commented 2 years ago

@ventr1x This is an open source package. Please read the licence if you don't know what that means. And instead of writing snarky comments how about you open a PR to fix issues you discovered.

Also, the package has not been abandoned and there is a massive rewrite that fixes the flex issue and many more.

Edit: Maybe you also find the Flutter Code of Conduct helpful.

danielrrys commented 2 years ago

Does anyone know when the new version will be released to fix this bug ? Thank you. 😁

Ahmadre commented 8 months ago

Sadly this plugin is massively bugged. using it 5 minutes I found 3 major bugs.

  • any fractions in minFontSize/maxFontSize causes my layout to explode. rounding it to double "works"

  • wrapWords does NOT work reliably, one of two examples instantly did not wrap the words (especially long one word texts seem to get ignored entirely while they should be overflowed)

  • There are multiple math issues with minFontSize/MaxFontSize, e.g. the widget basically craps out when min is higher (shouldn't happen but shows how extremely unreliable and untested this is)

Most of the reported issues can be fixed with LayoutBuilder around the widget to get the constraints. Any kind of flex layout and this will become like russian roulette.

This is very far from production ready and also seem to be abadonded on top of it. I suggest visiting a school for simple math education first before publishing widgets.

Reported!

Github is not a place to talk like this.