mirror of
https://github.com/gskinnerTeam/flutter-wonderous-app.git
synced 2025-08-06 09:39:31 +08:00
Merge pull request #207 from gskinnerTeam/accessibility-pass-semanticslabels
Accessibility Pass - Semantics Labels
This commit is contained in:
@ -133,8 +133,10 @@ class _OpenedTimeRange extends StatelessWidget {
|
|||||||
final TimeRangePainter painter;
|
final TimeRangePainter painter;
|
||||||
final void Function() onClose;
|
final void Function() onClose;
|
||||||
|
|
||||||
List<Widget> _buildChineseDateLayout(TextStyle headingTextStyle, TextStyle captionTextStyle, int startYr, int endYr) {
|
Widget _buildChineseDateLayout(TextStyle headingTextStyle, TextStyle captionTextStyle, int startYr, int endYr) {
|
||||||
return [
|
return MergeSemantics(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
Text(StringUtils.getYrSuffix(startYr), style: captionTextStyle),
|
Text(StringUtils.getYrSuffix(startYr), style: captionTextStyle),
|
||||||
Gap($styles.insets.xxs),
|
Gap($styles.insets.xxs),
|
||||||
Text(startYr.abs().toString(), style: headingTextStyle),
|
Text(startYr.abs().toString(), style: headingTextStyle),
|
||||||
@ -146,11 +148,15 @@ class _OpenedTimeRange extends StatelessWidget {
|
|||||||
Gap($styles.insets.xxs),
|
Gap($styles.insets.xxs),
|
||||||
Text(endYr.abs().toString(), style: headingTextStyle),
|
Text(endYr.abs().toString(), style: headingTextStyle),
|
||||||
Text($strings.year, style: captionTextStyle),
|
Text($strings.year, style: captionTextStyle),
|
||||||
];
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> _buildDefaultDateLayout(TextStyle headingTextStyle, TextStyle captionTextStyle, int startYr, int endYr) {
|
Widget _buildDefaultDateLayout(TextStyle headingTextStyle, TextStyle captionTextStyle, int startYr, int endYr) {
|
||||||
return [
|
return MergeSemantics(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
Text(startYr.abs().toString(), style: headingTextStyle),
|
Text(startYr.abs().toString(), style: headingTextStyle),
|
||||||
Gap($styles.insets.xxs),
|
Gap($styles.insets.xxs),
|
||||||
Text(StringUtils.getYrSuffix(startYr), style: captionTextStyle),
|
Text(StringUtils.getYrSuffix(startYr), style: captionTextStyle),
|
||||||
@ -160,7 +166,9 @@ class _OpenedTimeRange extends StatelessWidget {
|
|||||||
Text(endYr.abs().toString(), style: headingTextStyle),
|
Text(endYr.abs().toString(), style: headingTextStyle),
|
||||||
Gap($styles.insets.xxs),
|
Gap($styles.insets.xxs),
|
||||||
Text(StringUtils.getYrSuffix(endYr.round()), style: captionTextStyle),
|
Text(StringUtils.getYrSuffix(endYr.round()), style: captionTextStyle),
|
||||||
];
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -181,16 +189,16 @@ class _OpenedTimeRange extends StatelessWidget {
|
|||||||
Gap($styles.insets.xl),
|
Gap($styles.insets.xl),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
if (localeLogic.strings.localeName == 'zh') ...{
|
if (localeLogic.strings.localeName == 'zh') ...{
|
||||||
..._buildChineseDateLayout(headingTextStyle, captionTextStyle, startYr, endYr),
|
_buildChineseDateLayout(headingTextStyle, captionTextStyle, startYr, endYr),
|
||||||
} else ...{
|
} else ...{
|
||||||
..._buildDefaultDateLayout(headingTextStyle, captionTextStyle, startYr, endYr),
|
_buildDefaultDateLayout(headingTextStyle, captionTextStyle, startYr, endYr),
|
||||||
},
|
},
|
||||||
Spacer(),
|
Spacer(),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: $styles.insets.xl,
|
width: $styles.insets.xl,
|
||||||
child: AppBtn.from(
|
child: AppBtn.from(
|
||||||
onPressed: onClose,
|
onPressed: onClose,
|
||||||
semanticLabel: $strings.expandingTimeSelectorSemanticSelector,
|
semanticLabel: $strings.circleButtonsSemanticClose,
|
||||||
enableFeedback: false, // handled when panelController changes.
|
enableFeedback: false, // handled when panelController changes.
|
||||||
icon: AppIcons.close,
|
icon: AppIcons.close,
|
||||||
iconSize: 20,
|
iconSize: 20,
|
||||||
@ -206,7 +214,8 @@ class _OpenedTimeRange extends StatelessWidget {
|
|||||||
// Timeframe slider
|
// Timeframe slider
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: $styles.insets.lg * 2,
|
height: $styles.insets.lg * 2,
|
||||||
child: Stack(children: [
|
child: Stack(
|
||||||
|
children: [
|
||||||
// grid lines:
|
// grid lines:
|
||||||
Container(
|
Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -249,6 +258,9 @@ class _OpenedTimeRange extends StatelessWidget {
|
|||||||
|
|
||||||
// Time slider itself
|
// Time slider itself
|
||||||
Positioned.fill(
|
Positioned.fill(
|
||||||
|
child: MergeSemantics(
|
||||||
|
child: Semantics(
|
||||||
|
label: $strings.bottomScrubberSemanticTimeline,
|
||||||
child: RangeSelector(
|
child: RangeSelector(
|
||||||
key: ValueKey('RangeSelectorIsWonderTime'),
|
key: ValueKey('RangeSelectorIsWonderTime'),
|
||||||
min: wondersLogic.timelineStartYear * 1.0,
|
min: wondersLogic.timelineStartYear * 1.0,
|
||||||
@ -259,7 +271,10 @@ class _OpenedTimeRange extends StatelessWidget {
|
|||||||
onUpdated: onChange,
|
onUpdated: onChange,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
]),
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
Gap(safeBottom),
|
Gap(safeBottom),
|
||||||
|
Reference in New Issue
Block a user