1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-26 00:08:10 +00:00

chore(core/rust): make info button wider

[no changelog]
This commit is contained in:
grdddj 2023-06-20 13:45:39 +02:00 committed by Jiří Musil
parent 9cd59105c1
commit 570ffe2c0d
3 changed files with 15 additions and 6 deletions

View File

@ -93,7 +93,7 @@ impl<'a> Confirm<'a> {
if showing_info_screen {
ButtonLayout::arrow_none_none()
} else if has_info_screen {
ButtonLayout::cancel_armed_text(button_text, "i")
ButtonLayout::cancel_armed_info(button_text)
} else {
ButtonLayout::cancel_none_text(button_text)
}

View File

@ -154,7 +154,8 @@ where
0
};
let offset_x = if style.with_outline {
// Moving text to the right.
let mut offset_x = if style.with_outline {
theme::BUTTON_OUTLINE
} else if style.with_arms {
theme::ARMS_MARGIN
@ -162,6 +163,14 @@ where
0
};
// Centering the text in case of fixed width.
if let ButtonContent::Text(text) = &self.content {
if let Some(fixed_width) = style.fixed_width {
let diff = fixed_width - style.font.visible_text_width(text.as_ref());
offset_x = diff / 2;
}
}
self.get_current_area().bottom_left() + Offset::new(offset_x, -offset_y)
}
}
@ -522,12 +531,12 @@ where
)
}
/// Left cancel, armed text and right text.
pub fn cancel_armed_text(middle: T, right: T) -> Self {
/// Left cancel, armed text and right info icon/text.
pub fn cancel_armed_info(middle: T) -> Self {
Self::new(
Some(ButtonDetails::cancel_icon()),
Some(ButtonDetails::armed_text(middle)),
Some(ButtonDetails::text(right)),
Some(ButtonDetails::text("i".into()).with_fixed_width(theme::BUTTON_ICON_WIDTH)),
)
}

View File

@ -28,7 +28,7 @@ where
U: StringType + Clone,
{
pub fn new(content: T) -> Self {
let btn_layout = ButtonLayout::cancel_armed_text("CONFIRM".into(), "i".into());
let btn_layout = ButtonLayout::cancel_armed_info("CONFIRM".into());
Self {
content: Child::new(content),
buttons: Child::new(ButtonController::new(btn_layout)),