Skip to content

Commit 1fa95d1

Browse files
committed
theme [nfc]: Extract starColor to DesignVariables.
Signed-off-by: Zixuan James Li <[email protected]>
1 parent 136b182 commit 1fa95d1

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

lib/widgets/message_list.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -896,12 +896,10 @@ class MessageWithPossibleSender extends StatelessWidget {
896896

897897
final MessageListMessageItem item;
898898

899-
// TODO(#95) unchanged in dark theme?
900-
static final _starColor = const HSLColor.fromAHSL(0.5, 47, 1, 0.41).toColor();
901-
902899
@override
903900
Widget build(BuildContext context) {
904901
final store = PerAccountStoreWidget.of(context);
902+
final designVariables = DesignVariables.of(context);
905903

906904
final message = item.message;
907905
final sender = store.users[message.senderId];
@@ -980,7 +978,7 @@ class MessageWithPossibleSender extends StatelessWidget {
980978
// Design from Figma at:
981979
// https://www.figma.com/file/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=813%3A28817&mode=dev .
982980
? Padding(padding: const EdgeInsets.only(top: 4),
983-
child: Icon(ZulipIcons.star_filled, size: 16, color: _starColor))
981+
child: Icon(ZulipIcons.star_filled, size: 16, color: designVariables.star))
984982
: null),
985983
]),
986984
])));

lib/widgets/theme.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
8181
borderBar = const Color(0x33000000),
8282
icon = const Color(0xff666699),
8383
title = const Color(0xff1a1a1a),
84-
streamColorSwatches = StreamColorSwatches.light;
84+
streamColorSwatches = StreamColorSwatches.light,
85+
// TODO(#95) unchanged in dark theme?
86+
star = const HSLColor.fromAHSL(0.5, 47, 1, 0.41).toColor();
8587

8688
DesignVariables._({
8789
required this.bgMain,
@@ -90,6 +92,7 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
9092
required this.icon,
9193
required this.title,
9294
required this.streamColorSwatches,
95+
required this.star,
9396
});
9497

9598
/// The [DesignVariables] from the context's active theme.
@@ -111,6 +114,9 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
111114
// Not exactly from the Figma design, but from Vlad anyway.
112115
final StreamColorSwatches streamColorSwatches;
113116

117+
// Not named variables in Figma; taken from older Figma drafts, or elsewhere.
118+
final Color star;
119+
114120
@override
115121
DesignVariables copyWith({
116122
Color? bgMain,
@@ -119,6 +125,7 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
119125
Color? icon,
120126
Color? title,
121127
StreamColorSwatches? streamColorSwatches,
128+
Color? star,
122129
}) {
123130
return DesignVariables._(
124131
bgMain: bgMain ?? this.bgMain,
@@ -127,6 +134,7 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
127134
icon: icon ?? this.icon,
128135
title: title ?? this.title,
129136
streamColorSwatches: streamColorSwatches ?? this.streamColorSwatches,
137+
star: star ?? this.star,
130138
);
131139
}
132140

@@ -142,6 +150,7 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
142150
icon: Color.lerp(icon, other.icon, t)!,
143151
title: Color.lerp(title, other.title, t)!,
144152
streamColorSwatches: StreamColorSwatches.lerp(streamColorSwatches, other.streamColorSwatches, t),
153+
star: Color.lerp(star, other.star, t)!,
145154
);
146155
}
147156
}

0 commit comments

Comments
 (0)