ui.widgets

UI Widgets - Type-safe widget definitions for dynamic screens.

These dataclasses serialize to JSON and are rendered by Flutter.

Classes

Widget

Base class for all widgets.

Text

Text display widget.

Icon

Material icon widget.

Spacer

Vertical spacing widget.

Divider

Horizontal divider line.

StatusBadge

Colored pill/badge with text (e.g., "LIGHT ON").

StatusIcon

Animated circle with icon inside.

HintBox

Highlighted hint box (e.g., "Press button when ready").

DistanceBadge

Distance value display badge.

ResultsTable

Key-value results table.

Button

Clickable button.

Slider

Slider input for numeric values.

Checkbox

Checkbox toggle.

Dropdown

Dropdown selection.

NumericKeypad

Touch-friendly numeric keypad (0-9, ., backspace).

NumericInput

Large numeric display with optional +/- buttons.

TextInput

Text input field.

SensorValue

Large sensor value display.

SensorGraph

Real-time sensor line graph.

LightBulb

Animated light bulb visualization.

AnimatedRobot

Robot with spinning wheels visualization.

CircularSlider

Circular slider for motor/servo control.

ProgressSpinner

Circular loading spinner.

PulsingArrow

Animated pulsing arrow.

RobotDrivingAnimation

Robot driving on track animation.

MeasuringTape

Animated measuring tape.

CalibrationChart

Static scatter/line chart for calibration data.

Row

Horizontal layout - children side by side.

Column

Vertical layout - children stacked.

Center

Center children vertically and horizontally.

Container

Container with optional background color, fills available space.

Card

Card container with optional title.

Split

Left-right split layout.

Expanded

Expand child to fill available space.

Module Contents

class ui.widgets.Widget

Bases: abc.ABC

Base class for all widgets.

to_dict() dict

Convert to JSON-serializable dict.

class ui.widgets.Text

Bases: Widget

Text display widget.

text: str
size: str = 'medium'
color: str | None = None
bold: bool = False
muted: bool = False
align: str = 'left'
class ui.widgets.Icon

Bases: Widget

Material icon widget.

name: str
size: int = 24
color: str | None = None
class ui.widgets.Spacer

Bases: Widget

Vertical spacing widget.

height: int = 16
class ui.widgets.Divider

Bases: Widget

Horizontal divider line.

thickness: int = 1
color: str | None = None
class ui.widgets.StatusBadge

Bases: Widget

Colored pill/badge with text (e.g., “LIGHT ON”).

text: str
color: str = 'grey'
glow: bool = False
class ui.widgets.StatusIcon

Bases: Widget

Animated circle with icon inside.

icon: str
color: str = 'green'
animated: bool = True
class ui.widgets.HintBox

Bases: Widget

Highlighted hint box (e.g., “Press button when ready”).

text: str
icon: str = 'touch_app'
style: str = 'normal'
class ui.widgets.DistanceBadge

Bases: Widget

Distance value display badge.

value: float
unit: str = 'cm'
color: str = 'blue'
class ui.widgets.ResultsTable

Bases: Widget

Key-value results table.

rows: List[tuple] = []
class ui.widgets.Button

Bases: Widget

Clickable button.

id: str
label: str
style: str = 'primary'
icon: str | None = None
disabled: bool = False
class ui.widgets.Slider

Bases: Widget

Slider input for numeric values.

id: str
min: float
max: float
value: float = 0
label: str | None = None
show_value: bool = True
class ui.widgets.Checkbox

Bases: Widget

Checkbox toggle.

id: str
label: str
value: bool = False
class ui.widgets.Dropdown

Bases: Widget

Dropdown selection.

id: str
options: List[str] = []
value: str | None = None
label: str | None = None
class ui.widgets.NumericKeypad

Bases: Widget

Touch-friendly numeric keypad (0-9, ., backspace).

class ui.widgets.NumericInput

Bases: Widget

Large numeric display with optional +/- buttons.

id: str
value: float = 0
unit: str = ''
min_value: float | None = None
max_value: float | None = None
show_adjust_buttons: bool = True
class ui.widgets.TextInput

Bases: Widget

Text input field.

id: str
value: str = ''
label: str | None = None
placeholder: str = ''
class ui.widgets.SensorValue

Bases: Widget

Large sensor value display.

port: int
sensor_type: str = 'analog'
class ui.widgets.SensorGraph

Bases: Widget

Real-time sensor line graph.

port: int
sensor_type: str = 'analog'
max_points: int = 50
class ui.widgets.LightBulb

Bases: Widget

Animated light bulb visualization.

is_on: bool = False
class ui.widgets.AnimatedRobot

Bases: Widget

Robot with spinning wheels visualization.

moving: bool = False
size: int = 120
class ui.widgets.CircularSlider

Bases: Widget

Circular slider for motor/servo control.

id: str
min: float
max: float
value: float = 0
label: str | None = None
class ui.widgets.ProgressSpinner

Bases: Widget

Circular loading spinner.

size: int = 24
color: str | None = None
class ui.widgets.PulsingArrow

Bases: Widget

Animated pulsing arrow.

direction: str = 'right'
class ui.widgets.RobotDrivingAnimation

Bases: Widget

Robot driving on track animation.

target_distance: float = 30.0
class ui.widgets.MeasuringTape

Bases: Widget

Animated measuring tape.

distance: float = 30.0
class ui.widgets.CalibrationChart

Bases: Widget

Static scatter/line chart for calibration data.

Shows collected sample points with horizontal threshold lines.

samples: List[float] = []
thresholds: List[tuple] = []
height: int = 200
class ui.widgets.Row

Bases: Widget

Horizontal layout - children side by side.

children: List[Widget] = []
align: str = 'center'
spacing: int = 8
class ui.widgets.Column

Bases: Widget

Vertical layout - children stacked.

children: List[Widget] = []
align: str = 'stretch'
spacing: int = 12
class ui.widgets.Center

Bases: Widget

Center children vertically and horizontally.

children: List[Widget] = []
class ui.widgets.Container

Bases: Widget

Container with optional background color, fills available space.

children: List[Widget] = []
bg_color: str | None = None
padding: int = 0
class ui.widgets.Card

Bases: Widget

Card container with optional title.

children: List[Widget] = []
title: str | None = None
padding: int = 16
class ui.widgets.Split

Bases: Widget

Left-right split layout.

left: List[Widget] = []
right: List[Widget] = []
ratio: tuple = (1, 1)
class ui.widgets.Expanded

Bases: Widget

Expand child to fill available space.

child: Widget = None
flex: int = 1