Skip to content
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

Truncate playable widget #513

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Truncate playable widget #513

wants to merge 2 commits into from

Conversation

jacksongoode
Copy link
Collaborator

I'm hoping to solve that issue where long titles and album details are not clipped.

    let mut title_row = Flex::row()
        .with_flex_child(
            Label::raw()
                .with_font(theme::UI_FONT_MEDIUM)
                .with_line_break_mode(LineBreaking::Clip)
                .lens(PlayRow::item.then(Track::name.in_arc()))
                .expand_width(),
            1.0,
        )
        .with_default_spacer()
        // .with_child(playable::is_playing_marker_widget().lens(PlayRow::is_playing))
        .with_default_spacer()
        .must_fill_main_axis(true);

If you uncomment
// .with_child(playable::is_playing_marker_widget().lens(PlayRow::is_playing))

You'll see that the whole thing will break. I'm honestly not sure how we get it to where the text of the song title expands and the is_playing_marker_widget fills in the remaining space. No combination I tried of flex/flex or flex/non-flex children work.

Help!

@jacksongoode
Copy link
Collaborator Author

@SO9010 If you're bored and want to look at something new, I've been trying to figure our how to get rid of the longstanding bug where long titles and album details don't get clipped. This is as far as I got but I feel like it's really close.

@SO9010
Copy link
Contributor

SO9010 commented Aug 10, 2024

I worked it out, the original child (the title child) needed to not be in a flex child as that will then share out the space evenly. I submitted a merge request to this branch.

@SO9010
Copy link
Contributor

SO9010 commented Aug 10, 2024

Wait, false alarm! this then makes it so it cant clip, how weird!

@jacksongoode
Copy link
Collaborator Author

Darn! Well feel free to submit commits to this branch if you figure something out!

@SO9010
Copy link
Contributor

SO9010 commented Aug 14, 2024

I have had a longer look, and it seems like something with the re-implemented logic has caused the issue where it plays that item when you click save on an item. :O

@jacksongoode
Copy link
Collaborator Author

Right I think it has, that can be resolved, I know what the issue is there to fix the save play, but the truncation was what I was trying to tackle now.

@SO9010
Copy link
Contributor

SO9010 commented Aug 17, 2024

Okay, so I have been reading the documentation. The problem comes from the fact that a non-flex widget has an infinite size. We need either the text or the dots to be a flex widget. Otherwise, they share the space equally, and the dots will never disappear.

It clips well when just the text is in a flex row, with no expanding and no dots. Perhaps there is a way to interrupt the drawing of the text and then append the dots to it? Or maybe we could create a controller that changes a sizedbox depending on screen size, but this causes issues when the time changes.

@jacksongoode
Copy link
Collaborator Author

Right, I thought about painting the dots and appending them to the title, which would somewhat solve the issue, because then the title and the dots would truncate as a single item. It's a possibility, but I think it's a little tricky given that we might have to render the text as a painted object. I don't really want to make the text painted.

I think the other option would be to somehow wrap the text and dots in their own flex object. It's just that it's very confusing to me how non-flex and flex objects are able to be truncated. It seems like they would need the expand_width method? It's all very confusing to me...

@SO9010
Copy link
Contributor

SO9010 commented Aug 19, 2024

I had a go at wrapping both the text and the dots into a flex widget but all that happened was that the time stamp stayed in one place.

@jacksongoode
Copy link
Collaborator Author

Ugh I really want to figure this issue out. But the inclusion of that dotted marker_widget is really confusing since there's no way to maximize the title width and have the remaining width filled by the dots while also allowing the title to be truncatable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants