Fixed misleading announcement for all demos (#823)
diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb
index c7228f9..ed86c68 100644
--- a/lib/l10n/intl_en.arb
+++ b/lib/l10n/intl_en.arb
@@ -2230,6 +2230,10 @@
"@chipBiking": {
"description": "A chip component to that indicates a biking selection."
},
+ "demo": "Demo",
+ "@demo": {
+ "description": "Used in the title of the demos."
+ },
"dialogDiscardTitle": "Discard draft?",
"@dialogDiscardTitle": {
"description": "Alert dialog message to discard draft."
diff --git a/lib/l10n/intl_en_US.xml b/lib/l10n/intl_en_US.xml
index 20078c0..dd9d120 100644
--- a/lib/l10n/intl_en_US.xml
+++ b/lib/l10n/intl_en_US.xml
@@ -2098,6 +2098,10 @@
description="A chip component to that indicates a biking selection."
>Biking</string>
<string
+ name="demo"
+ description="Used in the title of the demos."
+ >Demo</string>
+ <string
name="dialogDiscardTitle"
description="Alert dialog message to discard draft."
>Discard draft?</string>
diff --git a/lib/pages/demo.dart b/lib/pages/demo.dart
index aff7dd4..2e6be0b 100644
--- a/lib/pages/demo.dart
+++ b/lib/pages/demo.dart
@@ -428,17 +428,18 @@
final isDemoNormal = currentDemoState == _DemoState.normal;
// Add a tap gesture to collapse the currently opened section.
demoContent = Semantics(
- label: MaterialLocalizations.of(context).modalBarrierDismissLabel,
+ label:
+ '${GalleryLocalizations.of(context)!.demo}, ${widget.demo.title}',
child: MouseRegion(
cursor: isDemoNormal ? MouseCursor.defer : SystemMouseCursors.click,
child: GestureDetector(
- onTap: () {
- if (!isDemoNormal) {
- setStateAndUpdate(() {
- _demoStateIndex.value = _DemoState.normal.index;
- });
- }
- },
+ onTap: isDemoNormal
+ ? null
+ : () {
+ setStateAndUpdate(() {
+ _demoStateIndex.value = _DemoState.normal.index;
+ });
+ },
child: Semantics(
excludeSemantics: !isDemoNormal,
child: demoContent,