-
Notifications
You must be signed in to change notification settings - Fork 3
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
Conversation
…nteam/collaction_cms into feat/gh-25/images-form
…ction_cms into feat/gh-25/images-form
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 |
There was a problem hiding this 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
widget.callback == null | ||
? null | ||
: widget.callback!(_validationOutput.error ? null : _image); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
Created the UI for uploading and cropping images. Closes #25.