jesusrp98 / expand_widget

Ability to easily expand and retract a widget collection or text
https://pub.dev/packages/expand_widget
GNU General Public License v3.0
45 stars 22 forks source link

expandedHint: Consider applying a flex factor (e.g. using an Expanded widget) to force the children of the RenderFlex to fit within the available space #17

Closed Abdullahfoysal closed 3 years ago

jesusrp98 commented 4 years ago

Do you mean something like this?

This code has been extracted from the 'ExpandChild' widget, and wrapped the child widget with an Expanded widget.

        ClipRect(
          child: Expanded(
            child: Align(
              alignment: Alignment.topCenter,
              heightFactor: _heightFactor.value,
              child: child,
            ),
          ),
        ),
Abdullahfoysal commented 4 years ago

thanks

jesusrp98 commented 4 years ago

This feature will be implemented in the v1.1.0 update coming in the next few days!

jesusrp98 commented 4 years ago

This feature is throwing error when implemented as shown in the comment above:

I/flutter ( 8082): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter ( 8082): The following assertion was thrown while applying parent data.:
I/flutter ( 8082): Incorrect use of ParentDataWidget.
I/flutter ( 8082): The ParentDataWidget Expanded(flex: 1) wants to apply ParentData of type FlexParentData to a
I/flutter ( 8082): RenderObject, which has been set up to accept ParentData of incompatible type ParentData.
I/flutter ( 8082): Usually, this means that the Expanded widget has the wrong ancestor RenderObjectWidget. Typically,
I/flutter ( 8082): Expanded widgets are placed directly inside Flex widgets.
I/flutter ( 8082): The offending Expanded is currently placed inside a ClipRect widget.
I/flutter ( 8082): The ownership chain for the RenderObject that received the incompatible parent data was:
I/flutter ( 8082):   Align ← Expanded ← ClipRect ← Column ← AnimatedBuilder ← ExpandChild ← Column ← Padding ←
I/flutter ( 8082): Semantics ← DefaultTextStyle ← ⋯

Any idea on how to solve it @Abdullahfoysal ?

jesusrp98 commented 3 years ago

Closed due to inactivity.