mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
## Summary - refine mobile message metadata, search spacing, and Activity filter semantics - add channel-parity Latest navigation and stable tail following to threads - synchronize Android composer/keyboard geometry and keep Latest spacing stable across IME transitions ## Validation - `bin/just mobile-check` - `bin/just mobile-test` (1,276 tests) - Pixel 10 install/launch and channel/thread keyboard, Latest, tail, and back-navigation review - signed iPhone install/launch workflow ## Snapshots See the review snapshots below. --------- Signed-off-by: kenny lopez <klopez4212@gmail.com> Signed-off-by: Kenny Lopez <klopez4212@gmail.com> Signed-off-by: Princess Donut <b238ea756dee4d98afa5883fc7f1de61eeabe65bf700e3a5a5a80db5e42e2c2b@buzz.block.builderlab.xyz> Co-authored-by: Fast Fizz <2df81cb51f05a9d5387ef24d7b9ecb8fcdfcd1c70ffabc67061c9596e1b5b1c4@buzz.block.builderlab.xyz> Co-authored-by: Princess Donut <b238ea756dee4d98afa5883fc7f1de61eeabe65bf700e3a5a5a80db5e42e2c2b@buzz.block.builderlab.xyz>
137 lines
4.1 KiB
Dart
137 lines
4.1 KiB
Dart
import 'package:buzz/shared/theme/theme.dart';
|
|
import 'package:buzz/shared/widgets/message_author_meta.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
void main() {
|
|
testWidgets('keeps the timestamp next to a short name without a separator', (
|
|
tester,
|
|
) async {
|
|
const displayNameKey = Key('author-display-name');
|
|
const timestampKey = Key('author-timestamp');
|
|
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
theme: AppTheme.light(),
|
|
home: const Scaffold(
|
|
body: SizedBox(
|
|
width: 300,
|
|
child: MessageAuthorMeta(
|
|
displayName: 'Alice',
|
|
timestamp: '2m',
|
|
displayNameKey: displayNameKey,
|
|
timestampKey: timestampKey,
|
|
nameColor: Colors.black,
|
|
metadataColor: Colors.grey,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
|
|
final displayNameRect = tester.getRect(find.byKey(displayNameKey));
|
|
final timestampRect = tester.getRect(find.byKey(timestampKey));
|
|
|
|
expect(find.text('·'), findsNothing);
|
|
expect(timestampRect.left - displayNameRect.right, Grid.xxs);
|
|
expect(
|
|
tester.widget<Text>(find.byKey(timestampKey)).style?.fontSize,
|
|
messageTimestampTextStyle.fontSize,
|
|
);
|
|
expect(tester.takeException(), isNull);
|
|
});
|
|
|
|
testWidgets('reallocates unused metadata width to the display name', (
|
|
tester,
|
|
) async {
|
|
const displayNameKey = Key('author-display-name');
|
|
const timestampKey = Key('author-timestamp');
|
|
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
theme: AppTheme.light(),
|
|
home: const Scaffold(
|
|
body: SizedBox(
|
|
width: 300,
|
|
child: MessageAuthorMeta(
|
|
displayName: 'A display name that needs the available width',
|
|
username: 'al',
|
|
timestamp: '2m',
|
|
displayNameKey: displayNameKey,
|
|
timestampKey: timestampKey,
|
|
nameColor: Colors.black,
|
|
metadataColor: Colors.grey,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
|
|
final row = find.byType(MessageAuthorMeta);
|
|
final displayName = find.byKey(displayNameKey);
|
|
final timestamp = find.byKey(timestampKey);
|
|
|
|
expect(
|
|
tester.getSize(displayName).width,
|
|
greaterThan(tester.getSize(row).width / 2),
|
|
);
|
|
expect(
|
|
tester.getTopRight(timestamp).dx,
|
|
closeTo(tester.getTopRight(row).dx, 0.01),
|
|
);
|
|
expect(tester.takeException(), isNull);
|
|
});
|
|
|
|
testWidgets('constrains long metadata at large accessible text sizes', (
|
|
tester,
|
|
) async {
|
|
const displayNameKey = Key('author-display-name');
|
|
const timestampKey = Key('author-timestamp');
|
|
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
theme: AppTheme.light(),
|
|
home: const MediaQuery(
|
|
data: MediaQueryData(textScaler: TextScaler.linear(2)),
|
|
child: Scaffold(
|
|
body: SizedBox(
|
|
width: 220,
|
|
child: MessageAuthorMeta(
|
|
displayName: 'A very long display name',
|
|
username: 'a-very-long-username',
|
|
timestamp: 'Mar 15, 2025',
|
|
displayNameKey: displayNameKey,
|
|
timestampKey: timestampKey,
|
|
nameColor: Colors.black,
|
|
metadataColor: Colors.grey,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
|
|
final timestamp = tester.widget<Text>(find.byKey(timestampKey));
|
|
expect(timestamp.maxLines, 1);
|
|
expect(timestamp.overflow, TextOverflow.ellipsis);
|
|
final nameRichText = tester.widget<RichText>(
|
|
find.descendant(
|
|
of: find.byKey(displayNameKey),
|
|
matching: find.byType(RichText),
|
|
),
|
|
);
|
|
final timestampRichText = tester.widget<RichText>(
|
|
find.descendant(
|
|
of: find.byKey(timestampKey),
|
|
matching: find.byType(RichText),
|
|
),
|
|
);
|
|
expect(nameRichText.textScaler.scale(15), 30);
|
|
expect(timestampRichText.textScaler.scale(13.1), 26.2);
|
|
expect(tester.takeException(), isNull);
|
|
});
|
|
}
|