-
Notifications
You must be signed in to change notification settings - Fork 0
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
Images #96
Conversation
As of this commit, images are uploaded to the Appwrite bucket. Currently working on linking them to the post |
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.
Looking pretty good so far! I think the main thing I'm noticing is that .cxx/
needs to get gitignored.
@MattsAttack, syncing the IDs prevents multiple images from being attached. Do we want to support multiple images? |
Just a reminder to gitignore |
packages/app/lib/src/features/home/application/uploaded_image_service.dart
Outdated
Show resolved
Hide resolved
@lishaduck did you get the code you suggested to work? |
I just wrote it in the little box. What diagnostics is build_runner giving? |
[SEVERE] riverpod_generator on lib/src/features/home/application/uploaded_image_service.dart (cached): No "build" method found. Classes annotated with @riverpod must define a method named "build". |
You sure you pulled? |
Yes. This is what I have right now. The _$UploadedImageService and the build files aren't being generated. import 'package:fast_immutable_collections/fast_immutable_collections.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/foundation.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
@immutable
@freezed
class UploadedImage {
// Might need to add IsWeb in here
UploadedImage({
required this.imageId, //figure out how to do image ids
//currently working on multi image upload support. Will need to figure out how to store multiple images. Should just make appwrite imageIds an array of strings and store all ids and loop the upload function
required this.file,
});
String imageId;
PlatformFile file;
}
@riverpod
class UploadedImageService extends _$UploadedImageService {
IList<UploadedImage> build() {
return const IList.empty();
}
void addImage(UploadedImage image) {
state = state.add(image);
}
void removeImage(String imageId) {
// Again, our state is immutable. So we're making a new list instead of
// changing the existing list.
state = state.remove(
state.firstWhere((element) => element.imageId == imageId),
);
}
} |
Oh, add parts. |
And another reminder to gitignore .cxx |
It compiles now thanks. Is this still a ChangeNotifierProvider or is it something else? Can you send me the docs for this cause this code cause its kind of weird. Also me and Lucas fixed some of the video quality issues |
No. ChangeNotifierProvider is deprecated in favor of NotifierProvider.
❤️ |
:(. Not a fan of NotifierProvider |
Why? There's basically no differences except that you use |
The syntax is strange. I'm also having trouble getting this to work Also is there a better way to initially watch this? |
What's the matter with an IList? |
@lishaduck if I commit what I have so far would you be willing to fix it? I'm trying to set up the provider in a way so I can implement multi image support. I know how to do it I just don't fully understand how the AsyncNotifer works and I need to go work on other stuff for a bit. If you can fix the provider stuff I should be able implement multi image support tonight |
I could, if you could get #145 merged (I'm running 3.29, so I'm stuck right now, but I don't want to merge if it breaks you) |
I just sent you a link |
Oh, @MattsAttack, I was reading through the code and realized something: we're using the wrong package. The code won't work on mobile. We should be using |
Oh boy. I'm almost done with multi image support. I'll let you know when I am and I'll go review #145 if you want to try and tackle image picked. I've looked at the docs for it and it doesn't seem much different |
👍
❤️
✅ |
I'd meant to do this yesterday, but I forgot.
@lishaduck have you encountered the issue where the feed scrolls back to the top when new posts are loading? I think it has something to do with the pagination messing with scrolling. Recording.2025-02-19.111829.mp4 |
Yeah, I keep hitting it. I tried changing the caching, but I can't catch anything refreshing. I think it can be repro'd on main though, and it only happens if you scroll quickly, so I figure we can just ignore that for now. |
I keep getting refreshing. But it's fine. Feel free to merge |
Hmmm. Well, we can figure it out later. Are you sure it wasn't there before I messed with stuff? |
Yeah I've having that issue for a while now. Same with the image refreshing. |
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.
LGTM!
Description
Implementation of image upload and display for post UI. Also fixes windows build.
Type of Change
Checklist
Tested on