Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

feat(mobile): show welcome message under the headline

tonyf21cfb5789af
diff --git a/mobile/lib/phone/welcome/onboarding_frame.dart b/mobile/lib/phone/welcome/onboarding_frame.dart
index 72a138bed..09cff0d6e 100644
--- a/mobile/lib/phone/welcome/onboarding_frame.dart
+++ b/mobile/lib/phone/welcome/onboarding_frame.dart
@@ -11,8 +11,9 @@ import 'set_up_computer.dart' show StepsTimeline, goToSteps;
/// which every screen after signing in shares (its wait, and the computer joining), so the picture
/// stays put from one to the next.
enum OnboardingLayout {
- /// ① A headline of up to three lines; the two accounts and, under them, one quiet line — Continue
- /// with email · QR code, or Cancel in their place — at the foot.
+ /// ① A headline of up to three lines and, under it, the status's two — why a sign-in did not
+ /// finish, why the phone was signed out; the two accounts and, under them, one quiet line —
+ /// Continue with email · QR code, or Cancel in their place — at the foot.
welcome,
/// ② The headline, the link and the steps on the computer under it — "Not you? Sign out" under
@@ -29,11 +30,12 @@ enum OnboardingLayout {
///
/// Manage all your agents on all headline: 22pt mono semibold, up to three lines
/// your computers from your phone. [underHeadline] — ②'s link and steps
+/// ⇥ You were signed out. Sign in… status, on ① — left, under the headline
///
/// ┌──────────────────┐
/// │ picture │ the middle, the same place on every screen of a [layout]
/// └──────────────────┘
-/// Looking for your computer▌ status
+/// Looking for your computer▌ status, on ② — centred, under the picture
///
/// [ Continue with Google ] actions, at the foot
/// [ Continue with Apple ]
@@ -74,7 +76,8 @@ class OnboardingFrame extends StatelessWidget {
/// The picture, laid out in the middle at its own 320 × 300 proportions.
final Widget picture;
- /// One centred line under the picture ([OnboardingStatus]).
+ /// One centred line under the picture ([OnboardingStatus]) — on the welcome, under the headline
+ /// instead, where what it says is read first. Its room is kept whether it is up or not.
final Widget? status;
/// The foot: the accounts and the quiet line under them.
@@ -118,10 +121,15 @@ class OnboardingFrame extends StatelessWidget {
scaler.scale(TtySize.title) * 1.2 + 20,
);
final quiet = math.max(44.0, scaler.scale(quietSize) * 1.45);
+ // Room for two lines of status: a sign-in's failure can run to a second.
+ final statusRow = 2 * scaler.scale(quietSize) * 1.45;
+ // ① says it under the headline; ② under the picture.
+ final statusUnderHeadline = layout == OnboardingLayout.welcome;
final (head, foot) = switch (layout) {
- // The headline's three lines; the two accounts and the quiet line under them.
+ // The headline's three lines and the status's two; the two accounts and the quiet line under
+ // them.
OnboardingLayout.welcome => (
- math.max(3 * line, 2 * line + _underGap + button),
+ 3 * line + _statusGap + statusRow,
2 * button + 2 * _buttonGap + quiet + 8,
),
// Two lines of headline, the link and the steps; one quiet line.
@@ -135,8 +143,7 @@ class OnboardingFrame extends StatelessWidget {
quiet + 8,
),
};
- // Room for two lines under the picture: a sign-in's failure can run to a second.
- final statusRow = 2 * scaler.scale(quietSize) * 1.45;
+ final underPicture = statusUnderHeadline ? 0.0 : 10 + statusRow;
return LayoutBuilder(
builder: (context, box) {
@@ -145,13 +152,13 @@ class OnboardingFrame extends StatelessWidget {
final middleTop = headTop + head + 24;
final middleBottom = height - foot - 16;
// The picture and its status line, centred in what is left between the words and the foot.
- final room = math.max(0.0, middleBottom - middleTop - statusRow - 10);
+ final room = math.max(0.0, middleBottom - middleTop - underPicture);
final pictureWidth = math.max(
0.0,
math.min(width - 2 * _pictureSide, room * 320 / 300),
);
final pictureHeight = pictureWidth * 300 / 320;
- final block = pictureHeight + 10 + statusRow;
+ final block = pictureHeight + underPicture;
final pictureTop =
middleTop + math.max(0.0, (middleBottom - middleTop - block) / 2);
@@ -170,7 +177,7 @@ class OnboardingFrame extends StatelessWidget {
),
),
),
- if (status case final status?)
+ if (status case final status? when !statusUnderHeadline)
Positioned(
left: side,
right: side,
@@ -185,6 +192,7 @@ class OnboardingFrame extends StatelessWidget {
headline: headline,
headlineKey: headlineKey,
under: underHeadline,
+ status: statusUnderHeadline ? status : null,
),
),
if (actions case final actions?)
@@ -200,6 +208,9 @@ class OnboardingFrame extends StatelessWidget {
}
static const double _underGap = 23;
+
+ /// ①'s status under the headline: the gap above it.
+ static const double _statusGap = 14;
static const double _buttonGap = 10;
}
@@ -281,19 +292,25 @@ class OnboardingStage extends StatelessWidget {
}
/// The headline, and what goes under it, changing together: the new words rise 8pt into place as
-/// the old fade.
+/// the old fade. The welcome's [status] under them comes and goes on its own, the headline still.
class _Words extends StatelessWidget {
- const _Words({required this.headline, this.headlineKey, this.under});
+ const _Words({
+ required this.headline,
+ this.headlineKey,
+ this.under,
+ this.status,
+ });
final String headline;
final Key? headlineKey;
final Widget? under;
+ final Widget? status;
@override
Widget build(BuildContext context) {
final tty = Tty.of(context);
final still = MediaQuery.maybeDisableAnimationsOf(context) ?? false;
- return AnimatedSwitcher(
+ final words = AnimatedSwitcher(
duration: Duration(milliseconds: still ? 200 : 250),
switchInCurve: Curves.easeOut,
switchOutCurve: Curves.easeIn,
@@ -336,6 +353,18 @@ class _Words extends StatelessWidget {
],
),
);
+ // One column whether the status is up or not, so the headline is not built anew as it comes.
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ words,
+ if (status case final status?) ...[
+ const SizedBox(height: OnboardingFrame._statusGap),
+ status,
+ ],
+ ],
+ );
}
}
diff --git a/mobile/lib/phone/welcome/phone_welcome.dart b/mobile/lib/phone/welcome/phone_welcome.dart
index be626168e..9de0a5505 100644
--- a/mobile/lib/phone/welcome/phone_welcome.dart
+++ b/mobile/lib/phone/welcome/phone_welcome.dart
@@ -55,8 +55,9 @@ import 'sign_in_provider_button.dart';
/// No sample, no "Is Harness on your computer?", no tips.
///
/// ⚠️ **The foot never changes height.** While an account's page is up, the line of lesser ways in
-/// under the buttons becomes Cancel; why it did not finish is said under the picture — so the
-/// picture, in the same place on every onboarding screen ([OnboardingFrame]), never moves for it.
+/// under the buttons becomes Cancel; why it did not finish is said under the headline, in room
+/// kept for it — so the picture, in the same place on every onboarding screen ([OnboardingFrame]),
+/// never moves for it.
class PhoneWelcome extends StatefulWidget {
const PhoneWelcome({
super.key,
@@ -96,7 +97,7 @@ class _PhoneWelcomeState extends State<PhoneWelcome> {
String? _error;
- /// A line under the picture that is neither a failure nor a sign-out: what to do next.
+ /// A line under the headline that is neither a failure nor a sign-out: what to do next.
String? _notice;
int _resendIn = 0;
@@ -116,7 +117,7 @@ class _PhoneWelcomeState extends State<PhoneWelcome> {
}
/// "Continue with Google / Apple": the account's own sign-in page, in the app. Its failure is
- /// said under the picture; a cancel says nothing ([AppNotifier.signInWithProvider]).
+ /// said under the headline; a cancel says nothing ([AppNotifier.signInWithProvider]).
Future<void> _signInWith(SignInProvider provider) async {
if (widget.notifier.signingIn) return;
setState(() => _error = null);
@@ -627,7 +628,7 @@ class _Dot extends StatelessWidget {
}
}
-/// A line under the picture, in the status line's place: why an account's sign-in did not finish
+/// A line under the headline, in the status line's place: why an account's sign-in did not finish
/// (the terminal's red ✗), why a phone that was signed in is back here (the sign-out mark in its
/// yellow — not red: the person did nothing wrong, and signing in again is the whole of what to do),
/// or what to do next ([icon] in place of the sign-out mark).
@@ -668,7 +669,8 @@ class _Said extends StatelessWidget {
TextSpan(text: text),
],
),
- textAlign: TextAlign.center,
+ // Left, on the headline's edge, as the words above it are.
+ textAlign: TextAlign.start,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: style.copyWith(color: error ? tty.red : tty.text),
diff --git a/mobile/test/phone_welcome_first_screen_test.dart b/mobile/test/phone_welcome_first_screen_test.dart
index 78eb692ac..420092794 100644
--- a/mobile/test/phone_welcome_first_screen_test.dart
+++ b/mobile/test/phone_welcome_first_screen_test.dart
@@ -181,7 +181,7 @@ void main() {
},
);
- testWidgets('why the phone was signed out is said under the picture', (
+ testWidgets('why the phone was signed out is said under the headline', (
tester,
) async {
await pump(tester);
@@ -189,11 +189,20 @@ void main() {
notifier.signedOutReason = 'You were signed out on another device.';
notifier.notifyListeners();
await tester.pump();
- expect(find.byKey(const ValueKey('welcome-signed-out')), findsOneWidget);
+ final said = find.byKey(const ValueKey('welcome-signed-out'));
+ expect(said, findsOneWidget);
expect(
find.textContaining('You were signed out on another device.'),
findsOneWidget,
);
+ // Between the headline and the picture, on the headline's left edge.
+ final headline = tester.getRect(
+ find.byKey(const ValueKey('welcome-headline')),
+ );
+ final line = tester.getRect(said);
+ expect(line.top, greaterThan(headline.bottom));
+ expect(line.left, headline.left);
+ expect(line.bottom, lessThanOrEqualTo(before.top));
expect(picture(tester), before);
});