Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crop() widget not working #32

Open
filipppp opened this issue Nov 2, 2019 · 1 comment
Open

Crop() widget not working #32

filipppp opened this issue Nov 2, 2019 · 1 comment

Comments

@filipppp
Copy link

filipppp commented Nov 2, 2019

When try to use the widget with and without the aspectRation property, it always fails with a BoxConstraint.

`════════ Exception caught by rendering library ═════════════════════════════════════════════════════
The following assertion was thrown during performLayout():
BoxConstraints forces an infinite height.

These invalid constraints were provided to RenderSemanticsGestureHandler's layout() function by the following function, which probably computed the invalid constraints in question:
RenderConstrainedBox.performLayout (package:flutter/src/rendering/proxy_box.dart:259:13)
The offending constraints were: BoxConstraints(w=411.4, h=Infinity)
User-created ancestor of the error-causing widget was:
Crop-[LabeledGlobalKey#45848] file:///C:/Users/Filip/Desktop/Projekte/Diplomarbeit/listassist/lib/pages/picture-show.dart:182:15
When the exception was thrown, this was the stack:
#0 BoxConstraints.debugAssertIsValid..throwError (package:flutter/src/rendering/box.dart:501:9)
#1 BoxConstraints.debugAssertIsValid. (package:flutter/src/rendering/box.dart:548:21)
#2 BoxConstraints.debugAssertIsValid (package:flutter/src/rendering/box.dart:552:6)
#3 RenderObject.layout (package:flutter/src/rendering/object.dart:1618:24)
#4 RenderConstrainedBox.performLayout (package:flutter/src/rendering/proxy_box.dart:259:13)
...
The following RenderObject was being processed when the exception was fired: RenderConstrainedBox#a9775 relayoutBoundary=up3 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
... constraints: BoxConstraints(0.0<=w<=411.4, 0.0<=h<=Infinity)
... size: MISSING
... additionalConstraints: BoxConstraints(biggest)
RenderObject: RenderConstrainedBox#a9775 relayoutBoundary=up3 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
constraints: BoxConstraints(0.0<=w<=411.4, 0.0<=h<=Infinity)
size: MISSING
additionalConstraints: BoxConstraints(biggest)
... child: RenderSemanticsGestureHandler#ae6f2 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData:
... constraints: MISSING
... size: MISSING
... gestures:
... child: RenderPointerListener#10954 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData:
... constraints: MISSING
... size: MISSING
... behavior: opaque
... listeners: down
... child: RenderCustomPaint#82cbb NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData:
... constraints: MISSING
... size: MISSING
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ (2) Exception caught by rendering library ═════════════════════════════════════════════════
RenderBox was not laid out: RenderConstrainedBox#a9775 relayoutBoundary=up3 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1681 pos 12: 'hasSize'
User-created ancestor of the error-causing widget was:
Center file:///C:/Users/Filip/Desktop/Projekte/Diplomarbeit/listassist/lib/pages/picture-show.dart:148:13
════════════════════════════════════════════════════════════════════════════════════════════════════`

My code:

            if (_imageFile != null) ...[
              Crop(
                key: cropKey,
                image: FileImage(_imageFile),
                aspectRatio: 4.0 / 3.0,
              ),
            ]
@lykhonis
Copy link
Owner

You need to make sure the widget is wrapped by some container that enforces size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants