Skip to content

Commit 7037668

Browse files
committed
compose_box: Support redesigned button feedback
This disables the splash effect for all the compose buttons and the send button, and implements a rounded rectangular background that appears on hover/pressed. In the future we should migrate more buttons to use this style. See also: https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=3707-41711&node-type=frame&t=sSYomsJzGCt34D8N-0 Signed-off-by: Zixuan James Li <[email protected]>
1 parent 455a28e commit 7037668

File tree

2 files changed

+38
-16
lines changed

2 files changed

+38
-16
lines changed

lib/widgets/compose_box.dart

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,7 @@ class _ComposeBoxLayout extends StatelessWidget {
988988
@override
989989
Widget build(BuildContext context) {
990990
final themeData = Theme.of(context);
991+
final designVariables = DesignVariables.of(context);
991992

992993
final inputThemeData = themeData.copyWith(
993994
inputDecorationTheme: const InputDecorationTheme(
@@ -996,6 +997,18 @@ class _ComposeBoxLayout extends StatelessWidget {
996997
contentPadding: EdgeInsets.zero,
997998
border: InputBorder.none));
998999

1000+
// TODO(#417): Disable splash effects for all buttons globally.
1001+
final iconButtonThemeData = IconButtonThemeData(
1002+
style: IconButton.styleFrom(
1003+
splashFactory: NoSplash.splashFactory,
1004+
// TODO(#417): The Figma design specifies a different icon color on
1005+
// pressed, but `IconButton` currently does not have support for
1006+
// that. See also:
1007+
// https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=3707-41711&node-type=frame&t=sSYomsJzGCt34D8N-0
1008+
highlightColor: designVariables.editorButtonPressedBg,
1009+
shape: const RoundedRectangleBorder(
1010+
borderRadius: BorderRadius.all(Radius.circular(4)))));
1011+
9991012
return _ComposeBoxContainer(
10001013
child: Column(children: [
10011014
Padding(
@@ -1009,22 +1022,24 @@ class _ComposeBoxLayout extends StatelessWidget {
10091022
Container(
10101023
padding: const EdgeInsets.symmetric(horizontal: 8),
10111024
height: _composeButtonsRowHeight,
1012-
child: Row(
1013-
mainAxisAlignment: MainAxisAlignment.spaceBetween,
1014-
children: [
1015-
Row(children: [
1016-
_AttachFileButton(
1017-
contentController: contentController,
1018-
contentFocusNode: contentFocusNode),
1019-
_AttachMediaButton(
1020-
contentController: contentController,
1021-
contentFocusNode: contentFocusNode),
1022-
_AttachFromCameraButton(
1023-
contentController: contentController,
1024-
contentFocusNode: contentFocusNode),
1025-
]),
1026-
sendButton,
1027-
])),
1025+
child: IconButtonTheme(
1026+
data: iconButtonThemeData,
1027+
child: Row(
1028+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
1029+
children: [
1030+
Row(children: [
1031+
_AttachFileButton(
1032+
contentController: contentController,
1033+
contentFocusNode: contentFocusNode),
1034+
_AttachMediaButton(
1035+
contentController: contentController,
1036+
contentFocusNode: contentFocusNode),
1037+
_AttachFromCameraButton(
1038+
contentController: contentController,
1039+
contentFocusNode: contentFocusNode),
1040+
]),
1041+
sendButton,
1042+
]))),
10281043
]));
10291044
}
10301045
}

lib/widgets/theme.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
122122
contextMenuCancelText: const Color(0xff222222),
123123
contextMenuItemBg: const Color(0xff6159e1),
124124
contextMenuItemText: const Color(0xff381da7),
125+
editorButtonPressedBg: Colors.black.withValues(alpha: 0.06),
125126
foreground: const Color(0xff000000),
126127
icon: const Color(0xff6159e1),
127128
labelCounterUnread: const Color(0xff222222),
@@ -160,6 +161,7 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
160161
contextMenuCancelText: const Color(0xffffffff).withValues(alpha: 0.75),
161162
contextMenuItemBg: const Color(0xff7977fe),
162163
contextMenuItemText: const Color(0xff9398fd),
164+
editorButtonPressedBg: Colors.white.withValues(alpha: 0.06),
163165
foreground: const Color(0xffffffff),
164166
icon: const Color(0xff7977fe),
165167
labelCounterUnread: const Color(0xffffffff).withValues(alpha: 0.7),
@@ -205,6 +207,7 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
205207
required this.contextMenuCancelText,
206208
required this.contextMenuItemBg,
207209
required this.contextMenuItemText,
210+
required this.editorButtonPressedBg,
208211
required this.foreground,
209212
required this.icon,
210213
required this.labelCounterUnread,
@@ -251,6 +254,7 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
251254
final Color contextMenuCancelText;
252255
final Color contextMenuItemBg;
253256
final Color contextMenuItemText;
257+
final Color editorButtonPressedBg;
254258
final Color foreground;
255259
final Color icon;
256260
final Color labelCounterUnread;
@@ -292,6 +296,7 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
292296
Color? contextMenuCancelText,
293297
Color? contextMenuItemBg,
294298
Color? contextMenuItemText,
299+
Color? editorButtonPressedBg,
295300
Color? foreground,
296301
Color? icon,
297302
Color? labelCounterUnread,
@@ -328,6 +333,7 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
328333
contextMenuCancelText: contextMenuCancelText ?? this.contextMenuCancelText,
329334
contextMenuItemBg: contextMenuItemBg ?? this.contextMenuItemBg,
330335
contextMenuItemText: contextMenuItemText ?? this.contextMenuItemBg,
336+
editorButtonPressedBg: editorButtonPressedBg ?? this.editorButtonPressedBg,
331337
foreground: foreground ?? this.foreground,
332338
icon: icon ?? this.icon,
333339
labelCounterUnread: labelCounterUnread ?? this.labelCounterUnread,
@@ -371,6 +377,7 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
371377
contextMenuCancelText: Color.lerp(contextMenuCancelText, other.contextMenuCancelText, t)!,
372378
contextMenuItemBg: Color.lerp(contextMenuItemBg, other.contextMenuItemBg, t)!,
373379
contextMenuItemText: Color.lerp(contextMenuItemText, other.contextMenuItemBg, t)!,
380+
editorButtonPressedBg: Color.lerp(editorButtonPressedBg, other.editorButtonPressedBg, t)!,
374381
foreground: Color.lerp(foreground, other.foreground, t)!,
375382
icon: Color.lerp(icon, other.icon, t)!,
376383
labelCounterUnread: Color.lerp(labelCounterUnread, other.labelCounterUnread, t)!,

0 commit comments

Comments
 (0)