Skip to content

SegmentedControl: allow an icon per segment (like SegmentedButton's ButtonSegment(icon:, label:)) #69

Closed

Description

@AbdurahmanAlmehdi

Select your plan

Community - basic support

Confirmations

  • I searched the existing feature requests and this is not a duplicate.

Framework or plugin?

Framework

Platform

Both

Use case

Our app (a fleet ledger ported from Flutter) switches a record list between Expenses, Maintenance and Debts with a segmented control. The Flutter app used SegmentedButton with an icon in each segment (a receipt, a wrench, a handshake). In DartNative 1.0.0, SegmentedControl takes segments: List<String>, so a segment can only be a title and the icons are dropped in the port.

SegmentedButton / ButtonSegment don't exist either:

error • The function 'SegmentedButton' isn't defined • undefined_function
error • The function 'ButtonSegment' isn't defined • undefined_function

Both platforms' controls support images in segments (UISegmentedControl.setImage(_:forSegmentAt:) / UIAction(title:image:) on iOS, icons in Material's segmented button on Android), so this looks like a gap in the Dart API rather than in the native control.

Workaround: none that keeps the native control; we use text only, or draw our own segmented row, which loses the native look and behaviour.

Repro repo: https://github.com/AbdurahmanAlmehdi/dartnative-repro-segment-icons

screenshot

Proposal

Let a segment carry an optional icon, without breaking the current List<String> API, for example:

SegmentedControl.icons(
  segments: const [
    Segment(label: 'Expenses', icon: Icons.receipt_long),
    Segment(label: 'Maintenance', icon: Icons.build),
    Segment(label: 'Debts', icon: Icons.handshake),
  ],
  selectedIndex: view,
  onValueChanged: (i) => setState(() => view = i),
)

icon as an IconData (font glyph, as Icon already renders natively) or an SF Symbol / drawable name; icon-only segments when label is null. A Flutter-compatible SegmentedButton<T> with ButtonSegment(value:, icon:, label:) mapping to the same native control would also cover ported code.

Activity

  1. added
    feature
    next-release
    on Oct 4, 2026
  2. gabrijm commented on Oct 6, 2026

    @gabrijm
    Contributor

    The next framework update adds SegmentedButton and ButtonSegment on the native controls, including styleFrom. On Android a segment shows its icon and label. On iPhone it shows one or the other: UISegmentedControl can't hold both, and React Native makes the same choice.

    If you want an icon and text on both platforms, you can build your own segmented control from Row, Icon, Text and GestureDetector, as you would in Flutter. It's a small widget, and you could publish it as a plugin so every DartNative user can use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fixedfeaturenext-release

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions