Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 153 additions & 0 deletions packages/mix/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,156 @@
## 2.2.0

Stable release of the 2.2.0 line, cumulative over the `2.2.0-beta.0` through
`2.2.0-beta.6` prereleases. This release adds the `GridBox` and `WrapBox` layout
families, a typed and extensible context-variant system with focus-visible
support, a fuller `Pressable` input and semantics surface, and complete
`WidgetModifierConfig` convenience APIs; it fixes variant merge priority and
nested widget-state discovery, and it carries breaking changes to `Pressable`
and to `GridBox` implicit rows.

### New features

- **GridBox:** Added the public `GridTrack`, `GridBoxSpec`, `GridBoxStyler`, and
`GridBox` API with fixed/fractional tracks, explicit and repeated rows, gaps,
row-major placement, clipping, and local `Breakpoint`-based constraint
branches. Equal fractional columns use `equalColumns`; numeric tracks and
gaps support Mix tokens; compatible geometry participates in implicit style
animation. `GridTrack.auto()` adds content-sized row tracks for `rows` and
`autoRows`: an auto row sizes to its tallest child's natural height at the
resolved column width, then stretches shorter children to fill the row. `auto`
is vertical-only; `columns` rejects it.
- **WrapBox:** Added the public `WrapSpec`, `WrapStyler`, `WrapBoxSpec`,
`WrapBoxStyler`, and `WrapBox` family with flattened fluent Wrap styling,
collision-safe Box/Wrap names, generated constructors and factories, and a
runnable gallery example.
- **Complete `WidgetModifierConfig` convenience APIs:** `mouseCursor` and
`scrollView` are now available as factories and chain methods, and `skew`,
`defaultIcon`, `iconTheme`, `box`, and `reset` gained the chain methods their
factories were missing. Every built-in modifier can now be reached without
`.modifier(SomeModifierMix(...))`, for example
`BoxStyler().wrap(.mouseCursor(SystemMouseCursors.click))`. The chained
`reset()` clears the modifiers accumulated in that configuration only; use the
`WidgetModifierConfig.reset()` factory when the reset must also clear the
configuration it is merged into.
- **`ContextVariant.widgetStateDependencies`:** Context variants now declare the
widget states they read, so custom variants participate in nested dependency
discovery instead of relying on the framework recognizing a specific variant
type. Automatic self-tracking is limited to pointer-driven hover and press;
other states still require an ancestor scope or external controller.
- **Typed focus-visible variants:** Added `FocusVisibleVariant`,
`ContextVariant.focusVisible()`, and `onFocusVisible(...)`, which apply while
focus is highlighted in Flutter's traditional (keyboard/directional) mode.
- **Pressable semantics roles:** Added `PressableSemanticsRole` with button,
link, and neutral roles. `PressableBox` now forwards the full Pressable
focus, keyboard, controller, feedback, cursor, action, and semantics surface.
- **Typed context variants:** `BrightnessVariant`, `BreakpointVariant`,
`OrientationVariant`, `DirectionalityVariant`, `PlatformVariant`,
`WebVariant`, and `NotVariant` are now public value objects behind their
`ContextVariant` factories, giving schema and tooling code stable typed data
to inspect instead of parsing keys.
- **Style-state override scope:** `WidgetStateStyleOverride` lets tooling and
tests force widget-state variants through normal `style` resolution, taking
precedence over controllers and nested interaction providers without
changing component behavior.
- **Generated Styler field metadata:** Every generated Styler now exposes its
complete source-field inventory through
`StylerFieldMetadata.$stylerFieldNames`, allowing schema tooling to validate
coverage without maintaining duplicate string manifests. Handwritten and
previously generated Stylers do not implement this capability until they opt
in or are regenerated.
- **`CssKeywordLinearTransform`:** Adds a reusable bounds-aware
`GradientTransform` for CSS linear-gradient keyword directions, so Tailwind
corner gradients can round-trip through schema tooling without losing visual
parity.

### Breaking changes

- **Pressable input and semantics:** Replaced `semanticButtonLabel` with
`semanticsLabel`, added `semanticsRole`, and removed the deprecated `onKey`
callback. Use `onKeyEvent` for custom keyboard handling.
- **Reserved activation keys:** While it holds primary focus and can activate,
Pressable owns unmodified Space, Enter, numpad Enter, select, and game button
A so it can model held-key state consistently. Override those direct key
bindings with `onKeyEvent`. `onPress` still honors `ActivateIntent` dispatched
by remapped shortcuts or programmatic invocation, and custom `actions` can
override that binding or handle other intents. Only those five reserved keys
are claimed raw; they are left untouched when a descendant holds focus, and
modified chords are left to application shortcuts. A link-role Pressable
activates with Enter but leaves Space available for scrolling.
- **Omitted GridBox `autoRows` no longer throws:** Children needing more rows
than were declared previously required an explicit `autoRows` track, or the
Grid threw. Omitted `autoRows` now defaults to `GridTrack.auto()`, so
implicit rows size to their tallest child — both when no rows are declared
and when explicit rows run out. Fractional rows still require a bounded
height, and fixed tracks remain hard constraints. If you relied on the throw
to catch an under-declared Grid, declare `rows` explicitly or set `autoRows`
to the track you want repeated.

