From 53cda5158610b7ea72c1784c5aa9fddd42368cff Mon Sep 17 00:00:00 2001 From: Alex Garneau Date: Mon, 8 Dec 2025 11:38:39 -0700 Subject: [PATCH 1/2] Added more accurate semantics to the time range slider in the Browse Artifacts view. --- lib/l10n/app_en.arb | 1 + lib/l10n/app_localizations.dart | 6 +++ lib/l10n/app_localizations_en.dart | 4 ++ lib/l10n/app_localizations_zh.dart | 3 ++ lib/l10n/app_zh.arb | 1 + .../expanding_time_range_selector.dart | 4 +- .../time_range_selector/range_selector.dart | 38 +++++++++++-------- 7 files changed, 39 insertions(+), 18 deletions(-) diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 0b87c0b6..62f445b0 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -8,6 +8,7 @@ "appBarTitleLocation": "Location Info", "bottomScrubberSemanticScrubber": "scrubber", "bottomScrubberSemanticTimeline": "Timeline Scrubber, drag horizontally to navigate the timeline.", + "rangeSelector": "Range selector, drag horizontally to adjust the range.", "collectionLabelDiscovered": "{percentage}% discovered", "@collectionLabelDiscovered": {"placeholders": {"percentage": {}}}, "collectionLabelCount": "{count} of {total}", diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index 7ea7fc49..5dad0089 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -146,6 +146,12 @@ abstract class AppLocalizations { /// **'Timeline Scrubber, drag horizontally to navigate the timeline.'** String get bottomScrubberSemanticTimeline; + /// No description provided for @rangeSelector. + /// + /// In en, this message translates to: + /// **'Range selector, drag horizontally to adjust the range.'** + String get rangeSelector; + /// No description provided for @collectionLabelDiscovered. /// /// In en, this message translates to: diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 8a3ba863..86646335 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -35,6 +35,10 @@ class AppLocalizationsEn extends AppLocalizations { String get bottomScrubberSemanticTimeline => 'Timeline Scrubber, drag horizontally to navigate the timeline.'; + @override + String get rangeSelector => + 'Range selector, drag horizontally to adjust the range.'; + @override String collectionLabelDiscovered(Object percentage) { return '$percentage% discovered'; diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index 6cf1b052..482d8429 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -35,6 +35,9 @@ class AppLocalizationsZh extends AppLocalizations { String get bottomScrubberSemanticTimeline => 'Timeline Scrubber,水平拖动可在历史年表中导航。'; + @override + String get rangeSelector => 'Range selector, 水平拖动即可调整范围。'; + @override String collectionLabelDiscovered(Object percentage) { return '已发现 $percentage% '; diff --git a/lib/l10n/app_zh.arb b/lib/l10n/app_zh.arb index c7a2a366..adf447fb 100644 --- a/lib/l10n/app_zh.arb +++ b/lib/l10n/app_zh.arb @@ -7,6 +7,7 @@ "appBarTitleLocation": "地理位置", "bottomScrubberSemanticScrubber": "scrubber", "bottomScrubberSemanticTimeline": "Timeline Scrubber,水平拖动可在历史年表中导航。", + "rangeSelector": "Range selector, 水平拖动即可调整范围。", "collectionLabelDiscovered": "已发现 {percentage}% ", "collectionLabelCount": "{count}/{total}", "collectionButtonReset": "重置收藏夹", diff --git a/lib/ui/screens/artifact/artifact_search/time_range_selector/expanding_time_range_selector.dart b/lib/ui/screens/artifact/artifact_search/time_range_selector/expanding_time_range_selector.dart index 02868a2e..80101a7c 100644 --- a/lib/ui/screens/artifact/artifact_search/time_range_selector/expanding_time_range_selector.dart +++ b/lib/ui/screens/artifact/artifact_search/time_range_selector/expanding_time_range_selector.dart @@ -258,7 +258,7 @@ class _OpenedTimeRange extends StatelessWidget { // Time slider itself Positioned.fill( - child: MergeSemantics( + //child: MergeSemantics( child: Semantics( label: $strings.bottomScrubberSemanticTimeline, child: RangeSelector( @@ -271,7 +271,7 @@ class _OpenedTimeRange extends StatelessWidget { onUpdated: onChange, ), ), - ), + //), ), ], ), diff --git a/lib/ui/screens/artifact/artifact_search/time_range_selector/range_selector.dart b/lib/ui/screens/artifact/artifact_search/time_range_selector/range_selector.dart index f6503044..da431ebb 100644 --- a/lib/ui/screens/artifact/artifact_search/time_range_selector/range_selector.dart +++ b/lib/ui/screens/artifact/artifact_search/time_range_selector/range_selector.dart @@ -86,11 +86,14 @@ class _RangeSelectorState extends State { child: _getDragDetector( onUpdate: _handleMidDrag, dragWidth: dragWidth, - child: Container( - decoration: BoxDecoration( - color: $styles.colors.offWhite.withOpacity(0), - border: Border.symmetric( - horizontal: BorderSide(color: $styles.colors.white.withOpacity(0.75), width: 2), + child: Semantics( + label: $strings.bottomScrubberSemanticTimeline, + child: Container( + decoration: BoxDecoration( + color: $styles.colors.offWhite.withOpacity(0), + border: Border.symmetric( + horizontal: BorderSide(color: $styles.colors.white.withOpacity(0.75), width: 2), + ), ), ), ), @@ -107,19 +110,22 @@ class _RangeSelectorState extends State { return _getDragDetector( onUpdate: isRight ? _handleRightDrag : _handleLeftDrag, dragWidth: dragWidth, - child: Transform.scale( - scaleX: isRight ? 1 : -1, - child: Container( - alignment: Alignment.center, - width: RangeSelector.handleWidth, - decoration: BoxDecoration( - color: $styles.colors.white.withOpacity(0.75), - borderRadius: BorderRadius.only( - topRight: Radius.circular($styles.corners.md), - bottomRight: Radius.circular($styles.corners.md), + child: Semantics( + label: $strings.rangeSelector, + child: Transform.scale( + scaleX: isRight ? 1 : -1, + child: Container( + alignment: Alignment.center, + width: RangeSelector.handleWidth, + decoration: BoxDecoration( + color: $styles.colors.white.withOpacity(0.75), + borderRadius: BorderRadius.only( + topRight: Radius.circular($styles.corners.md), + bottomRight: Radius.circular($styles.corners.md), + ), ), + child: Icon(Icons.chevron_right, color: $styles.colors.greyStrong, size: RangeSelector.handleWidth), ), - child: Icon(Icons.chevron_right, color: $styles.colors.greyStrong, size: RangeSelector.handleWidth), ), ), ); From d881a714520668edb7d7d291b3cfa0a24e2af596 Mon Sep 17 00:00:00 2001 From: Alex Garneau Date: Wed, 10 Dec 2025 10:25:32 -0700 Subject: [PATCH 2/2] Removed commented-out lines. --- .../expanding_time_range_selector.dart | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/lib/ui/screens/artifact/artifact_search/time_range_selector/expanding_time_range_selector.dart b/lib/ui/screens/artifact/artifact_search/time_range_selector/expanding_time_range_selector.dart index 80101a7c..7daddb23 100644 --- a/lib/ui/screens/artifact/artifact_search/time_range_selector/expanding_time_range_selector.dart +++ b/lib/ui/screens/artifact/artifact_search/time_range_selector/expanding_time_range_selector.dart @@ -258,20 +258,18 @@ class _OpenedTimeRange extends StatelessWidget { // Time slider itself Positioned.fill( - //child: MergeSemantics( - child: Semantics( - label: $strings.bottomScrubberSemanticTimeline, - child: RangeSelector( - key: ValueKey('RangeSelectorIsWonderTime'), - min: wondersLogic.timelineStartYear * 1.0, - max: wondersLogic.timelineEndYear * 1.0, - minDelta: 500, - start: startYear, - end: endYear, - onUpdated: onChange, - ), + child: Semantics( + label: $strings.bottomScrubberSemanticTimeline, + child: RangeSelector( + key: ValueKey('RangeSelectorIsWonderTime'), + min: wondersLogic.timelineStartYear * 1.0, + max: wondersLogic.timelineEndYear * 1.0, + minDelta: 500, + start: startYear, + end: endYear, + onUpdated: onChange, ), - //), + ), ), ], ),