// SPDX-License-Identifier: GPL-3.0-or-later import { InterFont } from "@kit-fonts/inter.slint"; import { KitCodeIndicator, KitKeypad, KitTheme, KitThemeContext, KitMetrics, TypographyRole } from "@kit"; export component App inherits Window { default-font-family: InterFont.family; default-font-size: KitMetrics.font-size(root.theme, TypographyRole.body); title: "Code Indicator"; preferred-width: 440px; preferred-height: 560px; max-width: 100000px; max-height: 100000px; in-out property theme: KitThemeContext.current; background: root.theme.canvas; // Rust counts the digits; the marks follow that count, never the digits. in property entered; in property code-length; callback digit(); callback delete-requested(); VerticalLayout { padding: 24px; spacing: 16px; alignment: start; Text { text: "Verification progress"; color: root.theme.text-primary; font-size: 22px * root.theme.text-scale; font-weight: 600; } indicator := KitCodeIndicator { theme: root.theme; length: root.code-length; filled: root.entered; label: root.entered + " of " + root.code-length + " digits entered"; } HorizontalLayout { alignment: center; KitKeypad { theme: root.theme; label: "Verification code"; confirm-label: "Verify"; can-confirm: false; digit(value) => { root.digit(); } delete-requested => { root.delete-requested(); } } } } }