beeware / beeware/toga

Allow icon to be optional in DetailedList

Open
#2,342 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
5.4k
Forks
829
Avg merge
15h 39m
Merged PRs (30d)
40

Description

### What is the problem or limitation you are having?

The layout of items in a DetailedList currently allocates space for an icon, regardless of whether icons are provided. If you have a data source that contains *no* icons, this leads to a lot of wasted space in the layout.

### Describe the solution you'd like

A flag on the constructor for DetailedList which specifies whether the list should attempt to render icons.

### Describe alternatives you've considered

The API for this could take a number of forms:
1. A specific `render_icons=True/False` flag
2. Specifying an icon accessor name of `None`
3. Specifying an accessor list that only has 2 items, rather than 3.
4. A flag that is more than a simple True/False, but indicates a rendering "pattern" (i.e., "TitleSubtitleAndIcon", "TitleAndSubtitle"). This would allow adding other rendering patterns in future that might be of use (e.g., rendering the icon at a different size, or in a different place).
5. A full API for describing the layout of DetailedList items. This is essentially an extension of (4); we'd ship 2 default layouts (for with-icon and iconless title+subtitle layouts), but we'd allow the user to define their own layouts.

2 or 3 would be the easiest to implement solution; 5 would be the most comprehensive (but also the most complex).

Of course, the other option is the obligatory "do nothing", and require that icons are part of the rendering of DetailedList.

### Additional context

As part of this, we should also consider how we could introduce multiline text content, especially for the subtitle element. The single-line content constraint (see beeware/toga#2343) is born of the need for every row in the list to have the same height. However, most DetailedList implementations will allow variable height content (e.g., a social media timeline where comments can be multiple lines).

Any API proposal for options 4 and 5 should also include the option of interactive elements on the list - e.g. buttons to "like" a social media post in the body of the post.

Contributor guide

Open the contributing guide

Research direction

Start by reading the DetailedList constructor and its current item layout behavior. Compare the proposed iconless, multiline, and interactive-element requirements, then document a settled API and verify that the chosen design removes unused icon space while preserving existing list behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop, frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.