|
1 | 1 | import 'dart:ui';
|
2 | 2 |
|
3 |
| -import 'package:flutter_color_models/flutter_color_models.dart'; |
4 | 3 | import 'package:flutter/material.dart';
|
5 | 4 |
|
| 5 | +import 'color.dart'; |
6 | 6 | import 'text.dart';
|
7 | 7 |
|
8 | 8 | /// A widget to display a given number of unreads in a conversation.
|
@@ -37,25 +37,10 @@ class UnreadCountBadge extends StatelessWidget {
|
37 | 37 | // Follows `.unread-count` in Vlad's replit:
|
38 | 38 | // <https://replit.com/@VladKorobov/zulip-sidebar#script.js>
|
39 | 39 | // <https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/design.3A.20.23F117.20.22Inbox.22.20screen/near/1624484>
|
40 |
| - |
41 |
| - // The design uses "LCH", not "LAB", but we haven't found a Dart libary |
42 |
| - // that can work with LCH: |
43 |
| - // <https://replit.com/@VladKorobov/zulip-sidebar#script.js> |
44 |
| - // <https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/design.3A.20.23F117.20.22Inbox.22.20screen/near/1677537> |
45 |
| - // We use LAB because some quick reading suggests that the "L" axis |
46 |
| - // is the same in both representations: |
47 |
| - // <https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/lch> |
48 |
| - // and because the design doesn't use the LCH representation except to |
49 |
| - // adjust an "L" value. |
50 | 40 | //
|
51 |
| - // TODO try LCH; see linked discussion |
52 | 41 | // TODO fix bug where our results differ from the replit's (see unit tests)
|
53 | 42 | // TODO profiling for expensive computation
|
54 |
| - final asLab = LabColor.fromColor(baseStreamColor!); |
55 |
| - return asLab |
56 |
| - .copyWith(lightness: asLab.lightness.clamp(30, 70)) |
57 |
| - .toColor() |
58 |
| - .withOpacity(0.3); |
| 43 | + return clampLchLightness(baseStreamColor!, 30, 70).withOpacity(0.3); |
59 | 44 | }
|
60 | 45 |
|
61 | 46 | @override
|
|
0 commit comments