### Fixes

- **Variant merge priority follows declared state dependencies:** Priority now
groups active variants by whether they declare
`ContextVariant.widgetStateDependencies` rather than by whether they are a
`WidgetStateVariant`, so `onFocusVisible(...)` competes by declaration order
instead of always losing to any widget-state variant sharing a property, which
had been silently replacing focus rings. Variants built on
`ContextVariant.not(...)` move with their inner variant, so `onEnabled(...)`
now outranks an ambient variant such as `onDark(...)` declared after it.
- **Declaration order within a priority group is reliable:** Grouping is a
stable partition rather than a `List.sort`, which fell back to an unstable
quicksort at 32 elements and could reorder equal-priority variants in styles
that large.
- **Nested widget-state discovery:** `Style.widgetStates` now discovers state
requirements recursively through nested and negated context-variant branches
with identity-based cycle protection, so variants like
`onDark(BoxStyler().onHovered(...))` and `onEnabled(...)` are tracked instead
of silently never activating. Branches under un-applied named variants are
deliberately not tracked because they cannot activate until `applyVariants`
hoists them to the top level.
- **Interaction detector is mounted only when it can help:** `StyleBuilder` now
installs its pointer-interaction detector only for the states that detector
actually drives (`hovered`/`pressed`). States such as `disabled` and `focused`
can only come from an external `WidgetStatesController` or an ancestor scope,
so styles depending solely on those no longer gain an opaque hit-test target
that swallowed pointer events aimed at widgets beneath them, and no longer
hijack the state scope of descendants that do track hover.
- **Pressable lifecycle:** Pointer and keyboard press sources are combined
without clearing each other, keyboard activation fires once on key-up,
cancellation clears held state, focus-visible follows Flutter input modality,
and disabled controls ignore custom key handling and expose neither semantic
nor custom actions.
- **Press state ends with the gesture:** A pointer that drifts past the tap slop
stops counting as a press, so items no longer stay visually pressed while a
list scrolls under the finger.
- **Focus-visible scope:** The focus-highlight scope is now provided wherever
widget states are, so `onFocusVisible` also resolves — and repaints on input
modality changes — outside a `Pressable`. A `WidgetStateStyleOverride` forcing
`focused` now applies it too, matching `onFocused`.
- **Variant merge-key collisions:** Variant styles now merge by an opaque,
semantic identity instead of the human-readable `Variant.key`. Equivalent
named, enum-backed, and built-in context variants still coalesce, while
unrelated variants with the same label retain their own predicates. Dynamic
builders keep their existing build-then-merge behavior and use function
equality instead of a hash string for merge identity.
- **Context variant equality:** `ContextVariant.brightness`,
`ContextVariant.breakpoint`, `ContextVariant.orientation`,
`ContextVariant.directionality`, `ContextVariant.platform`,
`ContextVariant.web`, and `ContextVariant.not` now compare by their typed
values instead of identity, so equivalent variants deduplicate and
round-trip predictably.
- **Default text style modifier merge:** Partial `DefaultTextStyleModifierMix`
overrides now merge with the ambient `DefaultTextStyle` instead of replacing
inherited text style fields.
- **Box shadow blur styles:** `BoxShadowMix` now preserves non-default
`BoxShadow.blurStyle` values across construction, conversion, merging,
resolution, diagnostics, equality, and its fluent and factory APIs (#992).

### API changes

- **`tokenFromReferenceValue`** is now public for schema/tooling code that needs
to identify unresolved token references, including sentinel-backed
`DoubleRef` values, without importing Mix internals.

## 2.2.0-beta.6

### New features
Expand Down
6 changes: 3 additions & 3 deletions packages/mix/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: mix
description: An expressive way to effortlessly build design systems in Flutter.
version: 2.2.0-beta.6
version: 2.2.0
homepage: https://github.com/btwld/mix
repository: https://github.com/btwld/mix/tree/main/packages/mix

Expand All @@ -11,14 +11,14 @@ environment:
dependencies:
flutter:
sdk: flutter
mix_annotations: ^2.2.0-beta.0
mix_annotations: ^2.2.0

dev_dependencies:
flutter_lints: ^6.0.0
dart_code_metrics_presets: ^2.24.0
build_runner: ^2.11.0
mix_generator:
version: ^2.2.0-beta.3
version: ^2.2.0
path: ../mix_generator
flutter_test:
sdk: flutter
Expand Down
15 changes: 15 additions & 0 deletions packages/mix_annotations/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
## 2.2.0

Stable release of the 2.2.0 line. Cumulative since 2.1.3:

- **FEAT**: Add `MixWidget.target` for plain widget constructor tear-offs and
`factoryParameters` for independent recipe parameter curation.
- **FEAT**: Add `MixableField.forwardStyler` and `stylerSurface` for opt-in
projection of a nested generated Styler's canonical named-factory surface
onto its parent Styler (#983).
- **DOCS**: Document that `stylerFieldNames` is reserved as a source field name
and `$stylerFieldNames` as a generated member name, and that a custom `props`
implementation must preserve the complete generated field surface (#1028).
- **DOCS**: Document the construction and fluent-method contract for a custom
`setterType` combined with `forwardStyler`.

## 2.2.0-beta.1

- **FEAT**: Add `MixWidget.target` for plain widget constructor tear-offs and
Expand Down
2 changes: 1 addition & 1 deletion packages/mix_annotations/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: mix_annotations
description: Annotations for mix and mix_generator
version: 2.2.0-beta.1
version: 2.2.0
repository: https://github.com/btwld/mix/tree/main/packages/mix_annotations

environment:
Expand Down
41 changes: 41 additions & 0 deletions packages/mix_generator/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
## 2.2.0

Stable release of the 2.2.0 line. Cumulative since 2.1.3:

- **FEAT**: Generate `@MixWidget(target:)` wrappers for plain Widget
constructors without requiring `StyleWidget` or extension `call()` methods.
Preserve target generics, key/default forwarding, enum variant
constructors, independent widget/factory parameter curation, and clean
same-build generated Styler support.
- **FEAT**: Emit a complete `$stylerFieldNames` inventory for generated
Stylers so schema tooling can validate field coverage directly from runtime
classes. `stylerFieldNames` is now reserved, with a targeted diagnostic,
and generated field-name literals safely escape `$` identifiers. Generated
output requires Mix 2.2.0 or newer.
- **FEAT**: Forward canonical named factories and matching fluent anchors from
nested `StyleSpec<XSpec>` fields with
`@MixableField(forwardStyler: true)`. A source-Spec `stylerSurface` override
supports compatible restricted surfaces without resolving same-package
generated Stylers, with field-located diagnostics for invalid or ambiguous
configurations (#983).
- **FIX**: Drop redundant `this` qualifiers from generated `@MixWidget` build
methods. The unused build parameter is now the wildcard `BuildContext _`, so
a field named `context` still forwards the widget's own value instead of the
build context. The values forwarded to the target constructor or factory are
unchanged.
- **FIX**: Preserve type parameters and bounds from uninstantiated generic
targets in generated `@MixableSpec(target:)` `call()` methods, and reject
instantiated or aliased generic targets instead of silently widening them in
`@MixableSpec(target:)` or `@MixWidget(target:)`. Reject a target type
parameter named `Key` when it would shadow the generated Flutter key
parameter (#1023).
- **FIX**: Allow `@MixableSpec(target:)` to use plain Widget constructors whose
named `style` parameter accepts the generated Styler, without requiring the
target to extend `StyleWidget` (#1022).
- **FIX**: Generate `@MixWidget` wrappers on clean builds when a factory
returns a Styler generated by a same-library `@MixableSpec` (#995).
- **FIX**: Render forwarded nested Styler APIs in the host library scope,
delegate restricted aliases through the actual nested implementation,
validate custom forwarding `setterType` construction and method
compatibility, and reject collisions with inherited `MixStyler` members.

## 2.2.0-beta.4

- **FIX**: Drop redundant `this` qualifiers from generated `@MixWidget` build
Expand Down
4 changes: 2 additions & 2 deletions packages/mix_generator/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: mix_generator
description: A code generator for Mix, an expressive way to effortlessly build design systems in Flutter.
version: 2.2.0-beta.4
version: 2.2.0
homepage: https://github.com/btwld/mix
repository: https://github.com/btwld/mix/tree/main/packages/mix_generator

environment:
sdk: ">=3.11.0 <4.0.0"

dependencies:
mix_annotations: ^2.2.0-beta.1
mix_annotations: ^2.2.0
dart_style: ^3.0.0
source_gen: ">=3.0.0 <5.0.0"
analyzer: '>=9.0.0 <11.0.0'
Expand Down
Loading