mirror of
https://code.gri.mw/GUI/grim.git
synced 2026-07-12 09:48:55 +00:00
Build 40: roomier Pay keypad spacing (Cash App-style)
The amount keypad rows were bunched tight (56px keys, 4px gaps) high on the Pay screen, leaving a large empty area at the bottom. Now: taller (58) and wider (pad 332, 14px column gaps) keys, bigger digits (30), and adaptive row spacing that spreads the four rows toward the bottom when there's room (the Pay tab) while staying compact where there isn't (the send flow). Clamped so it never overflows or stretches absurdly.
This commit is contained in:
@@ -537,14 +537,25 @@ pub fn numpad(ui: &mut Ui, amount: &mut String) -> bool {
|
||||
["7", "8", "9"],
|
||||
[".", "0", "<"],
|
||||
];
|
||||
let key_h = 56.0;
|
||||
let gap = 10.0;
|
||||
let key_h = 58.0;
|
||||
let gap = 14.0;
|
||||
// Center a fixed-width pad so the three columns line up directly under
|
||||
// the centered amount above, on any width.
|
||||
let pad_w = ui.available_width().min(300.0);
|
||||
// the centered amount above, on any width. Wider than before to give the
|
||||
// columns more breathing room (Cash App-style).
|
||||
let pad_w = ui.available_width().min(332.0);
|
||||
let key_w = (pad_w - 2.0 * gap) / 3.0;
|
||||
let side = ((ui.available_width() - pad_w) / 2.0).max(0.0);
|
||||
for row in keys.iter() {
|
||||
// Spread the four rows toward the bottom when there's room (the Pay tab,
|
||||
// which otherwise leaves a big empty gap), staying compact on dense
|
||||
// screens (the send flow). Reserve space below for the action buttons and
|
||||
// the floating tab bar. Clamped so it never stretches absurdly or overflows.
|
||||
let reserve_below = 170.0;
|
||||
let avail = (ui.available_height() - reserve_below).max(0.0);
|
||||
let row_gap = ((avail - key_h * 4.0) / 3.0).clamp(6.0, 30.0);
|
||||
for (ri, row) in keys.iter().enumerate() {
|
||||
if ri > 0 {
|
||||
ui.add_space(row_gap);
|
||||
}
|
||||
ui.horizontal(|ui| {
|
||||
ui.add_space(side);
|
||||
for (i, &k) in row.iter().enumerate() {
|
||||
@@ -562,7 +573,7 @@ pub fn numpad(ui: &mut Ui, amount: &mut String) -> bool {
|
||||
rect.center(),
|
||||
egui::Align2::CENTER_CENTER,
|
||||
label,
|
||||
FontId::new(28.0, fonts::medium()),
|
||||
FontId::new(30.0, fonts::medium()),
|
||||
col,
|
||||
);
|
||||
if resp.clicked() {
|
||||
@@ -571,7 +582,6 @@ pub fn numpad(ui: &mut Ui, amount: &mut String) -> bool {
|
||||
}
|
||||
}
|
||||
});
|
||||
ui.add_space(4.0);
|
||||
}
|
||||
changed
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user