Skip to content

Wrap the label widget of the Chip in a Flexible. (#11523) - #11554

Merged
Hixie merged 4 commits into
flutter:masterfrom
ameiyil:master
Aug 12, 2017
Merged

Wrap the label widget of the Chip in a Flexible. (#11523)#11554
Hixie merged 4 commits into
flutter:masterfrom
ameiyil:master

Conversation

@ameiyil

@ameiyil ameiyil commented Aug 8, 2017

Copy link
Copy Markdown
Contributor
  • This allows the Chip to constrain the size of its content after taking into account the space occupied by the avatar and delete icon (if they are present)

* This allows the Chip to constrain the size of its content after taking into account the space occupied by the avatar and delete icon (if they are present)
@Hixie

Hixie commented Aug 8, 2017

Copy link
Copy Markdown
Contributor

This needs tests, to verify that chips are acting as expected in various scenarios (most notably, the case you don't want us to regress!).

/// Optionally, adding an avatar or delete icon to the chip should not
/// cause the chip or label to exceed its constrained size.
Future<Null> _testConstrainedLabel(WidgetTester tester,
{CircleAvatar avatar, VoidCallback onDeleted}) async {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please format this more like this:

  Future<Null> _testConstrainedLabel(WidgetTester tester, {
    CircleAvatar avatar, VoidCallback onDeleted,
  }) async {

@Hixie

Hixie commented Aug 9, 2017

Copy link
Copy Markdown
Contributor

This is great, thanks! Let me know when you've adjusted the formatting and I'll land it for you!

@ameiyil

ameiyil commented Aug 9, 2017

Copy link
Copy Markdown
Contributor Author

Adjustment to formatting done! Thanks for the call-out and quick review!

@Hixie

Hixie commented Aug 9, 2017

Copy link
Copy Markdown
Contributor

Thanks! Will land on green.

@ameiyil

ameiyil commented Aug 11, 2017

Copy link
Copy Markdown
Contributor Author

Friendly ping.

@Hixie

Hixie commented Aug 12, 2017

Copy link
Copy Markdown
Contributor

Oops, sorry! Landing now! Thanks again!

@Hixie
Hixie merged commit b156a0f into flutter:master Aug 12, 2017
@Tobiaswk

Tobiaswk commented Aug 17, 2017

Copy link
Copy Markdown

This merge breaks the Chip class for me.

Sample code;

new Row(
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                      new Chip(
                          label: new Text(DateHelper.hoursMinutes(program.airTime),
                              style: new TextStyle(
                                  fontSize: 14.0,
                                  fontWeight: FontWeight.w300))),
                      new Padding(padding: const EdgeInsets.all(5.0)),
                      new Text(program.programName,
                          style: new TextStyle(
                              color: Colors.black54,
                              fontSize: 18.0,
                              fontWeight: FontWeight.w300)),
                    ],
                  )

Error log;

Performing full restart...
Restarted app in 2.065ms.
I/flutter ( 7435): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter ( 7435): The following assertion was thrown during performLayout():
I/flutter ( 7435): RenderFlex children have non-zero flex but incoming width constraints are unbounded.
I/flutter ( 7435): When a row is in a parent that does not provide a finite width constraint, for example if it is in a
I/flutter ( 7435): horizontal scrollable, it will try to shrink-wrap its children along the horizontal axis. Setting a
I/flutter ( 7435): flex on a child (e.g. using a Flexible) indicates that the child is to expand to fill the remaining
I/flutter ( 7435): space in the horizontal direction.
I/flutter ( 7435): These two directives are mutually exclusive. If a parent is to shrink-wrap its child, the child
I/flutter ( 7435): cannot simultaneously expand to fit its parent.
I/flutter ( 7435): The affected RenderFlex is:
I/flutter ( 7435):   RenderFlex#23264 relayoutBoundary=up13 NEEDS-LAYOUT NEEDS-PAINT
I/flutter ( 7435): The creator information is set to:
I/flutter ( 7435):   Row ← Padding ← DecoratedBox ← ConstrainedBox ← Container ← Semantics ← Chip ← Row ← Padding ←
I/flutter ( 7435):   DecoratedBox ← Container ← Listener ← ⋯
I/flutter ( 7435): The nearest ancestor providing an unbounded width constraint is:
I/flutter ( 7435):   RenderFlex#03bd4 relayoutBoundary=up8 NEEDS-LAYOUT NEEDS-PAINT
I/flutter ( 7435):   creator: Row ← Padding ← DecoratedBox ← Container ← Listener ← _GestureSemantics ←
I/flutter ( 7435):   RawGestureDetector ← GestureDetector ← InkWell ← Container ← ProgramItem ← RepaintBoundary-[<1>] ←
I/flutter ( 7435):   ⋯
I/flutter ( 7435):   parentData: offset=Offset(0.0, 0.0) (can use size)
I/flutter ( 7435):   constraints: BoxConstraints(w=371.4, 0.0<=h<=Infinity)
I/flutter ( 7435):   size: MISSING
I/flutter ( 7435):   direction: horizontal
I/flutter ( 7435):   mainAxisAlignment: start
I/flutter ( 7435):   mainAxisSize: max
I/flutter ( 7435):   crossAxisAlignment: center
I/flutter ( 7435):   textBaseline: nullSee also: https://flutter.io/layout/
I/flutter ( 7435): If this message did not help you determine the problem, consider using debugDumpRenderTree():
I/flutter ( 7435):   https://flutter.io/debugging/#rendering-layer
I/flutter ( 7435):   http://docs.flutter.io/flutter/rendering/debugDumpRenderTree.html
I/flutter ( 7435): If none of the above helps enough to fix this problem, please don't hesitate to file a bug:
I/flutter ( 7435):   https://github.com/flutter/flutter/issues/new
I/flutter ( 7435): 
I/flutter ( 7435): When the exception was thrown, this was the stack:
I/flutter ( 7435): #0      RenderFlex.performLayout.<anonymous closure> (package:flutter/src/rendering/flex.dart:500:11)
I/flutter ( 7435): #2      RenderFlex.performLayout (package:flutter/src/rendering/flex.dart:462:16)
I/flutter ( 7435): #3      RenderObject.layout (package:flutter/src/rendering/object.dart:1892:7)
I/flutter ( 7435): #4      RenderPadding.performLayout (package:flutter/src/rendering/shifted_box.dart:160:11)
I/flutter ( 7435): #5      RenderObject.layout (package:flutter/src/rendering/object.dart:1892:7)
I/flutter ( 7435): #6      RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:106:13)
I/flutter ( 7435): #7      RenderObject.layout (package:flutter/src/rendering/object.dart:1892:7)
I/flutter ( 7435): #8      RenderConstrainedBox.performLayout (package:flutter/src/rendering/proxy_box.dart:256:13)
I/flutter ( 7435): #9      RenderObject.layout (package:flutter/src/rendering/object.dart:1892:7)
I/flutter ( 7435): #10     RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:106:13)
I/flutter ( 7435): #11     RenderObject.layout (package:flutter/src/rendering/object.dart:1892:7)
I/flutter ( 7435): #12     RenderFlex.performLayout (package:flutter/src/rendering/flex.dart:541:15)
I/flutter ( 7435): #13     RenderObject.layout (package:flutter/src/rendering/object.dart:1892:7)
I/flutter ( 7435): #14     RenderPadding.performLayout (package:flutter/src/rendering/shifted_box.dart:160:11)
I/flutter ( 7435): #15     RenderObject.layout (package:flutter/src/rendering/object.dart:1892:7)
I/flutter ( 7435): #16     RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:106:13)
I/flutter ( 7435): #17     RenderObject.layout (package:flutter/src/rendering/object.dart:1892:7)
I/flutter ( 7435): #18     RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:106:13)
I/flutter ( 7435): #19     RenderObject.layout (package:flutter/src/rendering/object.dart:1892:7)
I/flutter ( 7435): #20     RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:106:13)
I/flutter ( 7435): #21     RenderObject.layout (package:flutter/src/rendering/object.dart:1892:7)
I/flutter ( 7435): #22     RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:106:13)
I/flutter ( 7435): #23     RenderObject.layout (package:flutter/src/rendering/object.dart:1892:7)
I/flutter ( 7435): #24     RenderSliverList.performLayout.advance (package:flutter/src/rendering/sliver_list.dart:200:17)
I/flutter ( 7435): #25     RenderSliverList.performLayout (package:flutter/src/rendering/sliver_list.dart:233:19)
I/flutter ( 7435): #26     RenderObject.layout (package:flutter/src/rendering/object.dart:1892:7)
I/flutter ( 7435): #27     RenderSliverPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:144:11)
I/flutter ( 7435): #28     RenderObject.layout (package:flutter/src/rendering/object.dart:1892:7)
I/flutter ( 7435): #29     RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:248:13)
I/flutter ( 7435): #30     RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:899:12)
I/flutter ( 7435): #31     RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:823:20)
I/flutter ( 7435): #32     RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 7435): #33     PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1056:18)
I/flutter ( 7435): #34     BindingBase&SchedulerBinding&GestureBinding&ServicesBinding&RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:251:19)
I/flutter ( 7435): #35     BindingBase&SchedulerBinding&GestureBinding&ServicesBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:504:22)
I/flutter ( 7435): #36     BindingBase&SchedulerBinding&GestureBinding&ServicesBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:189:5)
I/flutter ( 7435): #37     BindingBase&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:695:15)
I/flutter ( 7435): #38     BindingBase&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:643:9)
I/flutter ( 7435): #39     _invoke (file:///b/build/slave/Linux_Engine/build/src/flutter/lib/ui/hooks.dart:86)
I/flutter ( 7435): #40     _drawFrame (file:///b/build/slave/Linux_Engine/build/src/flutter/lib/ui/hooks.dart:75)
I/flutter ( 7435): (elided one frame from class _AssertionError)
I/flutter ( 7435): 
I/flutter ( 7435): The following RenderObject was being processed when the exception was fired:
I/flutter ( 7435):   RenderFlex#23264 relayoutBoundary=up13 NEEDS-LAYOUT NEEDS-PAINT
I/flutter ( 7435):   creator: Row ← Padding ← DecoratedBox ← ConstrainedBox ← Container ← Semantics ← Chip ← Row ←
I/flutter ( 7435):   Padding ← DecoratedBox ← Container ← Listener ← ⋯
I/flutter ( 7435):   parentData: offset=Offset(0.0, 0.0) (can use size)
I/flutter ( 7435):   constraints: BoxConstraints(0.0<=w<=Infinity, h=32.0)
I/flutter ( 7435):   size: MISSING
I/flutter ( 7435):   direction: horizontal
I/flutter ( 7435):   mainAxisAlignment: start
I/flutter ( 7435):   mainAxisSize: min
I/flutter ( 7435):   crossAxisAlignment: center
I/flutter ( 7435):   textBaseline: null
I/flutter ( 7435): This RenderObject had the following child:
I/flutter ( 7435):   RenderParagraph#d4215 NEEDS-LAYOUT NEEDS-PAINT
I/flutter ( 7435): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter ( 7435): Another exception was thrown: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1429 pos 12: 'hasSize': is not true.
I/flutter ( 7435): Another exception was thrown: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1429 pos 12: 'hasSize': is not true.
I/flutter ( 7435): Another exception was thrown: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1429 pos 12: 'hasSize': is not true.
I/flutter ( 7435): Another exception was thrown: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1429 pos 12: 'hasSize': is not true.
I/flutter ( 7435): Another exception was thrown: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1429 pos 12: 'hasSize': is not true.
I/flutter ( 7435): Another exception was thrown: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1429 pos 12: 'hasSize': is not true.
I/flutter ( 7435): Another exception was thrown: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1429 pos 12: 'hasSize': is not true.
I/flutter ( 7435): Another exception was thrown: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1429 pos 12: 'hasSize': is not true.
I/flutter ( 7435): Another exception was thrown: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1429 pos 12: 'hasSize': is not true.
I/flutter ( 7435): Another exception was thrown: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1429 pos 12: 'hasSize': is not true.
I/flutter ( 7435): Another exception was thrown: 'package:flutter/src/rendering/sliver_multi_box_adaptor.dart': Failed assertion: line 428 pos 12: 'child.hasSize': is not true.
I/flutter ( 7435): Another exception was thrown: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1429 pos 12: 'hasSize': is not true.
I/flutter ( 7435): Another exception was thrown: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1429 pos 12: 'hasSize': is not true.
I/flutter ( 7435): Another exception was thrown: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1429 pos 12: 'hasSize': is not true.

If I revert this commit it goes back to working.

@Hixie

Hixie commented Aug 17, 2017

Copy link
Copy Markdown
Contributor

I'm working on a fix.

@Hixie

Hixie commented Aug 17, 2017

Copy link
Copy Markdown
Contributor

Fix in #11669

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants