Show blinking caret in authentication fields
This commit is contained in:
@@ -316,6 +316,8 @@ func _add_field(parent: VBoxContainer, label_text: String, placeholder: String,
|
||||
var input := LineEdit.new()
|
||||
input.placeholder_text = placeholder
|
||||
input.secret = secret
|
||||
input.caret_blink = true
|
||||
input.caret_blink_interval = 0.5
|
||||
input.custom_minimum_size = Vector2(0, 68)
|
||||
input.add_theme_font_size_override("font_size", 17)
|
||||
input.add_theme_font_override("font", Brand.font)
|
||||
@@ -467,6 +469,7 @@ func _apply_theme() -> void:
|
||||
for input in fields:
|
||||
input.add_theme_color_override("font_color", Brand.text_color(dark))
|
||||
input.add_theme_color_override("font_placeholder_color", Brand.muted_color(dark))
|
||||
input.add_theme_color_override("caret_color", Brand.SKY_BLUE if dark else Brand.ROYAL_BLUE)
|
||||
input.add_theme_stylebox_override("normal", Brand.field_box(dark))
|
||||
input.add_theme_stylebox_override("focus", Brand.field_box(dark, true))
|
||||
for button in find_children("*", "Button", true, false):
|
||||
|
||||
@@ -44,6 +44,12 @@ func _initialize() -> void:
|
||||
_assert(show_icon != null and password_reveal.icon != null and show_icon != password_reveal.icon, "password visibility should switch bundled eye icons")
|
||||
password_reveal.free()
|
||||
password.free()
|
||||
|
||||
var field_parent := VBoxContainer.new()
|
||||
login.add_child(field_parent)
|
||||
var auth_field: LineEdit = login._add_field(field_parent, "Email", "[email protected]")
|
||||
_assert(auth_field.caret_blink, "authentication fields should display a blinking caret")
|
||||
_assert(is_equal_approx(auth_field.caret_blink_interval, 0.5), "authentication field caret should blink at a visible interval")
|
||||
login.free()
|
||||
theme_toggle.free()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user