@@ -18,6 +18,7 @@ import 'dialog.dart';
18
18
import 'icons.dart' ;
19
19
import 'lightbox.dart' ;
20
20
import 'message_list.dart' ;
21
+ import 'poll.dart' ;
21
22
import 'store.dart' ;
22
23
import 'text.dart' ;
23
24
@@ -41,6 +42,10 @@ class ContentTheme extends ThemeExtension<ContentTheme> {
41
42
colorGlobalTimeBorder: const HSLColor .fromAHSL (1 , 0 , 0 , 0.8 ).toColor (),
42
43
colorMathBlockBorder: const HSLColor .fromAHSL (0.15 , 240 , 0.8 , 0.5 ).toColor (),
43
44
colorMessageMediaContainerBackground: const Color .fromRGBO (0 , 0 , 0 , 0.03 ),
45
+ colorPollNames: const HSLColor .fromAHSL (1 , 0 , 0 , .45 ).toColor (),
46
+ colorPollVoteCountBackground: const HSLColor .fromAHSL (1 , 0 , 0 , 1 ).toColor (),
47
+ colorPollVoteCountBorder: const HSLColor .fromAHSL (1 , 156 , 0.28 , 0.7 ).toColor (),
48
+ colorPollVoteCountText: const HSLColor .fromAHSL (1 , 156 , 0.41 , 0.4 ).toColor (),
44
49
colorThematicBreak: const HSLColor .fromAHSL (1 , 0 , 0 , .87 ).toColor (),
45
50
textStylePlainParagraph: _plainParagraphCommon (context).copyWith (
46
51
color: const HSLColor .fromAHSL (1 , 0 , 0 , 0.15 ).toColor (),
@@ -66,6 +71,10 @@ class ContentTheme extends ThemeExtension<ContentTheme> {
66
71
colorGlobalTimeBorder: const HSLColor .fromAHSL (0.4 , 0 , 0 , 0 ).toColor (),
67
72
colorMathBlockBorder: const HSLColor .fromAHSL (1 , 240 , 0.4 , 0.4 ).toColor (),
68
73
colorMessageMediaContainerBackground: const HSLColor .fromAHSL (0.03 , 0 , 0 , 1 ).toColor (),
74
+ colorPollNames: const HSLColor .fromAHSL (1 , 236 , .15 , .7 ).toColor (),
75
+ colorPollVoteCountBackground: const HSLColor .fromAHSL (0.2 , 0 , 0 , 0 ).toColor (),
76
+ colorPollVoteCountBorder: const HSLColor .fromAHSL (1 , 185 , 0.35 , 0.35 ).toColor (),
77
+ colorPollVoteCountText: const HSLColor .fromAHSL (1 , 185 , 0.35 , 0.65 ).toColor (),
69
78
colorThematicBreak: const HSLColor .fromAHSL (1 , 0 , 0 , .87 ).toColor ().withValues (alpha: 0.2 ),
70
79
textStylePlainParagraph: _plainParagraphCommon (context).copyWith (
71
80
color: const HSLColor .fromAHSL (0.75 , 0 , 0 , 1 ).toColor (),
@@ -90,6 +99,10 @@ class ContentTheme extends ThemeExtension<ContentTheme> {
90
99
required this .colorGlobalTimeBorder,
91
100
required this .colorMathBlockBorder,
92
101
required this .colorMessageMediaContainerBackground,
102
+ required this .colorPollNames,
103
+ required this .colorPollVoteCountBackground,
104
+ required this .colorPollVoteCountBorder,
105
+ required this .colorPollVoteCountText,
93
106
required this .colorThematicBreak,
94
107
required this .textStylePlainParagraph,
95
108
required this .codeBlockTextStyles,
@@ -115,6 +128,10 @@ class ContentTheme extends ThemeExtension<ContentTheme> {
115
128
final Color colorGlobalTimeBorder;
116
129
final Color colorMathBlockBorder; // TODO(#46) this won't be needed
117
130
final Color colorMessageMediaContainerBackground;
131
+ final Color colorPollNames;
132
+ final Color colorPollVoteCountBackground;
133
+ final Color colorPollVoteCountBorder;
134
+ final Color colorPollVoteCountText;
118
135
final Color colorThematicBreak;
119
136
120
137
/// The complete [TextStyle] we use for plain, unstyled paragraphs.
@@ -166,6 +183,10 @@ class ContentTheme extends ThemeExtension<ContentTheme> {
166
183
Color ? colorGlobalTimeBorder,
167
184
Color ? colorMathBlockBorder,
168
185
Color ? colorMessageMediaContainerBackground,
186
+ Color ? colorPollNames,
187
+ Color ? colorPollVoteCountBackground,
188
+ Color ? colorPollVoteCountBorder,
189
+ Color ? colorPollVoteCountText,
169
190
Color ? colorThematicBreak,
170
191
TextStyle ? textStylePlainParagraph,
171
192
CodeBlockTextStyles ? codeBlockTextStyles,
@@ -181,6 +202,10 @@ class ContentTheme extends ThemeExtension<ContentTheme> {
181
202
colorGlobalTimeBorder: colorGlobalTimeBorder ?? this .colorGlobalTimeBorder,
182
203
colorMathBlockBorder: colorMathBlockBorder ?? this .colorMathBlockBorder,
183
204
colorMessageMediaContainerBackground: colorMessageMediaContainerBackground ?? this .colorMessageMediaContainerBackground,
205
+ colorPollNames: colorPollNames ?? this .colorPollNames,
206
+ colorPollVoteCountBackground: colorPollVoteCountBackground ?? this .colorPollVoteCountBackground,
207
+ colorPollVoteCountBorder: colorPollVoteCountBorder ?? this .colorPollVoteCountBorder,
208
+ colorPollVoteCountText: colorPollVoteCountText ?? this .colorPollVoteCountText,
184
209
colorThematicBreak: colorThematicBreak ?? this .colorThematicBreak,
185
210
textStylePlainParagraph: textStylePlainParagraph ?? this .textStylePlainParagraph,
186
211
codeBlockTextStyles: codeBlockTextStyles ?? this .codeBlockTextStyles,
@@ -203,6 +228,10 @@ class ContentTheme extends ThemeExtension<ContentTheme> {
203
228
colorGlobalTimeBorder: Color .lerp (colorGlobalTimeBorder, other.colorGlobalTimeBorder, t)! ,
204
229
colorMathBlockBorder: Color .lerp (colorMathBlockBorder, other.colorMathBlockBorder, t)! ,
205
230
colorMessageMediaContainerBackground: Color .lerp (colorMessageMediaContainerBackground, other.colorMessageMediaContainerBackground, t)! ,
231
+ colorPollNames: Color .lerp (colorPollNames, other.colorPollNames, t)! ,
232
+ colorPollVoteCountBackground: Color .lerp (colorPollVoteCountBackground, other.colorPollVoteCountBackground, t)! ,
233
+ colorPollVoteCountBorder: Color .lerp (colorPollVoteCountBorder, other.colorPollVoteCountBorder, t)! ,
234
+ colorPollVoteCountText: Color .lerp (colorPollVoteCountText, other.colorPollVoteCountText, t)! ,
206
235
colorThematicBreak: Color .lerp (colorThematicBreak, other.colorThematicBreak, t)! ,
207
236
textStylePlainParagraph: TextStyle .lerp (textStylePlainParagraph, other.textStylePlainParagraph, t)! ,
208
237
codeBlockTextStyles: CodeBlockTextStyles .lerp (codeBlockTextStyles, other.codeBlockTextStyles, t),
@@ -235,7 +264,7 @@ class MessageContent extends StatelessWidget {
235
264
style: ContentTheme .of (context).textStylePlainParagraph,
236
265
child: switch (content) {
237
266
ZulipContent () => BlockContentList (nodes: content.nodes),
238
- PollContent () => throw UnimplementedError ( ),
267
+ PollContent () => PollWidget (poll : content.poll ),
239
268
}));
240
269
}
241
270
}
0 commit comments