Skip to content

Commit 7b30960

Browse files
committed
compose_box: Use new send button color, shape and icon
DesignVariables.icon's value has been updated to match the current design. This would affect the appearance of the ChooseAccountPageOverflowButton on the choose account page, which is intentional. Note that we set the color on `Icon` instead of `IconButton`, because the color shouldn't apply to for example the background color of the button when highlighted, etc. See also: - https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=3954-13395 - https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=3862-14350
1 parent e8856bb commit 7b30960

File tree

3 files changed

+15
-25
lines changed

3 files changed

+15
-25
lines changed

lib/widgets/compose_box.dart

+6-18
Original file line numberDiff line numberDiff line change
@@ -929,30 +929,18 @@ class _SendButtonState extends State<_SendButton> {
929929

930930
@override
931931
Widget build(BuildContext context) {
932-
final disabled = _hasValidationErrors;
933-
final colorScheme = Theme.of(context).colorScheme;
932+
final designVariables = DesignVariables.of(context);
934933
final zulipLocalizations = ZulipLocalizations.of(context);
935934

936-
// Copy FilledButton defaults (_FilledButtonDefaultsM3.backgroundColor)
937-
final backgroundColor = disabled
938-
? colorScheme.onSurface.withValues(alpha: 0.12)
939-
: colorScheme.primary;
940-
941-
// Copy FilledButton defaults (_FilledButtonDefaultsM3.foregroundColor)
942-
final foregroundColor = disabled
943-
? colorScheme.onSurface.withValues(alpha: 0.38)
944-
: colorScheme.onPrimary;
935+
final iconColor = _hasValidationErrors
936+
? designVariables.icon.withValues(alpha: 0.5)
937+
: designVariables.icon;
945938

946-
return Ink(
939+
return SizedBox(
947940
width: _composeButtonWidth,
948-
decoration: BoxDecoration(
949-
borderRadius: const BorderRadius.all(Radius.circular(8.0)),
950-
color: backgroundColor,
951-
),
952941
child: IconButton(
953942
tooltip: zulipLocalizations.composeBoxSendTooltip,
954-
color: foregroundColor,
955-
icon: const Icon(ZulipIcons.send),
943+
icon: Icon(ZulipIcons.send, color: iconColor),
956944
onPressed: _send));
957945
}
958946
}

lib/widgets/theme.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
123123
contextMenuItemBg: const Color(0xff6159e1),
124124
contextMenuItemText: const Color(0xff381da7),
125125
foreground: const Color(0xff000000),
126-
icon: const Color(0xff666699),
126+
icon: const Color(0xff6159e1),
127127
labelCounterUnread: const Color(0xff222222),
128128
labelEdited: const HSLColor.fromAHSL(0.35, 0, 0, 0).toColor(),
129129
labelMenuButton: const Color(0xff222222),
@@ -161,7 +161,7 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
161161
contextMenuItemBg: const Color(0xff7977fe),
162162
contextMenuItemText: const Color(0xff9398fd),
163163
foreground: const Color(0xffffffff),
164-
icon: const Color(0xff666699),
164+
icon: const Color(0xff7977fe),
165165
labelCounterUnread: const Color(0xffffffff).withValues(alpha: 0.7),
166166
labelEdited: const HSLColor.fromAHSL(0.35, 0, 0, 1).toColor(),
167167
labelMenuButton: const Color(0xffffffff).withValues(alpha: 0.85),

test/widgets/compose_box_test.dart

+7-5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import 'package:zulip/widgets/app.dart';
2020
import 'package:zulip/widgets/compose_box.dart';
2121
import 'package:zulip/widgets/page.dart';
2222
import 'package:zulip/widgets/icons.dart';
23+
import 'package:zulip/widgets/theme.dart';
2324

2425
import '../api/fake_api.dart';
2526
import '../example_data.dart' as eg;
@@ -436,11 +437,12 @@ void main() {
436437
of: find.byIcon(ZulipIcons.send),
437438
matching: find.byType(IconButton)));
438439
final sendButtonWidget = sendButtonElement.widget as IconButton;
439-
final colorScheme = Theme.of(sendButtonElement).colorScheme;
440-
final expectedForegroundColor = expected
441-
? colorScheme.onSurface.withValues(alpha: 0.38)
442-
: colorScheme.onPrimary;
443-
check(sendButtonWidget.color).isNotNull().isSameColorAs(expectedForegroundColor);
440+
final designVariables = DesignVariables.of(sendButtonElement);
441+
final expectedIconColor = expected
442+
? designVariables.icon.withValues(alpha: 0.5)
443+
: designVariables.icon;
444+
check(sendButtonWidget.icon)
445+
.isA<Icon>().color.isNotNull().isSameColorAs(expectedIconColor);
444446
}
445447

446448
group('attach from media library', () {

0 commit comments

Comments
 (0)