tui-widgets icon indicating copy to clipboard operation
tui-widgets copied to clipboard

Render big-text inside popup

Open jfrader opened this issue 1 year ago • 4 comments

Is it possible to render inside the popup SizedWrapper of your other library?

BTW I love your stuff!!

jfrader avatar Jul 06 '24 23:07 jfrader

In theory you should be able to, but in practice I think this fits in a weird area whether the WidgetRef stuff causes some pain. BigText doesn't implement widget ref, and the popup only deals in that right now. Let me play with it a bit and get back to you.

joshka avatar Jul 07 '24 05:07 joshka

Thank you! I wonder if putting it inside a block is also possible, I tried but didn't find a soluton

jfrader avatar Jul 08 '24 18:07 jfrader

Actually I just did :sweat_smile:

        let second_pane_layout = Layout::default()
            .direction(Direction::Horizontal)
            .constraints(vec![Constraint::Percentage(50), Constraint::Percentage(50)])
            .split(main_layout[1]);

        let big_text = BigText::builder()
            .lines(vec![ ... ])
            .build()
            .unwrap();

        let price_block = Block::bordered();

        let price_block_area = price_block.inner(second_pane_layout[1]);
        
        frame.render_widget(price_block, second_pane_layout[1]);
        frame.render_widget(big_text, price_block_area);

jfrader avatar Jul 08 '24 18:07 jfrader

@jfrader I'm consolidating several repos (popup, prompt, scrollview, etc.) into this one to make it simpler to maintain and do things like this that involve cross crate changes.

joshka avatar Jul 24 '24 02:07 joshka