Skip to content

Commit 504f5f2

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 5e8d0a8 commit 504f5f2

File tree

2 files changed

+60
-2
lines changed

2 files changed

+60
-2
lines changed

lib/widgets/compose_box.dart

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,59 @@ 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+
static final light = ComposeBoxTheme._(
30+
boxShadow: null,
31+
);
32+
33+
static final dark = ComposeBoxTheme._(
34+
boxShadow: [BoxShadow(
35+
color: DesignVariables.dark.bgTopBar,
36+
offset: const Offset(0, -4),
37+
blurRadius: 16,
38+
spreadRadius: 0,
39+
)],
40+
);
41+
42+
ComposeBoxTheme._({
43+
required this.boxShadow,
44+
});
45+
46+
/// The [ComposeBoxTheme] from the context's active theme.
47+
///
48+
/// The [ThemeData] must include [ComposeBoxTheme] in [ThemeData.extensions].
49+
static ComposeBoxTheme of(BuildContext context) {
50+
final theme = Theme.of(context);
51+
final extension = theme.extension<ComposeBoxTheme>();
52+
assert(extension != null);
53+
return extension!;
54+
}
55+
56+
final List<BoxShadow>? boxShadow;
57+
58+
@override
59+
ComposeBoxTheme copyWith({
60+
List<BoxShadow>? boxShadow,
61+
}) {
62+
return ComposeBoxTheme._(
63+
boxShadow: boxShadow ?? this.boxShadow,
64+
);
65+
}
66+
67+
@override
68+
ComposeBoxTheme lerp(ComposeBoxTheme other, double t) {
69+
if (identical(this, other)) {
70+
return this;
71+
}
72+
return ComposeBoxTheme._(
73+
boxShadow: BoxShadow.lerpList(boxShadow, other.boxShadow, t)!,
74+
);
75+
}
76+
}
77+
2578
const double _composeButtonSize = 44;
2679

2780
/// A [TextEditingController] for use in the compose box.
@@ -1056,7 +1109,9 @@ class _ComposeBoxContainer extends StatelessWidget {
10561109
// the message list itself
10571110
return Container(width: double.infinity,
10581111
decoration: BoxDecoration(
1059-
border: Border(top: BorderSide(color: designVariables.borderBar))),
1112+
border: Border(top: BorderSide(color: designVariables.borderBar)),
1113+
boxShadow: ComposeBoxTheme.of(context).boxShadow,
1114+
),
10601115
// TODO(#720) try a Stack for the overlaid linear progress indicator
10611116
child: Material(
10621117
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,
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,
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),

0 commit comments

Comments
 (0)