Photo Social App with FlutterFlow and Supabase · Course book
Chapter 20: The Comment Section Interface
Comments are where a photo turns into a conversation. Before connecting them to the database, this part designs the comment section's interface in FlutterFlow, built from components nested inside components: a comment section that holds a list of comment components, each showing one person's comment. This chapter explains how to plan that structure, design a comment row that reads clearly, assemble the section as a bottom sheet with an input bar, size it for the screen, worked out by hand, and finish by showing the post's like count in the section header so the whole post's activity is visible in one place.
Planning the components
A comment section has a clear hierarchy, and mirroring it in components keeps each piece simple. The outer comment section component is the container: a header, a scrolling list of comments and an input bar at the bottom. Inside the list, each item is a comment component, responsible for one comment only. Because the section knows nothing about how a single comment looks, and a comment knows nothing about the list around it, each can be changed without disturbing the other.
| Component | Contains | Parameters | Used on |
|---|---|---|---|
| Comment section | Header, list of comments, input bar | The post, or its id | Feed bottom sheet, post detail page |
| Comment | Avatar, username, text, time, like and reply controls | The comment row, or its fields | Inside the comment section's list |
| Input bar | Viewer's avatar, text field, send button | The post id, and an action for sending | Bottom of the comment section |
Designing with placeholder data first, a handful of fake comments with different lengths and names, shows how the components behave before any query exists. Including at least one very long comment and one very short one reveals layout problems early, such as text that does not wrap or a time stamp pushed off the edge.
Deciding what each component receives is the main design question. The comment component could take the whole comment row as one parameter, which is quick to wire up once the comments table exists, or individual fields such as the username, avatar, text and time, which lets the same component display data from different sources, for instance a view that already joins comments with their authors. It also needs to tell the outside world when something happens inside it: when the viewer taps "Reply" or the heart. Rather than performing those actions itself, the component can expose action parameters, callbacks supplied by the section, so that the section decides what replying means, perhaps focusing the input bar and prefilling "@maya ". Keeping the comment component focused on display and handing decisions upward is what makes it reusable for replies later.
Components can also hold their own small pieces of state. A long comment might be shown truncated to three lines with a "more" link; whether it is expanded belongs to that one comment, so it lives in the comment component's state, and expanding one comment does not affect the others.
Designing the comment row
A single comment reads best as a row: a small circular avatar on the left, around 32 to 36 points across, and to its right a column holding the text and the details. The text uses rich text, with the username in bold followed by the comment in regular weight, so name and words flow together as one sentence. Below it, a line of small grey text shows the relative time, such as "3h", the number of likes on the comment and a "Reply" link. On the far right, a small heart lets viewers like the comment itself.
The text column must be Expanded so it takes all the width left after the avatar and the heart, and wraps onto as many lines as the comment needs. Without that, long comments overflow the screen or squeeze the heart out of view. Spacing from the 8-point grid, for example 12 points between the avatar and the text and 16 points between comments, keeps a long thread readable rather than dense.
Assembling the section
From the feed, comments usually open in a bottom sheet, a panel that slides up from the bottom of the screen and covers most of it, leaving the post visible above so the viewer keeps their context. A small grab handle at the top shows that the sheet can be dragged down to close. In FlutterFlow, a bottom sheet action can show any component, so the comment section component is simply displayed inside one, with the post passed as its parameter.
The list inside the section is a ListView, so it builds rows lazily and scrolls independently of the sheet. On the post detail page, the same comment section component can be placed directly below the post card instead of in a sheet; because it is a component, both places share one design. The input bar's send button is disabled while the field is empty, and its action is supplied by the page or the section, ready to insert comments once the table exists.
The input bar deserves particular care, because it is where people spend their time in the section. It should sit at the very bottom of the sheet and rise with the keyboard, never hidden beneath it. The text field should grow from one line to perhaps four as the user types longer comments, then scroll internally. The viewer's own small avatar beside it is a friendly reminder of who is commenting. And the send control, often a word such as "Post" rather than an icon, should be clearly disabled until there is something to send, so that nobody posts an empty comment by accident. Tapping outside the field, or dragging the list, should dismiss the keyboard so readers can see more of the thread.
Closing the sheet should be easy and predictable: a downward drag on the handle or header, a tap on the darkened area above it, or the phone's back gesture. If the user has typed a comment but not posted it, closing the sheet can keep the draft in page state, so reopening the comments on the same post restores it rather than losing what they wrote.
Finishing touches and the like count
A few details complete the design. An empty state, "No comments yet. Start the conversation.", replaces a blank list for new posts. The header can show the post's caption author and caption as the first entry, so readers see what the conversation is about, as many photo apps do. Long threads benefit from showing only the newest few replies under each comment with a "View more replies" link, prepared for in the next parts.
The section header is also a natural place to reflect the like count of the post, using the stored like_count kept up to date by the trigger from the previous part, formatted compactly. Showing likes and comments together gives a quick sense of how a post is doing. Because the count comes from the same view row as the rest of the post, no separate request is needed, and the number shown in the sheet always matches the one on the post card beneath it, as long as both read the same value. The comment rows' own like counts are shown in their detail lines, ready to be connected when comment likes are stored.
Finally, check accessibility: each comment's text should be readable by screen readers as "maya: Love the light here!", the heart icons need labels, and the input field needs a label rather than relying only on its placeholder. With the interface finished, the next part creates the comments table and connects posting and displaying comments.
Practice tasks
- A sheet covers 80 percent of a 926-point screen, with a 52-point header and a 60-point input bar. How many 64-point comment rows are visible?
- With the keyboard open, taking 336 points, how many rows remain visible in that sheet?
- List the parameters of the comment component if you chose individual fields rather than a whole row.
- Explain why the comment text column must be Expanded.
- Why does nesting a comment component inside a comment section component make both easier to change?
- Describe the empty state you would show for a post with no comments, and why it matters.
This course book is available to read online only at tech-academy.chrysolites.org.