Rename `text_align` to `text_alignment` in `Toggler`

This commit is contained in:
Héctor Ramón 2021-06-03 20:27:32 +07:00
parent 2a5aa69024
commit a32ce271bd
1 changed files with 6 additions and 8 deletions

View File

@ -31,7 +31,7 @@ pub struct Toggler<Message, Renderer: self::Renderer + text::Renderer> {
width: Length, width: Length,
size: u16, size: u16,
text_size: Option<u16>, text_size: Option<u16>,
text_align: Option<HorizontalAlignment>, text_alignment: HorizontalAlignment,
spacing: u16, spacing: u16,
font: Renderer::Font, font: Renderer::Font,
style: Renderer::Style, style: Renderer::Style,
@ -65,7 +65,7 @@ impl<Message, Renderer: self::Renderer + text::Renderer>
width: Length::Fill, width: Length::Fill,
size: <Renderer as self::Renderer>::DEFAULT_SIZE, size: <Renderer as self::Renderer>::DEFAULT_SIZE,
text_size: None, text_size: None,
text_align: None, text_alignment: HorizontalAlignment::Left,
spacing: 0, spacing: 0,
font: Renderer::Font::default(), font: Renderer::Font::default(),
style: Renderer::Style::default(), style: Renderer::Style::default(),
@ -99,8 +99,8 @@ impl<Message, Renderer: self::Renderer + text::Renderer>
/// Sets the horizontal alignment of the text of the [`Toggler`] /// Sets the horizontal alignment of the text of the [`Toggler`]
/// ///
/// [`Toggler`]: struct.Toggler.html /// [`Toggler`]: struct.Toggler.html
pub fn text_align(mut self, align: HorizontalAlignment) -> Self { pub fn text_alignment(mut self, alignment: HorizontalAlignment) -> Self {
self.text_align = Some(align); self.text_alignment = alignment;
self self
} }
@ -155,9 +155,7 @@ where
if let Some(label) = &self.label { if let Some(label) = &self.label {
row = row.push( row = row.push(
Text::new(label) Text::new(label)
.horizontal_alignment( .horizontal_alignment(self.text_alignment)
self.text_align.unwrap_or(HorizontalAlignment::Left),
)
.font(self.font) .font(self.font)
.width(self.width) .width(self.width)
.size(self.text_size.unwrap_or(renderer.default_size())), .size(self.text_size.unwrap_or(renderer.default_size())),
@ -221,7 +219,7 @@ where
self.text_size.unwrap_or(renderer.default_size()), self.text_size.unwrap_or(renderer.default_size()),
self.font, self.font,
None, None,
self.text_align.unwrap_or(HorizontalAlignment::Left), self.text_alignment,
VerticalAlignment::Center, VerticalAlignment::Center,
)) ))
} }