Skip to content

Commit 8c2ae12

Browse files
committed
star: Align the icon with message content.
By wrapping the icon with a dummy Text widget in a Row, the Text helps us stretch the row to the same height as a line of a message content would have. This allows us to position the icon with respect to text, even if a scaling factor has been applied. Fixes zulip#616. Signed-off-by: Zixuan James Li <[email protected]>
1 parent b8a93b4 commit 8c2ae12

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/widgets/edit_state_marker.dart

+6-6
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ class _SwipableMessageRowState extends State<SwipableMessageRow> with TickerProv
6060
Widget build(BuildContext context) {
6161
final theme = Theme.of(context).extension<DesignVariables>()!;
6262

63-
// TODO(#157): fix how star marker aligns with message content
64-
// Design from Figma at:
65-
// https://www.figma.com/file/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=813%3A28817&mode=dev .
66-
var star = Padding(padding: const EdgeInsets.only(top: 5.5),
67-
child: Icon(ZulipIcons.star_filled, size: 16, color: theme.starColor));
63+
var star = Padding(
64+
padding: const EdgeInsets.only(top: 5.5),
65+
child: Row(children: [
66+
const Text("", style: TextStyle(fontSize: 15)),
67+
Icon(ZulipIcons.star_filled, size: 16, color: theme.starColor)]));
6868
final hasMarker = widget.message.editState != MessageEditState.none;
6969

7070
final content = Stack(
@@ -185,7 +185,7 @@ class EditStateMarker extends StatelessWidget {
185185
return ConstrainedBox(
186186
constraints: BoxConstraints(maxWidth: _width),
187187
child: Container(
188-
margin: EdgeInsets.only(top: 4, left: lerpDouble(0, 10, _animationProgress)!),
188+
margin: EdgeInsets.only(top: 5.5, left: lerpDouble(0, 10, _animationProgress)!),
189189
clipBehavior: Clip.hardEdge,
190190
decoration: BoxDecoration(
191191
borderRadius: BorderRadius.circular(2),

0 commit comments

Comments
 (0)