Skip to content

Show marked/edited markers, without swipe gesture #762

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 17, 2024

Conversation

PIG208
Copy link
Member

@PIG208 PIG208 commented Jun 24, 2024

This is still a WIP.

The swipe gesture is implemented such that the marker is

  • expanded when there is horizontal movement to the right
  • stretched following the touch movement
  • retracted when the touch is released

Notably, the content box still re-wraps as the marker pushes it to the right when it expands.To fix this, the content box might need to have a fixed size so the text can go off-screen and remain unchanged. This turned out to be tricky to accomplish.

This is stacked on top of #750. It fixes #616 and fixes part of #171.

Screen_Recording_20240624_164417.mp4

@PIG208 PIG208 force-pushed the marker-ui branch 2 times, most recently from afd4add to 92e10e5 Compare June 24, 2024 20:53
@gnprice
Copy link
Member

gnprice commented Jun 24, 2024

Thanks! Looking forward to having this.

@terpimost @alya for feedback on how the swipe gesture behaves from a user perspective.

Notably, the content box still re-wraps as the marker pushes it to the right when it expands.To fix this, the content box might need to have a fixed size so the text can go off-screen and remain unchanged. This turned out to be tricky to accomplish.

For this I think the key is, instead of a Row, to use something like a SlideTransition (which is what Dismissible uses). If the coordinate system that one uses feels inconvenient, then PositionedTransition might be cleaner. (And we can discuss in more detail in a chat thread.)

@PIG208 PIG208 linked an issue Jun 24, 2024 that may be closed by this pull request
@alya
Copy link
Collaborator

alya commented Jun 24, 2024

Pushing the context so that part of it gets hidden, rather than rewrapping, makes sense to me.

@PIG208 PIG208 linked an issue Jun 26, 2024 that may be closed by this pull request
@PIG208 PIG208 linked an issue Jun 26, 2024 that may be closed by this pull request
@PIG208
Copy link
Member Author

PIG208 commented Jun 26, 2024

The text re-wrapping issue has been fixed. I have also added a responsive fix to the star alignment issue. It's a draft because I still need to add tests for it.

@gnprice
Copy link
Member

gnprice commented Jun 26, 2024

Great.

I was using the app this afternoon and happened to have a build from this PR on my phone, and found I really appreciated having the new information about which messages had been edited.

That caused me to think of an idea for how we can split this into a part that delivers the key functionality and that we can merge soon, and a more complex part that can come after it as a follow-up:

  • For a first version, we could show just the icons, without the swipe-to-reveal feature.

    That cuts out the gesture handling, the animation, and all the tricky bits about coordinating how the marker's layout and colors change in synchrony with the motion.

    The part that remains will be exactly how we intend the final feature to look in steady state, whenever the user isn't actively pulling on one of these messages to reveal the marker. So it'll also be a good way for us to focus on polishing that design to exactly how we want it, before introducing the complexity of the swipe animation.

    From a user perspective, the one thing that's missing in this version is that it may not be super discoverable what the icons mean. But once you figure it out (perhaps by seeing them on a thread where you have other clues), you know; there's only two of them to learn.

  • Then a subsequent PR introduces swipe-to-reveal and the colored markers.

I see the UI logic in this revision looks a lot cleaner, so that follow-up might happen soon after. Even then, though, I think the split will be helpful for reducing the per-PR complexity for review. So let's try making that split.

@PIG208 PIG208 force-pushed the marker-ui branch 2 times, most recently from cf311bd to 44c75d2 Compare June 26, 2024 17:02
@PIG208 PIG208 marked this pull request as ready for review June 26, 2024 17:03
@PIG208
Copy link
Member Author

PIG208 commented Jun 26, 2024

I extracted a diff that implements the animation to #765. This PR should be ready for review after I have added the tests.

@PIG208 PIG208 force-pushed the marker-ui branch 3 times, most recently from dbadc55 to 1681a97 Compare June 28, 2024 22:27
@PIG208
Copy link
Member Author

PIG208 commented Jun 28, 2024

Rebased and added some test cases for the UI change. The tests are kind of similar to those for the star, because the edit marker are star both appear under the same Stack widget.

