Skip to content

Commit c6bb562

Browse files
committed
compose: Compose-box border is subtle in dark mode
Updated the top border and added shadow effect to the top of the compose box to ensure it is subtle in dark mode. For reference, see the Figma design: https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=5908-64038&t=alSmAmdRXFDwT4IT-1 Fixes: #1207
1 parent efcf201 commit c6bb562

File tree

3 files changed

+80
-18
lines changed

3 files changed

+80
-18
lines changed

lib/widgets/compose_box.dart

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,63 @@ import 'store.dart';
2222
import 'text.dart';
2323
import 'theme.dart';
2424

25+
/// Compose-box styles that differ between light and dark theme.
26+
///
27+
/// These styles will animate on theme changes (with help from [lerp]).
28+
class ComposeBoxTheme extends ThemeExtension<ComposeBoxTheme> {
29+
factory ComposeBoxTheme.light(BuildContext context) {
30+
return ComposeBoxTheme._(
31+
boxShadow: null,
32+
);
33+
}
34+
35+
factory ComposeBoxTheme.dark(BuildContext context) {
36+
return ComposeBoxTheme._(
37+
boxShadow: [BoxShadow(
38+
color: DesignVariables.dark.bgTopBar,
39+
offset: const Offset(0, -4),
40+
blurRadius: 16,
41+
spreadRadius: 0,
42+
)],
43+
);
44+
}
45+
46+
ComposeBoxTheme._({
47+
required this.boxShadow,
48+
});
49+
50+
/// The [ComposeBoxTheme] from the context's active theme.
51+
///
52+
/// The [ThemeData] must include [ComposeBoxTheme] in [ThemeData.extensions].
53+
static ComposeBoxTheme of(BuildContext context) {
54+
final theme = Theme.of(context);
55+
final extension = theme.extension<ComposeBoxTheme>();
56+
assert(extension != null);
57+
return extension!;
58+
}
59+
60+
final List<BoxShadow>? boxShadow;
61+
62+
@override
63+
ComposeBoxTheme copyWith({
64+
List<BoxShadow>? boxShadow,
65+
}) {
66+
return ComposeBoxTheme._(
67+
boxShadow: boxShadow ?? this.boxShadow,
68+
);
69+
}
70+
71+
@override
72+
ComposeBoxTheme lerp(ComposeBoxTheme other, double t) {
73+
if (identical(this, other)) {
74+
return this;
75+
}
76+
return ComposeBoxTheme._(
77+
boxShadow: BoxShadow.lerpList(boxShadow, other.boxShadow, t)!,
78+
);
79+
}
80+
}
81+
2582
const double _composeButtonSize = 44;
2683

2784
/// A [TextEditingController] for use in the compose box.
@@ -1056,7 +1113,9 @@ class _ComposeBoxContainer extends StatelessWidget {
10561113
// the message list itself
10571114
return Container(width: double.infinity,
10581115
decoration: BoxDecoration(
1059-
border: Border(top: BorderSide(color: designVariables.borderBar))),
1116+
border: Border(top: BorderSide(color: designVariables.borderBar)),
1117+
boxShadow: ComposeBoxTheme.of(context).boxShadow,
1118+
),
10601119
// TODO(#720) try a Stack for the overlaid linear progress indicator
10611120
child: Material(
10621121
color: designVariables.composeBoxBg,

lib/widgets/theme.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:flutter/material.dart';
22

33
import '../api/model/model.dart';
4+
import 'compose_box.dart';
45
import 'content.dart';
56
import 'emoji_reaction.dart';
67
import 'message_list.dart';
@@ -32,6 +33,7 @@ ThemeData zulipThemeData(BuildContext context) {
3233
designVariables,
3334
EmojiReactionTheme.light(),
3435
MessageListTheme.light(),
36+
ComposeBoxTheme.light(context),
3537
];
3638
}
3739
case Brightness.dark: {
@@ -41,6 +43,7 @@ ThemeData zulipThemeData(BuildContext context) {
4143
designVariables,
4244
EmojiReactionTheme.dark(),
4345
MessageListTheme.dark(),
46+
ComposeBoxTheme.dark(context),
4447
];
4548
}
4649
}
@@ -175,7 +178,7 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
175178
bgMenuButtonActive: Colors.black.withValues(alpha: 0.2),
176179
bgMenuButtonSelected: Colors.black.withValues(alpha: 0.25),
177180
bgTopBar: const Color(0xff242424),
178-
borderBar: Colors.black.withValues(alpha: 0.5),
181+
borderBar: const Color(0xffffffff).withValues(alpha: 0.1),
179182
borderMenuButtonSelected: Colors.white.withValues(alpha: 0.1),
180183
btnLabelAttLowIntDanger: const Color(0xffff8b7c),
181184
btnLabelAttMediumIntDanger: const Color(0xffff8b7c),

