How to load Categories with Image & Quotes (from Firebase) into Cards

Hello everyone,

I am trying to build a Quotes app using Firebase Database and Kodular.
My Firebase structure looks like this:

{
“Categories”: {
“Motivation”: {
“image”: “https://example.com/motivation.jpg”,
“data”: {
“1”: “Believe in yourself and all that you are.”,
“2”: “Dream big and dare to fail.”,
“3”: “Success is not final, failure is not fatal.”
}
},
“Love”: {
“image”: “https://example.com/love.jpg”,
“data”: {
“1”: “Love is not what you say, love is what you do.”,
“2”: “In true love, there is no ending.”,
“3”: “You are my today and all of my tomorrows.”
}
},
“Friendship”: {
“image”: “https://example.com/friendship.jpg”,
“data”: {
“1”: “Friendship is the golden thread that ties the heart of all the world.”,
“2”: “A real friend is one who walks in when the rest of the world walks out.”,
“3”: “Good friends are like stars, you don’t always see them but you know they’re always there.”
}
}
}
}


:small_blue_diamond: What I want to achieve in my app:

  1. On the Home screen → Display all Categories in CardView (with Category name + Image).

  2. When a user clicks on a Category → Load the related Quotes (data list) into another screen/list.

  3. Quotes should display properly with text items coming from the data node of that Category.


:small_blue_diamond: My Question:

How do I set up the blocks in Kodular to:

  1. Load Category names & images dynamically from Firebase into cards

  2. On click → Show all quotes under that Category?

If anyone can share block examples or guidance, that would be really helpful :folded_hands:

Thanks in advance!

I am providing the image and the aia file for you, as it may be difficult to understand.

Aia
admin_app.aia (54.9 KB)


Hey @Boby_Sing, I read your post and found some solutions for you :heart:

:small_blue_diamond: Step 1: Firebase Setup in Kodular

  • Add Firebase Database component
  • Set:
    • Firebase URL = Your Firebase DB URL
    • Project Bucket = Categories
    • Firebase Token = Your secret

:small_blue_diamond: Step 2: Load Categories into Cards

  • In the Screen1.Initialize event:
    • Call FirebaseDB.GetValue with tag = “” (empty → it will return all categories).
  • In FirebaseDB.GotValue:
    • The value will be a dictionary containing "Motivation", "Love", "Friendship", etc.
    • Use the Dictionary blocks to loop through keys.
    • For each key (category name):
      • Get image (value under "image")
      • Create a Dynamic CardView with:
        • Title = Category name
        • Image = Image from Firebase

:backhand_index_pointing_right: You can use Dynamic Components extension (by Yusuf Cihan) to generate CardViews programmatically.


:small_blue_diamond: Step 3: Handle Category Click

  • When a Card is clicked:
    • Open another screen (e.g., QuotesScreen)
    • Pass the clicked Category Name using open another screen with start value.

:small_blue_diamond: Step 4: Load Quotes on QuotesScreen

  • On QuotesScreen.Initialize:
    • Get the start value (this is your Category, e.g., “Motivation”).
    • Call FirebaseDB.GetValue with tag = <CategoryName>/data.
  • In FirebaseDB.GotValue:
    • The value will be a dictionary like:
{
  "1": "Believe in yourself and all that you are.",
  "2": "Dream big and dare to fail.",
  "3": "Success is not final, failure is not fatal."
}
  • Convert dictionary values into a list.
  • Load them into a ListView (or Dynamic Labels inside a Scrollable arrangement).

:small_blue_diamond: Block Logic Overview

Screen1 Blocks

  • Initialize → Firebase.GetValue ("")
  • GotValue → Loop keys (categories) → For each, create a Card with category name + image.
  • When Card.Clicked → Open QuotesScreen with start value = category name

QuotesScreen Blocks

  • Initialize → Get StartValue (category name) → Firebase.GetValue (CategoryName/data)
  • GotValue → Convert dictionary → List → Display in ListView

@Glich Dear, thank you for responding to me :smiling_face_with_three_hearts: But I have a question that after clicking on button 1

Sorry, my first question was a bit wrong.
{
“Categories”: {
“Motivation”: {
“image”: “https://example.com/motivation.jpg”,
“data”: {
“1”: “Believe in yourself and all that you are.”,
“2”: “Dream big and dare to fail.”,
“3”: “Success is not final, failure is not fatal.”
}
},
“Love”: {
“image”: “https://example.com/love.jpg”,
“data”: {
“1”: “Love is not what you say, love is what you do.”,
“2”: “In true love, there is no ending.”,
“3”: “You are my today and all of my tomorrows.”
}
},
“Friendship”: {
“image”: “https://example.com/friendship.jpg”,
“data”: {
“1”: “Friendship is the golden thread that ties the heart of all the world.”,
“2”: “A real friend is one who walks in when the rest of the world walks out.”,
“3”: “Good friends are like stars, you don’t always see them but you know they’re always there.”
}
}
}
} How to get such structure in firebase, how to set block for it

Plz :slight_smile: Wait sometime, I will give you the blocks.

1 Like

Hey Glitch,

I’m not sure if you’re using an AI to answer, but there are a few parts that need correction:

  • It’s not enough to just add Firebase, you also need to include the JSON configuration (only if Authentication in used) .
  • The FirebaseToken is obtained through FirebaseAuthentication, so that should be added as well, and especially an authentication method must be configured.
  • Regarding loading data into cards, that could work, but some things should be explained better. “Get image” doesn’t really mean anything, it would be better to explain how dictionaries work and use the get value for key block.
  • If the layout is very simple, the native dynamic components can be used.
  • It would be more convenient to manage the various layouts in a single screen instead of switching to another one.
  • If another screen were to be used, it would be better to pass the entire data node (since you already downloaded it beforehand) and read from that instead of making another Firebase call.

Anyway, there are many other small things that aren’t very good or efficient.

1 Like

I am working to correcting them :sweat_smile:

1 Like

I will step in for a minute, I can see @Boby_Sing seem new here, is it true? If yes, he needs to learn how to create Dynamic components layout​:thinking:as mentioned in the middle, then being able to understand how to use firebase structures, so RayzZz and Glitch, I think we should take it easy​:joy:

So my first question to @Boby_Sing can you create the quote layout using Dynamic components?

:green_heart:

1 Like

I hope it works :slight_smile:

Procedure AddCategoryToFirebase(categoryName, categoryImage, dataDict)
    // 1. Store image
    Call FirebaseDB1.StoreValue
        tag = join "Categories/" + categoryName + "/image"
        value = categoryImage

    // 2. Store data dictionary
    For each key in dictionary keys of dataDict
        set value = get value for key in dataDict
        Call FirebaseDB1.StoreValue
            tag = join "Categories/" + categoryName + "/data/" + key
            value = value

Hi @Boby_Sing,

Welcome to the :kodular:odular community!

I edited the AIA file in your post because it contained the API key of your database, and anyone could have deleted everything.

1 Like

What’s about providing block’s?

1 Like

Good idea I am just going to make it

2 Likes

Don’t worry about that, this is just for my test, I used a different key in the original project.

1 Like

@Ibrahim_Jamar Yes I did that, but I am not getting the settings in Firebase, and what you say is true, I am new to this right now, you can take a look at my aia once.

1 Like

RaYzZz and Glich did you check the aia file?

1 Like

Am sorry Glich but we’re trying to get value which already stored in firebase

1 Like

Now :grinning_face_with_smiling_eyes:

Try this,

2 Likes

ok I will try to include this in my project.

RaYzZz can you please tell this is not a procedure :joy: so if not where do this block comes​:joy:

1 Like

(post deleted by author)