wsloth / Index

The Index is a simple Hacker News reader app which is focused on making you read less, by only showing you the top stories of the last 24 hours.
10 stars 9 forks source link

Improve Comments Section #17

Open adhamjongsma opened 2 years ago

adhamjongsma commented 2 years ago

Hey Wessel, this draft PR is almost done!

So I feel the need to pontificate that I'm not 100% sure this is the most elegant solution. This is my first foray into Dart.

So, for the lazy loading mechanism I did some reading on the Dart concept of streams and I basically setup a StreamController to manage adding the stream result manually, while I use the StreamSubscription to pause and resume the stream when the user scrolls far enough into view.

I didn't see any overlapping comments, oddly. Maybe there's a flutter SDK version issue here, but I did add a small amount of margin to all the comments in order to even out the spaces. Let me know what you think?

Note: I still need to edit some bits of this, for example, it will continue to try and load comments even when you scroll to the end, but I'll do that one evening next week. I just wanted to show you what I have so far just so you can either tell me that it looks good or that I need to start all over again lol.

wsloth commented 2 years ago

Thanks for your PR @adhamjongsma ❤️ !! I'm a bit busy this week -- but I'll make sure to review it before the week ends. In the meantime I triggered the build pipeline so I can functionally test the changed 😁

adhamjongsma commented 2 years ago

Yeah! There's no rush. Was just fun getting to grips with flutter.