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

Feat/gh 25/images form #62

Merged
merged 14 commits into from
Apr 6, 2023
Merged

Feat/gh 25/images form #62

merged 14 commits into from
Apr 6, 2023

Conversation

andre-tm-hui
Copy link

Created the UI for uploading and cropping images. Closes #25.

@github-actions
Copy link

github-actions bot commented Apr 2, 2023

Visit the preview URL for this PR (updated for commit 1fa7719):

https://collaction-development--pr62-feat-gh-25-images-fo-v4xxm3yv.web.app

(expires Tue, 11 Apr 2023 04:47:38 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 2cf09e8dbf51d2eab3fc6679b673d248bc8047bb

Copy link
Member

@dromerolovo dromerolovo left a comment

Choose a reason for hiding this comment

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

So far the Image form and the crop interface are working great

Comment on lines 140 to 142
widget.callback == null
? null
: widget.callback!(_validationOutput.error ? null : _image);
Copy link
Member

Choose a reason for hiding this comment

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

I think that widget.callback?.call(_validationOutput.error ? null : _image) is cleaner in these cases

Copy link
Author

Choose a reason for hiding this comment

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

Agreed, will make the change

'image/png',
];
late DropzoneViewController _controller;
late ValidationOutput _validationOutput;
Copy link
Member

Choose a reason for hiding this comment

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

If you trigger the button "Save CrowdAction" and the fields are empty a "late initialization error" is produced. This is because the ValidationOutput has not been initialized. One way to fix this is by adding a validation in initState like this:

          void initState() {
            // TODO: implement initState
            super.initState();
            widget.validationCallback == null
                ? _validationOutput = ValidationOutput(error: false)
                : _validationOutput = widget.validationCallback!(_image);
      }
    

double cropperMargin = 30,
}) async {
CropController controller = CropController();
double aspectRatio = targetSize.width / targetSize.height;
Copy link
Member

Choose a reason for hiding this comment

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

Size already has a getter called aspectRatio
https://api.flutter.dev/flutter/dart-ui/Size/aspectRatio.html

But it might be confusing to pass a ratio as a Size. People might expect to pass a width and height like Size(200, 50) etc. Might be better to create a class like Ratio() to avoid confusions.

Copy link
Author

@andre-tm-hui andre-tm-hui Apr 4, 2023

Choose a reason for hiding this comment

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

Did not know about the getter, thanks for letting me know.

As for use of Size, that was left over from before @laschnik proposed the use of standard 16:9. Looking at it again, it seems like double aspectRatio = 16 / 9 would be more suitable, since the code never uses the width/height components separately anyways.

Copy link
Member

@dromerolovo dromerolovo left a comment

Choose a reason for hiding this comment

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

Looks good to me. The CrowdActions table is not fetching the crowdActions but it must be that the dev server is unavailable 404.

@andre-tm-hui andre-tm-hui merged commit 73114ca into development Apr 6, 2023
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

Successfully merging this pull request may close these issues.

2 participants