Skip to main content

control_style 0.2.0 copy "control_style: ^0.2.0" to clipboard
control_style: ^0.2.0 copied to clipboard

Applies additional decoration to Flutter-based text fields, buttons and other controls. This allows for better interface customisation.

0.2.0 #

See MIGRATION.md for step-by-step instructions.

Breaking changes:

  • package:flutter/material.dart is deprecated since Flutter 3.47. The package now depends on package:material_ui/material_ui.dart. DecoratedInputBorder extends that package's InputBorder, and DecoratedOutlinedBorder extends its OutlinedBorder. These are not the classes still exported by package:flutter/material.dart. The child border and the widget that receives the decorated shape must come from material_ui.
  • The gradient border is painted as a filled band exactly width wide, inside the shape. It used to be stroked along both edges, which made it twice as wide and half of it outside the shape, and painted a rectangle around UnderlineInputBorder. If you tuned width to the old rendering, double it. GradientBorderSide.toPaint returns a fill paint; width: 0 paints nothing instead of a hairline.
  • DecorationPainter.borderGradient is declared as non-nullable GradientBorderSide. Both bundled implementations already returned a non-null value. Custom implementations of the mixin must return GradientBorderSide.none instead of null; callers can drop ?. and !.
  • DecorationPainter.paintBorder2, deprecated in 0.1.2, is removed. Use paintGradientBorder; the signature is unchanged.
  • Requires Dart 3.13 (sdk: ^3.13.0), Flutter 3.47 or newer, and material_ui 1.4.0 or newer (^1.4.0). The previous lower bounds (Dart 2.14, Flutter 1.17) predated APIs the package relies on and were never tested.

New features:

  • GradientBorderSide.strokeAlign with the same semantics and constants as BorderSide.strokeAlign (strokeAlignInside, the default, strokeAlignCenter, strokeAlignOutside), plus strokeInset and strokeOutset. The alignment is forwarded to the decorated shape's side, so dimensions and getInnerPath follow it. Shapes that ignore BorderSide.strokeAlign (UnderlineInputBorder) ignore it as well.

Bug fixes:

  • The gradient border of an OutlineInputBorder leaves the gap for a floating label, as the plain border does. paintGradientBorder accepts gapStart, gapExtent and gapPercentage for that; DecoratedInputBorder forwards them.

Other:

  • BorderSide, BoxShadow, ShapeBorder and Gradient stay the Flutter SDK types. GradientBorderSide and GradientShadow are unchanged.
  • When the fill between the inner and the outer path would not match the child's side (strokeAlign other than inside, or a label gap), the gradient border is painted through a mask of the child's side in a layer. This is pixel-exact for any shape but costs a saveLayer per paint. The default configuration keeps the cheap fill.

0.1.2 #

Bug fixes:

  • Restore the canvas state after clipping the outer shadow. The leaked clip hid the child of a DecoratedBox/Container using ShapeDecoration with a decorated shape.
  • DecoratedOutlinedBorder.copyWith(side:) now forwards the side to the child instead of making it transparent. OutlinedButton, Checkbox and Chip with a decorated shape and no borderGradient show their outline again.
  • GradientShadow keeps its gradient in scale and copyWith, and therefore when animated in or out via lerp/lerpList and ShapeBorder.scale.
  • GradientShadow.lerp between a GradientShadow and a plain BoxShadow interpolates the gradient instead of dropping it.
  • GradientBorderSide.lerp fades a side with BorderStyle.none in and out instead of switching it at full opacity.
  • Forward TextDirection to the background and border gradient shaders; gradients with AlignmentDirectional no longer throw.
  • Shadows with negative offsets are clipped and painted correctly.
  • DecoratedInputBorder keeps its isOutline while interpolating.
  • The child's side is preserved when borderGradient has style: BorderStyle.none but is not identical to GradientBorderSide.none.
  • Decorations interpolate smoothly even when the child borders cannot interpolate into each other, and when interpolating between a decorated and a plain InputBorder/OutlinedBorder.
  • GradientShadow.toString() is well-formed.

Behaviour changes caused by the fixes above:

  • Controls that previously lost their outline or content will show them again.
  • Shadows with negative offset will become visible where they used to be clipped away or painted over the interior.
  • Animations that used to jump will animate.

Additions:

  • DecoratedOutlinedBorder.clipInner constructor parameter (default true).
  • GradientBorderSide.isNone and GradientBorderSide.toPaint(textDirection:).
  • GradientShadow.fromBoxShadow, GradientShadow.scale and GradientShadow.copyWith returning GradientShadow.
  • copyWith and scale of the decorated borders return the concrete type.
  • DecorationPainter.paintGradientBorder; paintBorder2 is deprecated and will be removed in the next breaking release.

Other:

  • Skip painting the gradient border when it is switched off.
  • Documentation: fixed doc comments and README, described how borderGradient replaces the child's side and how buttons, Checkbox and Chip resolve their side from the style.
  • Tests added.

0.1.1 #

  • lint rules updated

0.1.0 #

  • document public members
  • place the code in src folder
  • fix SDK version

0.0.3 #

  • Replaced deprecated functions.
  • Updated lint rules.

0.0.2 #

  • Fixed bugs in lerp functions.

0.0.1 #

  • Initial release.
25
likes
160
points
11.6k
downloads
screenshot

Documentation

API reference

Publisher

verified publisherastonio.com

Weekly Downloads

Applies additional decoration to Flutter-based text fields, buttons and other controls. This allows for better interface customisation.

Homepage
Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter, material_ui

More

Packages that depend on control_style