input_filter: self.field_filter do_backspace: self.do_backspace canvas.before: Clear # "round" mode. Color: rgba: self._fill_color if self.mode == "round" else (0, 0, 0, 0) Ellipse: angle_start: 180 angle_end: 360 pos: self.x - self.height / 2 + dp(18), self.y size: self.height, self.height Ellipse: angle_start: 360 angle_end: 540 pos: (self.width - dp(18)) + self.x - self.height / 2.0, self.y size: self.height, self.height Rectangle: pos: self.x + dp(9), self.y size: self.width - dp(18), self.height Color: rgba: ( \ (self.line_color_focus if not self.error else self.error_color) \ if self.focus \ else self.theme_cls.disabled_hint_text_color \ ) \ if self.mode == "round" else \ (0, 0, 0, 0) Line: points: self.x + dp(18), \ self.y, \ self.x + self.width - dp(18), \ self.y Line: points: self.x + dp(18), \ self.y + self.height, \ self.x + self.width - dp(18), \ self.y + self.height Line: ellipse: self.x - self.height / 2 + dp(18), \ self.y, \ self.height, \ self.height, \ 180, \ 360 Line: ellipse: self.width + self.x - self.height / 2.0 - dp(18), \ self.y, \ self.height, \ self.height, \ 360, \ 540 # "fill" mode. Color: rgba: self._fill_color if self.mode == "fill" else (0, 0, 0, 0) RoundedRectangle: pos: self.x, self.y size: self.width, self.height radius: self.radius # Static underline texture. Color: rgba: (self._line_color_normal \ if self.line_color_normal else self.theme_cls.divider_color) \ if self.mode == "line" else (0, 0, 0, 0) Line: points: self.x, self.y + dp(16), self.x + self.width, self.y + dp(16) width: 1 dash_length: dp(3) dash_offset: 2 if self.disabled else 0 # Active underline (on focus) texture. Color: rgba: self._line_color_focus \ if self.mode in ("line", "fill") and self.active_line \ else (0, 0, 0, 0) Rectangle: size: self._underline_width, dp(1) pos: self.center_x - (self._underline_width / 2), \ self.y + (dp(16) if self.mode != "fill" else 0) # Helper text texture. Color: rgba: self._helper_text_color Rectangle: texture: self._helper_text_label.texture size: self._helper_text_label.texture_size pos: self.x + (dp(16) if self.mode == "fill" else \ (0 if self.mode not in ("round", "rectangle") else dp(12))), \ self.y + (dp(-18) if self.mode in ("fill", "rectangle", "round") else dp(-2)) # Right/left icon texture. Color: rgba: self._icon_right_color if self.icon_right else self._icon_left_color Rectangle: texture: self._icon_right_label.texture if self.icon_right else self._icon_left_label.texture size: (0, 0) if (not self.icon_right and not self.icon_left) else \ (self._icon_right_label.texture_size if self.icon_right else self._icon_left_label.texture_size) pos: ( \ (self.width + self.x - (0 if self.mode != "round" else dp(4))) - \ (self._icon_right_label.texture_size[1]) - dp(8), \ self.center[1] - self._icon_right_label.texture_size[1] / 2 + ((dp(8) \ if self.mode != "round" else 0) if self.mode != "fill" else 0) \ if self.mode != "rectangle" else \ self.center[1] - self._icon_right_label.texture_size[1] / 2 - dp(4) \ ) \ if self.icon_right else \ ( \ self.x + ((dp((0 if self.mode != "round" else 12)) \ if self.mode != "rectangle" else dp(12)) \ if self.mode != "fill" else (dp(4) if not self.icon_left else dp(16))), \ self.center[1] - self._icon_left_label.texture_size[1] / 2 + (((dp(4) \ if self.mode != "round" else 0) if self.mode not in ("rectangle", "fill") \ else dp(8)) if self.mode != "fill" else 0) \ if self.mode != "rectangle" else \ self.center[1] - self._icon_left_label.texture_size[1] / 2 - dp(4) \ ) # Max length texture. Color: rgba: self._max_length_text_color Rectangle: texture: self._max_length_label.texture size: self._max_length_label.texture_size pos: self.x + self.width - self._max_length_label.texture_size[0] - dp(12), \ self.y - (dp(2) if self.mode == "line" else dp(18)) # Cursor blink. Color: rgba: (self.text_color_focus if self.focus else self._text_color_normal) \ if self.focus and not self._cursor_blink \ else (0, 0, 0, 0) Rectangle: pos: (int(x) for x in self.cursor_pos) size: 1, -self.line_height # Hint text texture. Color: rgba: self._hint_text_color Rectangle: texture: self._hint_text_label.texture size: self._hint_text_label.texture_size pos: ( \ self.x + ((dp(16) if not self.icon_left else dp(52)) \ if self.mode == "fill" else ( \ ((0 if self.mode != "round" else dp(12)) if self.mode != "rectangle" else dp(12)) \ if not self.icon_left else \ (dp(36 if self.mode != "round" else 42) if self.mode != "rectangle" else dp(42)))) \ if not self.focus and not self.text else \ self.x + ((dp(16) if self.mode != "round" else dp(36 if not self.icon_left else 42)) \ if self.mode in ("fill", "rectangle", "round") and \ self.icon_left else (0 if self.mode != "round" else dp(12))) + self._hint_x ), \ self.y + self.height + (((dp(4) if self.mode != "round" else dp(10)) \ if self.mode != "line" else \ dp(-6)) if self.mode != "rectangle" else dp(-4)) - self._hint_y # "rectangle" mode Color: rgba: (self.line_color_focus if not self.error else self.error_color) \ if self.focus else \ self.line_color_normal Line: width: dp(1) if self.mode == "rectangle" else dp(0.00001) points: ( self.x + self._line_blank_space_right_point, self.top - self._hint_text_label.texture_size[1] // 2, self.right, self.top - self._hint_text_label.texture_size[1] // 2, self.right, self.y, self.x, self.y, self.x, self.top - self._hint_text_label.texture_size[1] // 2, self.x + self._line_blank_space_left_point, self.top - self._hint_text_label.texture_size[1] // 2 ) # Text color. Color: rgba: self.disabled_foreground_color if self.disabled else \ ( \ self.text_color_focus if self.focus else self._text_color_normal ) \ if not self.error else self.error_color font_name: "Roboto" if not self.font_name else self.font_name foreground_color: self.theme_cls.text_color bold: False padding: ( \ ((0 if self.mode != "round" else "12dp") \ if self.mode != "rectangle" else "12dp") \ if not self.icon_left else \ (("36dp" if self.mode != "round" else "42dp") \ if self.mode != "rectangle" else "42dp") \ ) \ if self.mode != "fill" else \ ("16dp" if not self.icon_left else "52dp"), \ "24dp" if self.mode != "round" else "8dp", \ ((0 if self.mode != "round" and not self.icon_left else dp(12)) \ if self.mode != "rectangle" else "12dp") \ if self.mode != "fill" and not self.icon_right else \ ( \ "14dp" \ if not self.icon_right else \ self._icon_right_label.texture_size[1] + (dp(20) \ if self.mode != "round" else dp(24))), \ "8dp" if self.mode == "fill" else \ (("22dp" if self.mode != "round" else "8dp") \ if self.icon_left and self.mode != "rectangle" else \ ("16dp" if self.mode in ("fill", "rectangle") else \ "20dp" if self.mode != "round" else "8dp")) multiline: False size_hint_y: None height: self.minimum_height size_hint_x: None width: self.texture_size[0] shorten: True shorten_from: "right" on_focus: self.anim_rect((self.x, self.y, self.right, self.y, self.right, \ self.top, self.x, self.top, self.x, self.y), 1) if self.focus \ else self.anim_rect((self.x - dp(60), self.y - dp(60), \ self.right + dp(60), self.y - dp(60), self.right + dp(60), self.top + dp(60), \ self.x - dp(60), self.top + dp(60), \ self.x - dp(60), self.y - dp(60)), 0) canvas.after: Color: group: "color" rgba: self._primary_color Line: group: "rectangle" width: dp(1.5) points: ( self.x - dp(60), self.y - dp(60), self.right + dp(60), self.y - dp(60), self.right + dp(60), self.top + dp(60), self.x - dp(60), self.top + dp(60), self.x - dp(60), self.y - dp(60) )