una 0.1.1
una: ^0.1.1 copied to clipboard
A themeable Flutter design system: 100+ widgets, frosted-glass surfaces, desktop and phone metrics in one theme, Liquid Glass on iOS and macOS, and no Material dependency.
0.1.1 #
The component library is now at https://una.serverpod.dev/, branded Serverpod Una (https://unakit.dev/ sends its visitors there).
Added #
- Payment card fields:
UnaCardNumberField,UnaCardExpiryFieldandUnaCardCvcField, withUnaCardBrand,UnaCardExpiryand their form fields (UnaCardNumberFormField,UnaCardExpiryFormField,UnaCardCvcFormField). They take digits only, as many as the card has, grouped as they are typed. A number has sixteen digits at most unless the field'smaxLengthsays otherwise (19 for UnionPay's or Maestro's long numbers). - The software keyboard: a focused
UnaTextFieldbrings its whole field into view (the label, description and error of its form field with it, clear of the bars and afooter), not the caret alone; popovers, menus, select lists andshowUnaPopoverkeep above the keyboard and are no taller than what it leaves;KeyboardAvoider, for a screen with no scaffold, andUnaSidebarScaffold.resizeToAvoidBottomInset; on Android and iOS a drag on a scroll view lets the keyboard go (UnaScrollBehavior(keyboardDismissBehavior:)says otherwise); a debug build says so when a focused field is behind the keyboard (KeyboardAvoider.debugCheckCoveredFields). - The una-overview skill has a keyboard guide (
guides/keyboard.md), withexpectFieldsClearTheKeyboard, a widget test that gives the view a keyboard.
Fixed #
- Safari on an iPhone zoomed the page in, and left it zoomed, when a text
field that Flutter had focused by itself (an
autofocus, a field focused after a message was sent) was then tapped: Safari zooms for a text input under 16 pixels, and since Flutter 3.47 a Flutter page may zoom. AUnaTextFieldkeeps the engine's hidden input at 16 pixels there, so there is nothing to zoom for; a pinch still zooms. - A field's focus ring was cut off at both sides in a sheet or a dialog whose content scrolled, and over the first field and under the last: the scrolling content is clipped by the surface's edges now, not by its own box.
- A field focused in a sheet could end up behind the sheet's actions: the sheet eased after the keyboard and closed over the field once it had shown itself. A sheet follows the keyboard frame by frame, as a scaffold does.
- A dialog told its content of the keyboard it had already made room for, so a scaffold or a list inside made room again.
- A
UnaChatListunder aUnaScaffoldhid its newest message behind thefooterand its oldest behind the app bar. With nopaddingof its own it insets itself by theMediaQuerypadding, as aListViewdoes.
0.1.0 #
The first release of una, a Flutter design system forked from
shad 1.0.2, with its own default look,
Flutter's vocabulary, form factors, motion, Liquid Glass on Apple platforms
and many new components. It needs Flutter 3.50 or later (Dart 3.14).
The example app is the component library, at
https://una.serverpod.dev/; the source is at
https://github.com/serverpod/una.
Changed from shad #
Types that are gone or renamed are written as shad spelled them
(ShadRadioController). A member that is gone or renamed is written on
the class's new name (UnaPopoverController.show was
ShadPopoverController.show).
Names and vocabulary
- The
Shadprefix isUna:ShadButton→UnaButton,ShadTheme.of→UnaTheme.of,ShadThemeData→UnaThemeData,showShadDialog→showUnaDialog. Every component carries it, with everything named after one (its theme, controller, variants, form fields), and so do the theme types (UnaColorScheme,UnaTextTheme,UnaThemeMode). Utilities and tokens have no prefix:Gap,Pressable,Motion,StyleTokens,PhosphorIcon, the named colour schemes (SlateColorScheme). - Flutter names where they exist:
ShadInput→UnaTextField,ShadInputFormField→UnaTextFormField,ShadInputOTP→UnaOtpField,ShadSeparator→UnaDivider,ShadProgress→UnaProgressBar,ShadOption→UnaSelectOption,ShadContextMenuItem→UnaMenuItem. Their themes follow (UnaThemeData.textFieldTheme,dividerTheme,progressBarTheme, …). - Everything
@Deprecatedin shad 1.0 is removed, and there are no deprecation shims for the renames below. - Flutter's
WidgetState:ShadStateandShadStatesControllerare gone;UnaButton,UnaIconButtonandUnaToggletake aWidgetStatesController(which changes itsvalueset in place). ShadAppType.shadcn→UnaAppType.standard.- No
.rawconstructors:UnaButton,UnaIconButton,UnaBadge,UnaToggle,UnaDialog,UnaAlert,UnaTableCellandUnaMenuItemtakevariant:; the named constructors are shortcuts.UnaSelecttakesUnaSelectVariant.primary/search,UnaSelect.multiplemultiple/multipleWithSearch.UnaDivider()is horizontal. borderRadiusfor aBorderRadiusonUnaCard,UnaDialog,UnaDivider,UnaMenubar,UnaSelectOption,UnaSkeleton,UnaSheet, their themes andUnaBorder; named corners follow (UnaCommand.itemBorderRadius,UnaCalendarTheme.dayButtonBorderRadius, …).UnaThemeData.radiusstays.cursor→mouseCursor(UnaButton,UnaIconButton,UnaGestureDetector, their themes,UnaMenubarTheme.buttonMouseCursor,UnaTabsTheme.tabMouseCursor);onHoverChange→onHover.- Open state:
visible:→open:onUnaPopover,UnaContextMenuandUnaContextMenuRegion;onOpenChange→onOpenChanged;UnaSidebarScaffold.defaultOpen→initiallyOpen, itschild→body. Controllers haveisOpen,open(),close(),toggle(),setOpen():UnaPopoverController.show/hide→open/close;UnaSidebarController.openMobile→isMobileOpen(openMobile(),closeMobile(),toggleMobile(),setMobileOpen()), and itstoggle(isMobile:)→toggle(). onPressed→onTaponUnaCard,UnaTextField,UnaTextarea,UnaSelectand their form fields;onPressedAlwaysCalled/onPressedOutside→onTapAlwaysCalled/onTapOutside.- Icons are widgets:
UnaAccordionItem.iconData,UnaResizablePanelGroup.handleIconDataandUnaDialog.closeIconDataare gone;UnaAccordionTheme.icon,UnaResizableTheme.handleIconand the calendar's navigation icons are const widgets. - No
textDirectionparameters (UnaAlert,UnaBreadcrumb,UnaButton,UnaResizablePanelGroup,ShadRovingFocus, their themes,UnaSelectOption.direction): use aDirectionality. - Smaller renames:
UnaPopover(popover:)→builder:;UnaCommand.onItemSelected→onSelected;UnaProgressBar.semanticsLabel/semanticsValue→semanticLabel/semanticValue,backgroundColor/minHeight→trackColor/height;UnaSidebarMenuButton.isActive/UnaSidebarMenuSubButton.isActive→selected;UnaCalendar.hideNavigation/hideWeekdayNames→showNavigation/showWeekdayNames;ShadDisabled(disabled:)→Disabled(enabled:);sublabel→descriptionanddirection→controlAffinityon checkboxes, radios and switches. - No longer exported: state classes (
ShadAccordionState,ShadCollapsibleState,ShadContextMenuState,ShadCommandState,ShadInputOTPState,ShadSelectState, every form field's state),ShadMouseAreaSurface,ShadDefaultResizeGrip,ShadPanelInfo,ShadResizeResult,ShadIndeterminateProgressandShadDeterminateProgress.
Look and theme
- A new default look:
UnaThemeData()is thefluidstyle on the Slate scheme. For the classic shadcn/ui look passstyle: StyleTokens.crisp,colorScheme: const GraphiteColorScheme.light(). - Four styles:
fluid(default),crisp,pebbleandsharp(from shadcn's Nova, Maia and Lyra); any token can be set withStyleTokens.copyWith. - Seven colour schemes: Slate (default), Ocean, Graphite, Forest, Iris,
Ember and Rose (
ColorSchemes,SlateColorScheme, …), light and dark.ShadBlueColorScheme,ShadNeutralColorScheme,ShadZincColorScheme,ShadStoneColorScheme,ShadAccentSchemeandapplyAccentSchemeare gone: usecopyWith,UnaColorScheme.applyAccentorUnaColorScheme.fromSeed. - Icons are Phosphor, not Lucide, bundled in six weights
(
PhosphorIconsRegular,PhosphorIconsBold,PhosphorIconsFill,PhosphorIconsLight,PhosphorIconsThin,PhosphorIconsDuotone). In a test, find them withfind.bySubtype<Icon>(). - Floating surfaces are glass in
fluid(popovers, menus, select lists, the command palette, tooltips, toasts);UnaThemeData(menuTranslucent:)is three-state (null follows the style). Menu highlights are a wash of the menu's foreground, andUnaMenuAccent.boldno longer rewrites the scheme's accent. - Table rows have a faint hover and a tinted selection
(
UnaTableTheme.rowHoverColor,rowSelectedColor,footerColor,footerHoverColor). UnaAppcross-fades a theme change (UnaCrossFadeTheme) instead of interpolating it.- A custom
UnaThemeVariantimplements every component theme, andUnaTextTheme.customrequires acaptionstyle.
Motion
- Motion comes from the theme, and
flutter_animateis gone. Removed:effects/iconEffects,reverseDuration,popoverReverseDuration, andduration/curveon overlays, accordion, collapsible, checkbox, radio, switch and their themes;showUnaDialog(animateIn:, animateOut:, variant:)andUnaDialogTheme.animateIn/animateOut; the toast motion parameters;ShadSizeEffect,ShadPaddingEffect,ShadAnimEffectand theflutter_animatere-export. UseUnaThemeData(motion:)(Motion.nonefor none). - Controls scale slightly while pressed (
UnaButtonTheme(pressScale: 1)turns it off), overlays grow from their anchor, tabs and menubar triggers share one travelling indicator, andUnaPageRouteslides as the platform's push does.
Buttons and pressing
- One
style:UnaButton,UnaIconButtonandUnaToggletake aUnaButtonTheme(UnaToggleTheme) merged over the variant's in place of some thirty colour, size and decoration parameters;UnaMenuItem(UnaContextMenuTheme),UnaCard(UnaCardTheme),UnaDialogandUnaSheetlikewise. - A label wider than its button ends in an ellipsis instead of
overflowing:
UnaButtonlays itschildout in the room that is left. - Rarer gestures are a
UnaGestureDetectoraround the button.hoverStrategies,longPressDuration,ShadHoverStrategies,ShadHoverStrategy,UnaThemeData.hoverStrategiesandUnaButton.canRequestFocusare gone. - A
UnaButtonorUnaIconButtonwith noonPressed, noonLongPressand not loading is disabled.UnaButtonSize.iconis removed: useUnaIconButton. UnaBadgeis a static pill:onPressed,enabled,hoverBackgroundColorandmouseCursorare gone (use aUnaChip);shape→borderRadius;UnaBadgeTheme.borderColor.UnaGestureDetectorreports true global positions (the shad #319 workaround is gone).- Focus shows only after the keyboard is used, as CSS's
:focus-visible.
Overlays
- One
UnaPopoverControllerfor popovers, context menus, tooltips and hover cards;ShadTooltipControllerandShadContextMenuControllerare gone,showAt→openAt. - A controlled
openhears its dismissal:UnaPopover,UnaContextMenuandUnaContextMenuRegiontakeonOpenChanged, called when a tap outside, Escape or the controller opens or closes the overlay. One that was dismissed stays closed until the parent changesopen.UnaCollapsibletakes a controlledopentoo. - Tap-region plumbing is internal:
UnaPopover.areaGroupId,useSameGroupIdForChild, the context menus'groupId,onHoverAreaand tap callbacks, andgroupIdonUnaSelect,UnaCalendarandUnaTimeFieldare gone (UnaPopover.groupIdstays), as isUnaPopover.focusNode. - Dialogs and sheets have no close button by default: pass
showCloseButton: true(closeIcon,closeButton), or set it on the theme;onDismissedreports a close.expandActionsWhenTinyandremoveBorderRadiusWhenTinyare gone. - One toast system:
ShadSonnerandShadToasterare oneUnaToasterthatUnaAppprovides;UnaToaster.of(context).show(UnaToast(...))returns an id forupdateanddismiss.UnaToastVariantisneutral,success,warning,destructiveorloading;UnaToast.destructiveandUnaToast.raware gone;UnaThemeData.toastTheme/toasterThemereplaceprimaryToastTheme,destructiveToastThemeandsonnerTheme. Toasts have no close button: swipe, F6 and Escape. - Sheets rest on detents:
UnaSheet(detents:)(UnaSheetDetent.content,medium,large,full,fraction,height) with aUnaSheetControllerreplacesexpandable,initialSize,minSize,maxSize,snap*,isScrollControlled,animationController,dragHandleBuilderandonSizeChanged.showUnaSheettakesdismissible(wasisDismissible) and abuilderthat returns theUnaSheet. UnaMenubarItemtakes onlychild,items,leading,trailing,enabledandfocusNode.UnaSelecthas no scroll chevrons (showScrollToTopChevron,showScrollToBottomChevron).
Inputs and pickers
scribbleEnabledis gone fromUnaTextField,UnaTextareaand their form fields: usestylusHandwritingEnabled, as Flutter does.UnaSelectasserts that it is givenvalueorinitialValue, not both (valuesorinitialValueson.multiple).- Value controls are controlled (
value+onChanged, orinitialValue): the controllers ofUnaSlider,UnaRangeSlider,UnaRadioGroup(ShadRadioController),UnaToggleGroup(ShadToggleGroupController) andUnaSelect(ShadSelectController) are gone;UnaSelect.popoverController→controller,UnaSlider.label→semanticLabel,UnaCalendar.selected/UnaDatePicker.selected→value,UnaCalendar.fromMonth/toMonth→min/max. - One value, or a set: unnamed
UnaSelect,UnaCalendarandUnaToggleGrouphold one value,.multiplea set (values,initialValues,onValuesChanged);UnaAccordion.multipletakesinitialValues.UnaToggleGrouptakesitems(waschildren) andvariant(wastoggleVariant);ShadToggleGroupVariantis gone.allowDeselectionis shared by selects, toggle groups and pickers. - A null callback disables a
UnaToggleGroup,UnaRadioGrouporUnaSelect. - Pickers: the inline time picker is
UnaTimeField(UnaTimeFormField);UnaTimePickeropens it in a popover, or wheels on a phone.UnaDatePicker.range→UnaDateRangePicker.ShadTimePickerController,ShadTimePickerField,ShadTimePickerVariant,UnaDatePicker.rawandShadDatePickerVariantare gone;closeOnSelectiondefaults to true;TimeOfDayhas noperiod. Picker triggers look like a text field unless given avariant:. - Text fields on a touch screen have selection handles, a toolbar and a magnifier by default.
- Tabs are value-based:
UnaTabBar<T>takestabs: [UnaTab(value:, child:)],valueandonChanged, andUnaTabis a data class.UnaTabs<T>losttabsGap,dragStartBehavior,physics,padding,decoration,tabBarConstraintsandcontentConstraints;UnaTabsController.selected→value;UnaTabsTheme.tabBarAlignment→tabAlignment.
Added #
- App structure: form factors (
UnaApp(formFactor:),UnaThemeData.formFactor,FormFactorBuilder);GapSize,Gap,UnaPageContainer,UnaThemeData.layoutTheme;UnaScaffold(bars over the body,drawer,endDrawer,banner,footer,bottomSheet,floatingActionButton,UnaScaffold.withDrawerOf);UnaAppBar(translucentandUnaAppBarTheme.translucent: frosted or opaque, on una's own bar and on Liquid Glass;surfaceBuilder, a background of the app's own built from aUnaAppBarSurfaceState;UnaAppBar.usesLiquidGlass),UnaSliverAppBar(with no title only its buttons while the page is at its top, as discs on una's own bar, and its surface once the page scrolls under it),UnaSliverAppBar.large(bare until its title is in the toolbar;largeTitleStyle),UnaBackButton,UnaCloseButton,UnaFloatingActionButton,UnaToolbar,UnaListDetailLayout,OverlayInsets. - Navigation:
UnaNavigationScaffold(layout:UnaNavigationLayout.auto,bottomBar,topBar,rail;showBottomBar,bottomBarBuilder,mobileAppBar,mobileActions,showMobileAppBar,railExtended,railTrailing, andUnaScaffold'sdrawer,endDrawer,floatingActionButton,banner,footer,bottomSheet),UnaNavigationBar, a floatingUnaBottomNavigationBar,UnaNavigationDestination,UnaNavigationAction,DestinationStack,UnaNavigationMenu,UnaTabBarView,UnaRestorableTabsController,UnaSegmentedControl; back gestures onUnaPageRoute(iOS swipe, Android predictive back) andUnaPage. - Overlays:
UnaActionSheet,showUnaActionSheet,UnaHoverCard,UnaPopover(showArrow:),UnaPopover.requestFocus,showUnaMenu;UnaMenuCheckboxItem,UnaMenuRadioGroup,UnaMenuRadioItem,UnaMenuLabel,UnaMenuDivider,UnaMenuShortcut;UnaSheetfrom any edge and inline. - Inputs:
UnaTextField(clearable:, revealable:, showCounter:),UnaTextField.password,UnaSearchField,showUnaSearch,UnaAutocomplete,UnaNumberField,UnaTagField,UnaDateField,UnaRating,UnaColorPicker,UnaColorPickerButton,UnaWheelPicker,UnaTimeWheelPicker,UnaDateWheelPicker,UnaChip,UnaChipGroup,UnaCheckbox(tristate:),UnaOtpField(obscureText:),ControlSize.sm, touch text selection (UnaTextSelectionControls,UnaTextMagnifier,UnaSelectionArea), pickers in a sheet on a phone (PickerPresentation), and form fields for the new controls. - Lists and data:
UnaListTile,UnaListSection,UnaSliverListSection,UnaSwitchListTile,UnaCheckboxListTile,UnaRadioListTile,UnaExpansionTile,UnaSwipeActions,UnaRefreshIndicator,UnaCarousel,UnaPageIndicator,UnaReorderableListView,UnaBoard,UnaChatList,UnaChatBubble,UnaTypingIndicator,UnaStreamingText,UnaDataTableController.remote,UnaAvatarGroup,UnaIconTile,UnaStatTile,UnaTimeline,UnaIndicatorBadge,UnaEmpty,UnaStepper,UnaResizableController.setSizes. - Charts:
UnaLineChart,UnaBarChart,UnaDonutChart,UnaSparkline,UnaChartLegend,UnaChartTheme, andUnaChartPalette(UnaThemeData(chartPalette:)). - Buttons and feedback:
UnaButton(loading:),UnaButtonVariant.glass,UnaButtonGroup,Pressable,FocusRing,UnaAlertVariant.success/warning/info,UnaProgressRing,UnaSpinnerVariant(ringanduna, a ring of dots with a wave running round it),UnaSkeleton.avatar,UnaSkeletonText,UnaSkeletonCardand more,UnaRevealImage,UnaLicensePage. - Theming:
UnaColorScheme.fromSeed,UnaColorScheme.applyAccent, colour tokenstint,foregroundSubtle,success,warning,borderStrong,accentBorderandbar;UnaGlass,Backdropand glass style tokens (UnaCardTheme(blur:)frosts cards);RadiusScale,UnaTextTheme.caption. - Motion:
Motion(lively,calm,none) on the style,Motion.of(context)honouring reduced motion, and its building blocks (MotionSpring,SpringController,SpringBuilder,PressScale,MovingIndicator,Entrance,PopIn,AnimatedFill, …). - Liquid Glass on iOS and macOS, natively and in a browser, through
liquid_glass_widgets: bars, floating surfaces, dialogs, sheets,UnaSwitch,UnaSliderandUnaSegmentedControl.UnaThemeData(liquidGlass: LiquidGlassTheme(mode:))withLiquidGlassMode.auto,alwaysornever, overridable per component theme;LiquidGlass.initialize()beforerunApp. The soft scroll edge under a glass bar with no title, and a docked bottom bar's, is a blur of the page and nothing over it: no wash of the page colour. - Icons and utilities:
PhosphorIconkeeps a small icon's line weight (PhosphorIconTheme);Haptics(UnaThemeData(haptics: false));DismissShortcut,isShownOnTop,Focusable.visibleOnly. - Accessibility and localisation: semantics roles and names on menus,
tabs, dialogs, landmarks, sliders and pickers; fields named through
semanticLabelorInputDecoratorScope; EnglishUnaLocalizationsstrings for every new widget, which the other locales fall back to.
Fixed #
- Popovers, menus, select lists, date pickers and tooltips stayed on screen
when their anchor was hidden (
IndexedStack,Offstage, anOpacityof zero, a kept-alive page). - A context menu at a point,
showUnaMenuandshowUnaPopover(anchorRect:)opened in the wrong place inside a nested navigator; an overlay moved to stay on screen touched the edge. - Escape in a submenu took three presses; the Escape that closed a popover, tooltip or select was reported as unhandled.
- On the web, Enter did not activate buttons, checkboxes, radios, switches or accordion triggers, and arrow keys did not walk a menu or select.
- A failed validation on an OTP, radio-group, time-picker or date-picker form field moved the focus to a node no widget owned.
- Labels were cut off at larger text sizes in tabs, small buttons, toggles
and calendar cells; the calendar,
UnaSliderandUnaRangeSliderdid not mirror right to left. - The date picker showed an empty row above the first week in a popover; a calendar whose value was set to null from outside kept its selection.
- A disabled
UnaButtonwas dimmed by a fixed half instead ofUnaThemeData.disabledOpacity;UnaButtonTheme.pressedOffsetwas a fraction of the width; aUnaIconButtonignored its variant's size; buttons were not one semantics node. - Hover and selection fills flashed darker midway.
UnaProgressBarthrew when it went indeterminate a second time;UnaTabs(restorationId:)threw for non-primitive values andUnaTabs(expandContent: true)in a scroll view.UnaSidebarScaffold's shortcut acted under a dialog and took Ctrl+B from text fields; it is ⌘B on Apple platforms, Ctrl+B elsewhere.- An uncontrolled
UnaSelect.multiplelost its choice when rebuilt;UnaSelect.withSearchwith a custom search field ignored Space and Enter. - A menubar menu closed by a choice or Escape left the menubar open; a
UnaContextMenuopen from its first build did not take the focus;UnaContextMenuTheme.subMenuPaddingdid not reach submenus; aUnaPopovercould not switch betweencontroller:andopen:. - Resetting a
UnaFormcalledonChangedandonResettwice. - A slider thumb jumped when grabbed off-centre, and a sideways swipe in a pager moved the page rather than the thumb.
- A sheet's barrier did not lighten while dragged; a dialog's barrier blur
popped in at the end; a dialog's actions in a
Wrapdid not fill a phone's width. - A field with a custom border radius kept a focus ring of the theme's
radius; merging a
UnaRoundedSuperellipseBorderdropped itsoffsetandpadding. - Table hover was far too dark on a translucent
muted,UnaTable.listnever repainted its hover, and theUnaDataTableselection count was not localised. UnaSelectOption.hoveredBackgroundColorwas ignored; a controlledUnaToggleGroupcalledsetStateduring build; a tooltip re-hovered while leaving disappeared anyway.- A narrow
UnaDialog, an openUnaTooltipand aUnaAppwith no theme derived the theme on every build, andUnaSpinnerrebuilt on every frame. - Keyboard and assistive technology (reviewed against WAI-ARIA and WCAG 2.2
AA): checkboxes, switches and radios are one node with their label;
radio and toggle groups and the calendar are one Tab stop walked with the
arrows; sliders take Home, End and Page Up/Down; selects, the accordion,
sortable
UnaDataTableheaders, dialogs, tooltips, menus and the menubar follow their ARIA patterns; collapsed content is out of the Tab order;UnaContextMenuRegionopens from the Menu key or Shift+F10.