pubspec.lock

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ packages:
138138
dependency: transitive
139139
description:
140140
name: characters
141-
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
141+
sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
142142
url: "https://pub.dev"
143143
source: hosted
144-
version: "1.3.0"
144+
version: "1.4.0"
145145
charcode:
146146
dependency: transitive
147147
description:
@@ -194,10 +194,10 @@ packages:
194194
dependency: "direct main"
195195
description:
196196
name: collection
197-
sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
197+
sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
198198
url: "https://pub.dev"
199199
source: hosted
200-
version: "1.19.0"
200+
version: "1.19.1"
201201
color_models:
202202
dependency: "direct overridden"
203203
description:
@@ -711,10 +711,10 @@ packages:
711711
dependency: transitive
712712
description:
713713
name: matcher
714-
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
714+
sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2
715715
url: "https://pub.dev"
716716
source: hosted
717-
version: "0.12.16+1"
717+
version: "0.12.17"
718718
material_color_utilities:
719719
dependency: transitive
720720
description:
@@ -727,10 +727,10 @@ packages:
727727
dependency: transitive
728728
description:
729729
name: meta
730-
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
730+
sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c
731731
url: "https://pub.dev"
732732
source: hosted
733-
version: "1.15.0"
733+
version: "1.16.0"
734734
mime:
735735
dependency: "direct main"
736736
description:
@@ -1044,18 +1044,18 @@ packages:
10441044
dependency: "direct dev"
10451045
description:
10461046
name: stack_trace
1047-
sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377"
1047+
sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1"
10481048
url: "https://pub.dev"
10491049
source: hosted
1050-
version: "1.12.0"
1050+
version: "1.12.1"
10511051
stream_channel:
10521052
dependency: transitive
10531053
description:
10541054
name: stream_channel
1055-
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
1055+
sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d"
10561056
url: "https://pub.dev"
10571057
source: hosted
1058-
version: "2.1.2"
1058+
version: "2.1.4"
10591059
stream_transform:
10601060
dependency: transitive
10611061
description:
@@ -1068,10 +1068,10 @@ packages:
10681068
dependency: transitive
10691069
description:
10701070
name: string_scanner
1071-
sha256: "0bd04f5bb74fcd6ff0606a888a30e917af9bd52820b178eaa464beb11dca84b6"
1071+
sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43"
10721072
url: "https://pub.dev"
10731073
source: hosted
1074-
version: "1.4.0"
1074+
version: "1.4.1"
10751075
sync_http:
10761076
dependency: transitive
10771077
description:
@@ -1084,10 +1084,10 @@ packages:
10841084
dependency: transitive
10851085
description:
10861086
name: term_glyph
1087-
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
1087+
sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e"
10881088
url: "https://pub.dev"
10891089
source: hosted
1090-
version: "1.2.1"
1090+
version: "1.2.2"
10911091
test:
10921092
dependency: "direct dev"
10931093
description:

0 commit comments

Comments
 (0)