Skip to content

Commit 0b27e8c

Browse files
klopez4212Terp
andcommitted
Attach hidden connection action to labelled wordmark
Keep the developer entry without a keyboard path by product decision. Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz> Signed-off-by: kenny lopez <[email protected]>
1 parent f837023 commit 0b27e8c

2 files changed

Lines changed: 121 additions & 88 deletions

File tree

‎mobile/lib/features/pairing/pairing_page/pairing_welcome_view.dart‎

Lines changed: 89 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -323,38 +323,42 @@ class _PairingWelcomeView extends HookWidget {
323323
setupContent == null &&
324324
!signInPending &&
325325
!isBusy;
326-
final welcome = Semantics(
327-
customSemanticsActions: canRevealOptions
328-
? {
329-
const CustomSemanticsAction(label: 'More connection options'):
330-
revealOptions,
331-
}
332-
: null,
333-
child: Padding(
334-
padding: const EdgeInsets.symmetric(
335-
horizontal: Grid.gutter,
336-
vertical: Grid.sm,
337-
),
338-
child: CustomScrollView(
339-
// Stay fixed when the welcome content fits; allow only real overflow
340-
// (such as the pairing form above the keyboard), with no rubber banding.
341-
physics: const ClampingScrollPhysics(),
342-
slivers: [
343-
SliverFillRemaining(
344-
hasScrollBody: false,
345-
child: Column(
346-
children: [
347-
Expanded(
348-
child: _TwoFingerDoubleTapSurface(
349-
onDoubleTap: canRevealOptions ? revealOptions : null,
350-
child: Center(
351-
child: Column(
352-
mainAxisSize: MainAxisSize.min,
353-
children: [
354-
ConstrainedBox(
355-
constraints: const BoxConstraints(maxWidth: 320),
356-
child: AspectRatio(
357-
aspectRatio: 777 / 326,
326+
final welcome = Padding(
327+
padding: const EdgeInsets.symmetric(
328+
horizontal: Grid.gutter,
329+
vertical: Grid.sm,
330+
),
331+
child: CustomScrollView(
332+
// Stay fixed when the welcome content fits; allow only real overflow
333+
// (such as the pairing form above the keyboard), with no rubber banding.
334+
physics: const ClampingScrollPhysics(),
335+
slivers: [
336+
SliverFillRemaining(
337+
hasScrollBody: false,
338+
child: Column(
339+
children: [
340+
Expanded(
341+
child: _TwoFingerDoubleTapSurface(
342+
onDoubleTap: canRevealOptions ? revealOptions : null,
343+
child: Center(
344+
child: Column(
345+
mainAxisSize: MainAxisSize.min,
346+
children: [
347+
ConstrainedBox(
348+
constraints: const BoxConstraints(maxWidth: 320),
349+
child: AspectRatio(
350+
aspectRatio: 777 / 326,
351+
child: Semantics(
352+
// Hidden developer entry intentionally has no
353+
// keyboard shortcut. Keep its assistive action
354+
// on the existing labelled wordmark node.
355+
customSemanticsActions: canRevealOptions
356+
? {
357+
const CustomSemanticsAction(
358+
label: 'More connection options',
359+
): revealOptions,
360+
}
361+
: null,
358362
child: OnboardingWordmark(
359363
key: const Key('pairing-buzz-wordmark'),
360364
color: context._onboardingIsDark
@@ -363,73 +367,71 @@ class _PairingWelcomeView extends HookWidget {
363367
),
364368
),
365369
),
366-
const SizedBox(height: Grid.xxs),
367-
Text(
368-
'Your people, your agents, your projects —\nall in one place.',
369-
textAlign: TextAlign.center,
370-
style: context.textTheme.bodyLarge?.copyWith(
371-
color: context._onboardingInk,
372-
),
370+
),
371+
const SizedBox(height: Grid.xxs),
372+
Text(
373+
'Your people, your agents, your projects —\nall in one place.',
374+
textAlign: TextAlign.center,
375+
style: context.textTheme.bodyLarge?.copyWith(
376+
color: context._onboardingInk,
373377
),
374-
],
375-
),
378+
),
379+
],
376380
),
377381
),
378382
),
379-
const SizedBox(height: Grid.md),
380-
ConstrainedBox(
381-
constraints: const BoxConstraints(maxWidth: 440),
382-
child: SizedBox(
383-
width: double.infinity,
384-
child: setupContent != null
385-
? setupContent!
386-
: !connectionLanding
387-
? actions(2)
388-
: ClipRect(
389-
child: Stack(
390-
alignment: Alignment.bottomCenter,
391-
children: [
392-
for (var page = 1; page < 5; page++)
393-
ExcludeFocus(
383+
),
384+
const SizedBox(height: Grid.md),
385+
ConstrainedBox(
386+
constraints: const BoxConstraints(maxWidth: 440),
387+
child: SizedBox(
388+
width: double.infinity,
389+
child: setupContent != null
390+
? setupContent!
391+
: !connectionLanding
392+
? actions(2)
393+
: ClipRect(
394+
child: Stack(
395+
alignment: Alignment.bottomCenter,
396+
children: [
397+
for (var page = 1; page < 5; page++)
398+
ExcludeFocus(
399+
excluding: page != selectedPage,
400+
child: ExcludeSemantics(
394401
excluding: page != selectedPage,
395-
child: ExcludeSemantics(
396-
excluding: page != selectedPage,
397-
child: IgnorePointer(
398-
ignoring: page != selectedPage,
399-
child: AnimatedSlide(
400-
key: ValueKey(
401-
'welcome-panel-$page',
402-
),
403-
offset: Offset(
404-
page == selectedPage
405-
? 0
406-
: page == 1
407-
? -1
408-
: 1,
409-
0,
410-
),
411-
duration: revealDuration,
412-
curve: page == selectedPage
413-
? Curves.easeOutQuad
414-
: Curves.easeOutCubic.flipped,
415-
child: SizedBox(
416-
width: double.infinity,
417-
child: actions(page),
418-
),
402+
child: IgnorePointer(
403+
ignoring: page != selectedPage,
404+
child: AnimatedSlide(
405+
key: ValueKey('welcome-panel-$page'),
406+
offset: Offset(
407+
page == selectedPage
408+
? 0
409+
: page == 1
410+
? -1
411+
: 1,
412+
0,
413+
),
414+
duration: revealDuration,
415+
curve: page == selectedPage
416+
? Curves.easeOutQuad
417+
: Curves.easeOutCubic.flipped,
418+
child: SizedBox(
419+
width: double.infinity,
420+
child: actions(page),
419421
),
420422
),
421423
),
422424
),
423-
],
424-
),
425+
),
426+
],
425427
),
426-
),
428+
),
427429
),
428-
],
429-
),
430+
),
431+
],
430432
),
431-
],
432-
),
433+
),
434+
],
433435
),
434436
);
435437
return PopScope(

‎mobile/test/features/onboarding/hosted_communities_test.dart‎

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import 'dart:ui' as ui;
2+
13
import 'package:buzz/shared/hosted/hosted_community_creation.dart';
24
import 'package:buzz/shared/hosted/hosted_environment.dart';
35
import 'package:buzz/features/onboarding/hosted_connect_page.dart';
@@ -10,6 +12,7 @@ import 'package:buzz/shared/hosted/builderlab_account.dart';
1012
import 'package:buzz/shared/hosted/hosted_community_connection.dart';
1113
import 'package:flutter/material.dart';
1214
import 'package:flutter/services.dart';
15+
import 'package:flutter/semantics.dart';
1316
import 'package:flutter/foundation.dart';
1417
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
1518
import 'package:flutter_test/flutter_test.dart';
@@ -46,7 +49,7 @@ void main() {
4649
),
4750
);
4851
await tester.pumpAndSettle();
49-
await revealOptions(tester);
52+
await revealOptionsWithSemantics(tester);
5053
await tester.pumpAndSettle();
5154
tester.view.physicalSize = const Size(420, 900);
5255
await tester.pumpAndSettle();
@@ -322,3 +325,31 @@ Future<void> revealOptions(WidgetTester tester) async {
322325
await tester.pump(const Duration(milliseconds: 50));
323326
}
324327
}
328+
329+
Future<void> revealOptionsWithSemantics(WidgetTester tester) async {
330+
final handle = tester.ensureSemantics();
331+
try {
332+
await tester.pump();
333+
final wordmark = tester.getSemantics(find.bySemanticsLabel('Buzz'));
334+
final data = wordmark.getSemanticsData();
335+
final actionIds = data.customSemanticsActionIds!;
336+
expect(actionIds, hasLength(1));
337+
expect(
338+
CustomSemanticsAction.getAction(actionIds.single)!.label,
339+
'More connection options',
340+
);
341+
// The action belongs to the wordmark, never an unlabelled page-sized stop.
342+
expect(data.label, 'Buzz');
343+
expect(wordmark.rect.height, lessThan(200));
344+
wordmark.owner!.performAction(
345+
wordmark.id,
346+
ui.SemanticsAction.customAction,
347+
actionIds.single,
348+
);
349+
await tester.pumpAndSettle();
350+
expect(find.text('Enter a community link').hitTestable(), findsOneWidget);
351+
expect(find.text('Use a pairing code').hitTestable(), findsOneWidget);
352+
} finally {
353+
handle.dispose();
354+
}
355+
}

0 commit comments

Comments
 (0)