pub struct TextInputStyle {
pub bg: Color,
pub border: Color,
pub border_focused: Color,
pub caret: Color,
pub placeholder: Color,
pub selection_bg: Color,
pub radius: f32,
pub pad_x: f32,
pub pad_y: f32,
pub text: TextStyle,
pub caret_w: f32,
pub caret_blink_ms: i64,
}Expand description
Colors, typography, logical-pixel metrics, and caret cadence for text input.
caret_blink_ms is one visible or hidden half-period in milliseconds; a
non-positive value suppresses the caret. The legacy draw_text_input
cannot display placeholder because it has no placeholder argument, while
TextInput uses it when its bound value and IME preedit are empty.
§Examples
use ailloli_ui_core::Theme;
use ailloli_ui_widgets::controls::TextInputStyle;
let style = TextInputStyle::from_theme(Theme::dark());
assert_eq!(style.text.px_size, 14);
assert_eq!(style.caret_blink_ms, 500);Fields§
§bg: ColorInput background fill.
border: ColorUnfocused one-pixel border color.
border_focused: ColorFocused one-pixel border color.
caret: ColorCaret fill color.
placeholder: ColorPlaceholder glyph color used by the retained widget.
selection_bg: ColorSelection background color, hidden during IME preedit.
radius: f32Uniform corner radius in logical pixels.
pad_x: f32Horizontal content inset in logical pixels.
pad_y: f32Vertical content inset in logical pixels.
text: TextStyleEditable text font, integer logical-pixel size, color, and decoration.
caret_w: f32Caret width in logical pixels.
caret_blink_ms: i64Blink half-period in milliseconds; non-positive disables the caret.
Implementations§
Source§impl TextInputStyle
impl TextInputStyle
Sourcepub fn from_theme(theme: Theme) -> Self
pub fn from_theme(theme: Theme) -> Self
Resolves input colors, spacing, radius, and mono typography from theme.
§Examples
use ailloli_ui_core::{FontId, Theme};
use ailloli_ui_widgets::controls::TextInputStyle;
let style = TextInputStyle::from_theme(Theme::dark());
assert_eq!(style.text.font, FontId::Mono);
assert_eq!(style.caret_w, 1.0);Trait Implementations§
Source§impl Clone for TextInputStyle
impl Clone for TextInputStyle
Source§fn clone(&self) -> TextInputStyle
fn clone(&self) -> TextInputStyle
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TextInputStyle
impl Debug for TextInputStyle
Source§impl Default for TextInputStyle
impl Default for TextInputStyle
impl Copy for TextInputStyle
Auto Trait Implementations§
impl Freeze for TextInputStyle
impl RefUnwindSafe for TextInputStyle
impl Send for TextInputStyle
impl Sync for TextInputStyle
impl Unpin for TextInputStyle
impl UnwindSafe for TextInputStyle
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
§fn into_click_action(self) -> ClickAction<A>
fn into_click_action(self) -> ClickAction<A>
Implements the into_click_action helper used by this module.