mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 04:40:03 -04:00
Give TextEdit a min_size and a gap, via a shared LayoutStyle
`ButtonStyle` carried a `min_size` and a gap; `TextEditStyle` carried neither, so a themed text edit could set its padding but not its height or the gap to its prefix — the height had to travel separately on the widget, and the gap fell back to the ambient `spacing.icon_spacing`. A theme decides the two together, so they move into a `LayoutStyle` that both styles embed. `TextEdit` now honors both, with defaults that keep today's rendering: no floor of egui's own, and the gap `AtomLayout` was already falling back to. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
use eframe::egui::{
|
||||
self, CentralPanel, Color32, Frame, Panel,
|
||||
theme::StyleProvider,
|
||||
widget_style::{BaseStyle, ButtonStyle, HasClasses as _, StyleArgs, WidgetState},
|
||||
widget_style::{BaseStyle, ButtonStyle, HasClasses as _, LayoutStyle, StyleArgs, WidgetState},
|
||||
};
|
||||
|
||||
/// Buttons with this class are styled as a destructive action.
|
||||
@@ -67,9 +67,11 @@ impl StyleProvider<ButtonStyle> for MyTheme {
|
||||
.fill(fill)
|
||||
.corner_radius(self.corner_radius)
|
||||
.inner_margin(8),
|
||||
layout: LayoutStyle {
|
||||
min_size: args.style.spacing.interact_size,
|
||||
gap: args.style.spacing.icon_spacing,
|
||||
},
|
||||
text_style: base.text,
|
||||
min_size: args.style.spacing.interact_size,
|
||||
gap: args.style.spacing.icon_spacing,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user