Because of how editState is computed from json, and that toJson does not preserve it, we can't initialize the message with the edit marker present. We could implement it if needed.

@gnprice gnprice changed the title ui: Support swipe gesture for marked/edited markers Show marked/edited markers, without swipe gesture Jul 3, 2024
@gnprice gnprice requested a review from chrisbobbe July 3, 2024 04:28
@gnprice gnprice added the maintainer review PR ready for review by Zulip maintainers label Jul 3, 2024
@chrisbobbe
Copy link
Collaborator

GitHub is telling me that some conflicts have appeared; would you resolve those please?

@PIG208
Copy link
Member Author

PIG208 commented Jul 3, 2024

Just rebased the PR.

@PIG208
Copy link
Member Author

PIG208 commented Jul 16, 2024

Latest screenshots (with the offset)
Moved Edited
Screenshot from 2024-07-16 14-31-57 Screenshot from 2024-07-16 14-31-42
Screenshot from 2024-07-16 14-32-20 Screenshot from 2024-07-16 14-32-25
Screenshot from 2024-07-16 14-34-04 Screenshot from 2024-07-16 14-34-41
Screenshot from 2024-07-16 14-35-32 Screenshot from 2024-07-16 14-35-11

chrisbobbe added a commit to chrisbobbe/zulip-flutter that referenced this pull request Jul 16, 2024
For how I retrieved the current list of variables, see
  zulip#762 (comment)
.
@PIG208 PIG208 force-pushed the marker-ui branch 2 times, most recently from 0d579c9 to 6a4db1f Compare July 16, 2024 23:39
@PIG208
Copy link
Member Author

PIG208 commented Jul 16, 2024

Latest screenshots (with the 16x16 icons and without those offsets):
Moved Edited
Screenshot from 2024-07-16 19-34-12 Screenshot from 2024-07-16 19-34-07
Screenshot from 2024-07-16 19-34-44 Screenshot from 2024-07-16 19-34-30
Screenshot from 2024-07-16 19-35-54 Screenshot from 2024-07-16 19-35-46

@PIG208
Copy link
Member Author

PIG208 commented Jul 16, 2024

With the new icons, not sure if the vertical offsets are needed anymore.
This should be ready for review.

@gnprice
Copy link
Member

gnprice commented Jul 17, 2024

Hmm, here's a screenshot of what I see:
image

So visually the bottom of the icon is higher than the baseline of the text, and the top of the icon is much higher than the ascender line of the text.

That's on my usual display settings, which have the font size set to small (as well as the "display size", which effectively just means my screen has more logical pixels). On default settings, I see:
image

So the same thing, but a little less so, because the icons aren't as much taller than the text as they are at my usual settings.

@gnprice
Copy link
Member

gnprice commented Jul 17, 2024

On our screen-sharing call today, when you were running the app locally on Linux, it looked like you were seeing the symptom of #735. That suggests that your system has the text scaling set to >1x, i.e. the fonts are scaled up. If I crank the text size on my phone a couple of notches above default, I reproduce a layout more like your screenshots above.

When making screenshots for a piece of layout that involves text, it'd be good to do so with a 1x text scale. It can be helpful to try smaller or larger scaling too, but 1x should be the baseline.

I'm not sure what platform setting might be governing the text scaling Flutter picks up from the platform on Linux. If you can't readily find that setting, you can always add a hack locally in lib/app.dart that forces the scaling to 1x — for example a MediaQuery around the ZulipApp.

@gnprice
Copy link
Member

gnprice commented Jul 17, 2024

For the vertical alignment for these icons, there are probably fancy things we can do to get it just right for a range of situations — but let's skip that for the present, while we move on to other issues from our tracker.

For now, let's just try to get it so that at 1x text scaling, when the message starts with a plain paragraph, the top of the edit icon doesn't stick out above the ascender line of the text, or anyway not by much more than the bottom of the icon sticks out below the baseline of the text. If we do that by a fixed few px of vertical adjustment, that'll be fine.

@gnprice
Copy link
Member

gnprice commented Jul 17, 2024

Other than that layout issue, the code here all looks good modulo this small comment above: #762 (comment)

Thanks for the revision!

PIG208 added 3 commits July 16, 2024 20:13
By aligning the row using `textBaseline`, we no longer need to apply
the padding to the star.

