flutter_dsl 1.0.0
flutter_dsl: ^1.0.0 copied to clipboard
Annotation + extension based responsive layout and design-system-friendly DX toolkit for Flutter. No build_runner required.
1.0.0 Major Pivot: responsive layout & design-system DX #
This is a major version bump from 0.1.x. The package pivots from "declarative
UI helpers" to an annotation + extension toolkit for crossplatform responsive
layouts and design-system-friendly DX. No build_runner, no dart:mirrors.
BREAKING CHANGES #
None at the source level — 0.1.x APIs that conflict with the new direction are
marked @Deprecated and continue to work in v1.x. They will be removed in v2.0.
Added #
ScreenSizeenum (Material 3:compact / medium / expanded / large / extraLarge) withisMobile / isTablet / isDesktopgetters.Breakpoints.resolve(width, breakpoints)+Breakpoints.material3 = [600, 840, 1200, 1600].ResponsiveScopeInheritedWidget—of(context)/maybeOf/dataOf, withMediaQueryfallback when no scope is present.ResponsiveStatelessWidget/ResponsiveStatefulWidget+ResponsiveStatebase classes — auto-wrap the subtree inResponsiveScopeand forwardScreenSizetobuildResponsive(context, size).ResponsiveBuilder({mobile, tablet?, desktop?})widget withdesktop → tablet → mobilefallback.- Widget extensions:
.onMobile / .onTablet / .onDesktop,.hideOnMobile / .hideOnTablet / .hideOnDesktop,.responsive({mobile, tablet, desktop}). Responsive.value<T>(context, ...)/Responsive.when(context, ...)/isMobile/isTablet/isDesktop(context)— context-aware static helpers that add no wrapper widgets.- Marker annotations:
@ResponsiveView({breakpoints}),@DesignSystemComponent({name, category}),@BreakpointOverride(breakpoints). Markers only; pair withResponsiveStatelessWidgetfor runtime effect. - Widget styling extensions:
.size(w,h) / .width / .height / .square / .constrained({min/maxWidth/Height}) / .aspectRatio. - Text styling extensions:
.fontSize / .fontWeight / .textColor / .letterSpacing / .lineHeight / .italic / .underline— merge onto the existingTextStyleso design-system tokens compose cleanly with per-property overrides.Text.richis not supported (debugassert). - Functional conditional extensions:
.onTrue / .onFalse / .when(transforms, distinct from.visiblewhich gates visibility). WhenWidget<T>({value, cases, orElse?})— value-dispatched widget switch.- Test suite: 55 tests under
test/covering responsive resolution, scope wiring, transforms, styling merges, conditional behavior, and annotation metadata. example/pubspec.yaml— previously missing; the example app is now runnable.
Changed #
Widget.backgroundColor(...)internal implementation changed fromContainertoColoredBox(external signature unchanged).analysis_options.yaml: addedprefer_const_constructors,prefer_const_literals_to_create_immutables,use_super_parameters,require_trailing_commas.
Deprecated (will be removed in v2.0) #
All deprecated APIs have been gathered under lib/src/deprecated/ to visually
separate them from the active surface. They remain re-exported from the
package barrel so existing 0.1.x consumer code keeps compiling.
Widget.marginAll / marginSymmetric / marginOnly(lib/src/deprecated/widget_margin_extensions.dart) — implicitContainerwrapping. UsepaddingAll/paddingSymmetric/paddingOnlyor aSpacingwidget instead.String.text({fontSize, color, ...})(lib/src/deprecated/string_text_extensions.dart) — bypasses design-system tokens. Use a theme token +.fontSize/.textColorchain (e.g.'Hi'.bodyLarge(context).fontSize(18)).String.withStyle(TextStyle)(lib/src/deprecated/string_text_extensions.dart) — bypasses design-system tokens. UseText(value, style: ...)directly.Widget.gapLeft / gapRight / gapTop / gapBottom(entireSpacingExtensions,lib/src/deprecated/spacing_extensions.dart) — implicitRow/Columnwrapping collides when chained. UseIterable<Widget>.row(spacing: ...)/.column(spacing: ...)or aSpacingwidget on the parent.Widget.ifTrue / ifFalse(lib/src/deprecated/conditional_extensions.dart) — visibility semantics overlap with.visible(cond), transform semantics overlap with the new.onTrue / .onFalse.
Migration #
See the migration table in README.md.
Dependencies #
- Added
meta: ^1.10.0(for@Targetmetadata on marker annotations). - Added dev dependency
flutter_lints: ^4.0.0.
0.1.2+2 #
Documentation #
- Fixed dartdoc issues related to angle brackets (
<T>,<Widget>) - Applied
dart format .to match Dart style guidelines and improve pub.dev score
0.1.2+1 #
Features #
-
expanded()andflex(n)toWidgetExtensions- Easily wrap widgets in
ExpandedorFlexible - Example:
'Content'.text().expanded()or.flex(2)
- Easily wrap widgets in
-
row()andcolumn()toIterable<Widget>viaIterableWidgetExtensions- Convert list of widgets into
RoworColumnwith DSL-style - Example:
[A, B, C].row()or.column(...)
- Convert list of widgets into
0.1.1 #
Documentation #
-
Added
dartdoccomments to all public extension methods:WidgetModifiersStringTextExtensionsSpacingExtensionsConditionalExtensions
-
Updated
README.md:- Improved feature descriptions and usage examples
- Added badge and link to full example
- Highlighted motivation and future roadmap