Skip to content

Commit 7ba002d

Browse files
committed
theme: Extract starColor to DesignVariables.
Signed-off-by: Zixuan James Li <[email protected]>
1 parent 9fcc7e6 commit 7ba002d

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-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 theme = 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: theme.starColor))
984982
: null),
985983
]),
986984
])));

lib/widgets/theme.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ 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+
starColor = const HSLColor.fromAHSL(0.5, 47, 1, 0.41).toColor();
8586

8687
DesignVariables._({
8788
required this.bgMain,
@@ -90,6 +91,7 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
9091
required this.icon,
9192
required this.title,
9293
required this.streamColorSwatches,
94+
required this.starColor,
9395
});
9496

9597
/// The [DesignVariables] from the context's active theme.
@@ -110,6 +112,7 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
110112

111113
// Not exactly from the Figma design, but from Vlad anyway.
112114
final StreamColorSwatches streamColorSwatches;
115+
final Color starColor;
113116

114117
@override
115118
DesignVariables copyWith({
@@ -119,6 +122,7 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
119122
Color? icon,
120123
Color? title,
121124
StreamColorSwatches? streamColorSwatches,
125+
Color? starColor,
122126
}) {
123127
return DesignVariables._(
124128
bgMain: bgMain ?? this.bgMain,
@@ -127,6 +131,7 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
127131
icon: icon ?? this.icon,
128132
title: title ?? this.title,
129133
streamColorSwatches: streamColorSwatches ?? this.streamColorSwatches,
134+
starColor: starColor ?? this.starColor,
130135
);
131136
}
132137

@@ -142,6 +147,7 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
142147
icon: Color.lerp(icon, other?.icon, t)!,
143148
title: Color.lerp(title, other?.title, t)!,
144149
streamColorSwatches: streamColorSwatches.lerp(other?.streamColorSwatches, t),
150+
starColor: Color.lerp(starColor, other?.starColor, t)!,
145151
);
146152
}
147153
}

0 commit comments

Comments
 (0)