pub struct ChatMedia { /* private fields */ }Expand description
What a ChatMessage carries in its bubble, above its text: a photo,
a document or a recording. The file stays with the app, which asks to open it from
Self::on_open.
use ravenrs_reactive::State;
use ravenrs_widgets::{Chat, ChatMedia, ChatMessage, Ui};
let messages = State::new(vec![
ChatMessage::person("The *signed* contract")
.formatted()
.media(ChatMedia::document("contract.pdf").size(240_000).on_open(|| {})),
]);
let mut ui = Ui::new(Chat::new(messages.binding()), ravenrs_style::Theme::raven_dark());
ui.update();Implementations§
Source§impl ChatMedia
impl ChatMedia
Sourcepub fn photo(image: Option<ImageData>) -> Self
pub fn photo(image: Option<ImageData>) -> Self
A photo. While it is None it holds a space of the same size, so that what is above
does not jump when it arrives.
Sourcepub fn audio(player: impl Fn() -> AudioPlayerButton + 'static) -> Self
pub fn audio(player: impl Fn() -> AudioPlayerButton + 'static) -> Self
A recording. The player is built each time the message is shown, so that the clip or the transcript that arrives later is there.
Sourcepub fn side(self, side: f32) -> Self
pub fn side(self, side: f32) -> Self
The side of a photo, which is shown square (240 logical pixels by default).
Sourcepub fn icon(self, icon: IconName) -> Self
pub fn icon(self, icon: IconName) -> Self
The icon of a document (IconName::FileText by default).
Sourcepub fn on_open(self, handler: impl Fn() + 'static) -> Self
pub fn on_open(self, handler: impl Fn() + 'static) -> Self
Makes a photo or a document open with a click, Enter or Space: for instance in an
ImageLightbox, or through the system.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ChatMedia
impl !Send for ChatMedia
impl !Sync for ChatMedia
impl !UnwindSafe for ChatMedia
impl Freeze for ChatMedia
impl Unpin for ChatMedia
impl UnsafeUnpin for ChatMedia
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<V> ViewExt for Vwhere
V: View,
impl<V> ViewExt for Vwhere
V: View,
Source§fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
Adds padding inside the box, in logical pixels.
Source§fn background(self, fill: impl Into<Fill>) -> Styled<Self>
fn background(self, fill: impl Into<Fill>) -> Styled<Self>
Paints a background behind the content.
Source§fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
Fixes the width and/or height in logical pixels;
None keeps the content size.