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

How can I fetch post categories and view it #41

Open
BinTofajjal opened this issue Jun 19, 2020 · 2 comments
Open

How can I fetch post categories and view it #41

BinTofajjal opened this issue Jun 19, 2020 · 2 comments

Comments

@BinTofajjal
Copy link

BinTofajjal commented Jun 19, 2020

   Text(
          post.categories,
          textAlign: TextAlign.left,
          style: TextStyle(
                   fontSize: 12.0,
                   fontWeight: FontWeight.bold,
                   color: Colors.black,
                   fontFamily: 'TatsamBengaliRndLight',
                 ),
            ),


but it's not working.

Also, can I fetch the author's avatar too?
If possible please let me know.

@ellie-me
Copy link

You need to filter first your categories before sending that data to the UI because a Category is not a String, it's an object.
Here's a snippet that might work for you:

List<String> getCategoryListFriendlyName(List<Category> categories) { final List<String> temp = []; for(Category cat in categories) { temp.add(cat.name); } return temp; }

To get the author Avatar you might need to do another http request to fetch an user, there's a function inside of this library named fetchUser, use that. And inside of the parameters use the author id that is inside of the post.authorID to get the user with the avatar.

@aldoyh
Copy link

aldoyh commented Mar 1, 2022

You can also add "?_embed" at the endpoint to embed more sibling metadata from other tables.

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

No branches or pull requests

3 participants