Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class _InboxRow extends HookConsumerWidget {
height: 6,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: context.colors.primary,
color: context.appColors.unread,
),
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class _ChannelTile extends ConsumerWidget {
height: 6,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: context.colors.primary,
color: context.appColors.unread,
),
),
),
Expand Down
7 changes: 7 additions & 0 deletions mobile/lib/shared/theme/app_colors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ class AppColors extends ThemeExtension<AppColors> {
final Color success;
final Color warning;
final Color accent;

/// Unread activity dots, independent of the selected accent.
final Color unread;
final Color huddleDrawerSurface;
final Color huddleControlSurface;
final Color onHuddleDrawer;
Expand All @@ -18,6 +21,7 @@ class AppColors extends ThemeExtension<AppColors> {
required this.success,
required this.warning,
required this.accent,
required this.unread,
required this.huddleDrawerSurface,
required this.huddleControlSurface,
required this.onHuddleDrawer,
Expand All @@ -29,6 +33,7 @@ class AppColors extends ThemeExtension<AppColors> {
Color? success,
Color? warning,
Color? accent,
Color? unread,
Color? huddleDrawerSurface,
Color? huddleControlSurface,
Color? onHuddleDrawer,
Expand All @@ -37,6 +42,7 @@ class AppColors extends ThemeExtension<AppColors> {
success: success ?? this.success,
warning: warning ?? this.warning,
accent: accent ?? this.accent,
unread: unread ?? this.unread,
huddleDrawerSurface: huddleDrawerSurface ?? this.huddleDrawerSurface,
huddleControlSurface: huddleControlSurface ?? this.huddleControlSurface,
onHuddleDrawer: onHuddleDrawer ?? this.onHuddleDrawer,
Expand All @@ -50,6 +56,7 @@ class AppColors extends ThemeExtension<AppColors> {
success: Color.lerp(success, other.success, t)!,
warning: Color.lerp(warning, other.warning, t)!,
accent: Color.lerp(accent, other.accent, t)!,
unread: Color.lerp(unread, other.unread, t)!,
huddleDrawerSurface: Color.lerp(
huddleDrawerSurface,
other.huddleDrawerSurface,
Expand Down
2 changes: 2 additions & 0 deletions mobile/lib/shared/theme/app_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class AppTheme {
success: const Color(0xFF218358), // Desktop green-11
warning: const Color(0xFFAB6400), // Desktop amber-11
accent: scheme.tertiary,
unread: const Color(0xFFDF1E85), // Desktop status-unread (magenta-9)
huddleDrawerSurface: const Color(0xFF000000),
huddleControlSurface: const Color(0xFF333333),
onHuddleDrawer: const Color(0xFFFAFAFA),
Expand All @@ -64,6 +65,7 @@ class AppTheme {
success: const Color(0xFF3DD68C), // Desktop green-11
warning: const Color(0xFFFFCA16), // Desktop amber-11
accent: scheme.tertiary,
unread: const Color(0xFFF4BCCF), // Desktop status-unread (magenta-11)
huddleDrawerSurface: scheme.primaryContainer,
huddleControlSurface: Color.alphaBlend(
scheme.onPrimaryContainer.withValues(alpha: 0.18),
Expand Down
36 changes: 25 additions & 11 deletions mobile/test/features/activity/activity_page_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ void main() {
};

Future<Widget> buildTestable({
Brightness brightness = Brightness.light,
HomeFeedResponse? feed,
ActivityNotifier Function()? activityNotifier,
Map<String, UserProfile>? users,
Expand Down Expand Up @@ -171,7 +172,9 @@ void main() {
...overrides,
],
child: MaterialApp(
theme: AppTheme.light(),
theme: brightness == Brightness.dark
? AppTheme.dark()
: AppTheme.light(),
builder: (context, child) => MediaQuery(
data: MediaQuery.of(
context,
Expand Down Expand Up @@ -1002,17 +1005,28 @@ void main() {
});

testWidgets('unread rows show a dot; read rows do not', (tester) async {
await tester.pumpWidget(
await buildTestable(
// ch1 fully read; ch2 (thread) unread.
readContexts: {'ch1': now},
),
);
await tester.pumpAndSettle();
for (final brightness in Brightness.values) {
await tester.pumpWidget(
await buildTestable(
brightness: brightness,
// ch1 fully read; ch2 (thread) unread.
readContexts: {'ch1': now},
),
);
await tester.pumpAndSettle();

expect(find.byKey(const ValueKey('inbox-unread-dot-m1')), findsNothing);
expect(find.byKey(const ValueKey('inbox-unread-dot-ag1')), findsNothing);
expect(find.byKey(const ValueKey('inbox-unread-dot-a1')), findsOneWidget);
expect(find.byKey(const ValueKey('inbox-unread-dot-m1')), findsNothing);
expect(find.byKey(const ValueKey('inbox-unread-dot-ag1')), findsNothing);
final dot = tester.widget<Container>(
find.byKey(const ValueKey('inbox-unread-dot-a1')),
);
expect(
(dot.decoration as BoxDecoration).color,
brightness == Brightness.dark
? const Color(0xFFF4BCCF)
: const Color(0xFFDF1E85),
);
}
});

testWidgets(
Expand Down
15 changes: 14 additions & 1 deletion mobile/test/features/channels/channels_page_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3627,7 +3627,10 @@ void main() {
);
});

for (final viaMenu in [false, true]) {
for (final (viaMenu, brightness) in [
(false, Brightness.light),
(true, Brightness.dark),
]) {
testWidgets('dots, not bolds, channels with only unread thread replies '
'(cleared ${viaMenu ? 'by Mark read' : 'by reading the thread'})', (
tester,
Expand Down Expand Up @@ -3661,6 +3664,7 @@ void main() {

await tester.pumpWidget(
buildTestable(
brightness: brightness,
overrides: [
channelsProvider.overrideWith(
() => _FakeNotifier(
Expand Down Expand Up @@ -3697,6 +3701,15 @@ void main() {
find.byKey(const ValueKey('channel-attention-dot-1')),
findsOneWidget,
);
final dot = tester.widget<Container>(
find.byKey(const ValueKey('channel-attention-dot-1')),
);
expect(
(dot.decoration as BoxDecoration).color,
brightness == Brightness.dark
? const Color(0xFFF4BCCF)
: const Color(0xFFDF1E85),
);
expect(
find.bySemanticsLabel(RegExp(r'general[\s\S]*Needs your attention')),
findsOneWidget,
Expand Down
11 changes: 11 additions & 0 deletions mobile/test/shared/theme/app_theme_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ import 'package:buzz/shared/theme/app_colors.dart';
import 'package:buzz/shared/theme/app_theme.dart';

void main() {
test('unread dots contrast with the list surface in both modes', () {
for (final theme in [AppTheme.light(), AppTheme.dark()]) {
final dot = theme.extension<AppColors>()!.unread.computeLuminance();
final surface = theme.colorScheme.surface.computeLuminance();
final contrast = dot > surface
? (dot + .05) / (surface + .05)
: (surface + .05) / (dot + .05);
expect(contrast, greaterThanOrEqualTo(3), reason: '${theme.brightness}');
}
});

test('disables Material touch ripples in every app theme', () {
expect(AppTheme.light().splashFactory, NoSplash.splashFactory);
expect(AppTheme.dark().splashFactory, NoSplash.splashFactory);
Expand Down
Loading