pd4d10 / git-touch

An open-source app for GitHub, GitLab, Bitbucket, Gitea, and Gitee(码云), built with Flutter
Apache License 2.0
1.56k stars 137 forks source link

Contributor Screen #53

Closed shreyas1599 closed 4 years ago

shreyas1599 commented 4 years ago

@pd4d10 I'm trying to create a contributor screen within a repository. (So far, I've only managed to get the count of contributors and displayed it on the GhRepoScreen). I can do this only through REST and not GraphQL. What do you think is a better option?

  1. Make the API call in the GhUsersScreen or the GhCommitsScreen and use an if condition to decide whether to make a graphql(for others)/rest(for contributors) call. These two screens are almost identical to how the Contributor screen would look with the subtitle in these two being replaced by the number of commits.

  2. Create a separate screen GhContributorsScreen.

Also while using ListPayload of list_stateful.dart scaffold, I'm having a bit of trouble using cursor. Should I use pagination and pass the page number each time as the cursor until the json output is null? Is this right? Or is there a better way to do this?

Thanks in advance for your help.

pd4d10 commented 4 years ago

contributor screen within a repository

Do you mean something like this? https://github.com/git-touch/git-touch/graphs/contributors

If so, perhaps it is simpler to create a separate screen?

Also while using ListPayload of list_stateful.dart scaffold, I'm having a bit of trouble using cursor. Should I use pagination and pass the page number each time as the cursor until the json output is null?

Yeah, it's right. The cursor name comes from GraphQL pagination, in which case it is a string. It is designed to be a generic type so could also be used in RESTful API, in which case it is a number

Example here: https://github.com/git-touch/git-touch/blob/master/lib/screens/gh_org_repos.dart

shreyas1599 commented 4 years ago

Alright, thanks a lot!