Fixes zulip#616.

Signed-off-by: Zixuan James Li <[email protected]>
@PIG208
Copy link
Member Author

PIG208 commented Jul 17, 2024

Updated the PR to add the vertical adjustments and replace the outdated icon font. Thanks for noticing that scaling issue!

With the offset, default text scaling (fd38fb8)
Moved Edited
Screenshot from 2024-07-16 20-23-35 Screenshot from 2024-07-16 20-23-27
Screenshot from 2024-07-16 20-23-42 Screenshot from 2024-07-16 20-23-47
Screenshot from 2024-07-16 20-24-05 Screenshot from 2024-07-16 20-24-00

This adds basic support to displaying a edited/moved marker next to the
message content. As of now this is implemented without the swipe gesture
control that would expand the marker.

Partially addresses zulip#171.

Signed-off-by: Zixuan James Li <[email protected]>
@gnprice
Copy link
Member

gnprice commented Jul 17, 2024

Great, thanks! Looks good — merging.

I added a comment about those vertical offsets:

+        // These offsets are chosen ad hoc, but give a good vertical alignment
+        // of the icons with the first line of the message, when the message
+        // begins with a paragraph, at default text scaling.  See:
+        //   https://github.com/zulip/zulip-flutter/pull/762#issuecomment-2232041922
         offset = const Offset(0, 2);

Also edited the PR description so that #171 doesn't get accidentally closed.

@gnprice gnprice merged commit 42d53c1 into zulip:main Jul 17, 2024
1 check passed
@PIG208 PIG208 deleted the marker-ui branch July 18, 2024 18:04
PIG208 added a commit to PIG208/zulip-flutter that referenced this pull request Aug 2, 2024
This consists of handpicked output from running the dart lint fix
for code `avoid_types_on_closure_parameters`. We probably don't need to
enable this linter rule because in many cases the type annotation
improves readability. For the `(WidgetTester tester)` case, though, it
is common and intuitive enough that the annotation shouldn't be
necessary.

See also:

  zulip#762 (comment)

Signed-off-by: Zixuan James Li <[email protected]>
PIG208 added a commit to PIG208/zulip-flutter that referenced this pull request Aug 2, 2024
This consists of handpicked output from running the dart lint fix
for code `avoid_types_on_closure_parameters`. We probably don't need to
enable this linter rule because in many cases the type annotation
improves readability. For the `(WidgetTester tester)` case, though, it
is common and intuitive enough that the annotation shouldn't be
necessary.

See also:

  zulip#762 (comment)

Signed-off-by: Zixuan James Li <[email protected]>
PIG208 added a commit to PIG208/zulip-flutter that referenced this pull request Aug 2, 2024
This consists of handpicked output from running the dart lint fix
for code `avoid_types_on_closure_parameters`. We probably don't need to
enable this linter rule because in many cases the type annotation
improves readability. For the `(WidgetTester tester)` case, though, it
is common and intuitive enough that the annotation shouldn't be
necessary.

See also:

  zulip#762 (comment)

Signed-off-by: Zixuan James Li <[email protected]>
PIG208 added a commit to PIG208/zulip-flutter that referenced this pull request Aug 6, 2024
This consists of handpicked output from running the dart lint fix
for code `avoid_types_on_closure_parameters`. We probably don't need to
enable this linter rule because in many cases the type annotation
improves readability. For the `(WidgetTester tester)` case, though, it
is common and intuitive enough that the annotation shouldn't be
necessary.

See also:

  zulip#762 (comment)

Signed-off-by: Zixuan James Li <[email protected]>
PIG208 added a commit to PIG208/zulip-flutter that referenced this pull request Aug 10, 2024
This consists of handpicked output from running the dart lint fix
for code `avoid_types_on_closure_parameters`. We probably don't need to
enable this linter rule because in many cases the type annotation
improves readability. For the `(WidgetTester tester)` case, though, it
is common and intuitive enough that the annotation shouldn't be
necessary.

See also:

  zulip#762 (comment)

Signed-off-by: Zixuan James Li <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration review Added by maintainers when PR may be ready for integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Star icon too high on messages
4 participants