Skip to content

fix(dive-edit): stop segmented-button labels wrapping mid-word on phones - #798

Merged
ericgriffin merged 2 commits into
submersion-app:mainfrom
etlami:fix/segmented-button-label-overflow
Aug 5, 2026
Merged

fix(dive-edit): stop segmented-button labels wrapping mid-word on phones#798
ericgriffin merged 2 commits into
submersion-app:mainfrom
etlami:fix/segmented-button-label-overflow

Conversation

@etlami

@etlami etlami commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Problem

On a phone, two SegmentedButtons in the dive editor overflow their labels and wrap mid-word:

  • Dive Mode (OC / CCR / SCR / GAUGE): each segment renders an icon and a label, which doesn't fit four segments across a phone — "GAUGE" wraps to "G / AU / GE".
  • Weighting feedback (Felt right / Overweighted / Underweighted): the long single-word labels are wider than a third of the row, so "Overweighted" / "Underweighted" wrap onto a second line.

Fix

dive_mode_selector.dart + dive_edit_page.dart:

  • Drop the per-segment icons on Dive Mode (text-only). The caption below the selector and the tooltip already convey what each mode is, and the icons were the extra width that pushed the label into wrapping.
  • Wrap the labels of both controls in FittedBox(fit: BoxFit.scaleDown) with maxLines: 1, so a label that is slightly too wide scales down to fit on one line rather than char-wrapping.

Tests

  • New dive_mode_selector_test.dart: the four labels render, the longest stays single-line inside a FittedBox, and the segments no longer carry icons.
  • The existing dive_edit_weight_feedback_test.dart (taps the labels) still passes.

Verified locally against Flutter 3.44.8 / Dart 3.12.2: flutter test test/features/dive_log/presentation/pages/ (+ the new widget test) passes, flutter analyze clean, dart format clean.

Two SegmentedButtons in the dive editor overflowed their labels on narrow
screens, wrapping mid-word:

- Dive Mode (OC/CCR/SCR/GAUGE): each segment showed an icon *and* a label,
  which doesn't fit four segments on a phone. Drop the icons (text-only);
  the caption below and the tooltip already say what each mode is.
- Weighting feedback (Felt right / Overweighted / Underweighted): the long
  single-word labels are wider than a third of the row.

Wrap the labels in FittedBox(scaleDown) with maxLines: 1 so they scale to
fit on one line instead of char-wrapping.

Adds a dive-mode-selector widget test (labels present, single line, no
per-segment icons); the existing weighting-feedback test still passes.
@codecov

codecov Bot commented Aug 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

📦 Build artifacts for this PR · commit 9e50733

Platform Download
Android (APK) android-apk
macOS macos-build
Windows windows-build
Linux linux-build

Artifacts expire in 7 days. Downloading requires being signed in to GitHub. macOS needs two extractions: unzip the downloaded artifact, then unzip the submersion-macos.zip inside it to get a runnable submersion.app. The build is ad-hoc signed — right-click → Open on first launch.

Updated automatically on each push.

@ericgriffin ericgriffin moved this from Backlog to In review in Submersion Release Tracker Aug 4, 2026
@ericgriffin
ericgriffin requested a lite review from Copilot August 4, 2026 18:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves the dive editor’s segmented-button layout on small screens by preventing mid-word wrapping in segment labels (notably “GAUGE”, “Overweighted”, “Underweighted”).

Changes:

  • Removed per-segment icons from the Dive Mode SegmentedButton to reduce horizontal pressure on phones.
  • Wrapped Dive Mode and Weighting Feedback segment labels in FittedBox(fit: BoxFit.scaleDown) + Text(maxLines: 1) to keep labels on a single line.
  • Added a new widget test covering the Dive Mode selector’s text-only segments and single-line label behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
lib/features/dive_log/presentation/widgets/dive_mode_selector.dart Removes icons and scales label text down to avoid mid-word wrapping in Dive Mode segments.
lib/features/dive_log/presentation/pages/dive_edit_page.dart Scales Weighting Feedback segment labels down to prevent mid-word wrapping on phones.
test/features/dive_log/presentation/widgets/dive_mode_selector_test.dart Adds a regression test for text-only Dive Mode segments and single-line label rendering.

Copilot review: finding no Icon descendants under SegmentedButton is
brittle because the framework renders internal icons (e.g. the selected
checkmark) that this widget does not control. Assert directly that every
ButtonSegment's icon field is null instead.
@ericgriffin
ericgriffin merged commit 3094bf2 into submersion-app:main Aug 5, 2026
25 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in Submersion Release Tracker Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants