control_style 0.2.0
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.dartis deprecated since Flutter 3.47. The package now depends onpackage:material_ui/material_ui.dart.DecoratedInputBorderextends that package'sInputBorder, andDecoratedOutlinedBorderextends itsOutlinedBorder. These are not the classes still exported bypackage:flutter/material.dart. Thechildborder and the widget that receives the decorated shape must come frommaterial_ui.- The gradient border is painted as a filled band exactly
widthwide, 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 aroundUnderlineInputBorder. If you tunedwidthto the old rendering, double it.GradientBorderSide.toPaintreturns a fill paint;width: 0paints nothing instead of a hairline. DecorationPainter.borderGradientis declared as non-nullableGradientBorderSide. Both bundled implementations already returned a non-null value. Custom implementations of the mixin must returnGradientBorderSide.noneinstead ofnull; callers can drop?.and!.DecorationPainter.paintBorder2, deprecated in 0.1.2, is removed. UsepaintGradientBorder; the signature is unchanged.- Requires Dart 3.13 (
sdk: ^3.13.0), Flutter 3.47 or newer, andmaterial_ui1.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.strokeAlignwith the same semantics and constants asBorderSide.strokeAlign(strokeAlignInside, the default,strokeAlignCenter,strokeAlignOutside), plusstrokeInsetandstrokeOutset. The alignment is forwarded to the decorated shape's side, sodimensionsandgetInnerPathfollow it. Shapes that ignoreBorderSide.strokeAlign(UnderlineInputBorder) ignore it as well.
Bug fixes:
- The gradient border of an
OutlineInputBorderleaves the gap for a floating label, as the plain border does.paintGradientBorderacceptsgapStart,gapExtentandgapPercentagefor that;DecoratedInputBorderforwards them.
Other:
BorderSide,BoxShadow,ShapeBorderandGradientstay the Flutter SDK types.GradientBorderSideandGradientShadoware unchanged.- When the fill between the inner and the outer path would not match the
child's side (
strokeAlignother 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 asaveLayerper 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/ContainerusingShapeDecorationwith a decorated shape. DecoratedOutlinedBorder.copyWith(side:)now forwards the side to the child instead of making it transparent.OutlinedButton,CheckboxandChipwith a decorated shape and noborderGradientshow their outline again.GradientShadowkeeps its gradient inscaleandcopyWith, and therefore when animated in or out vialerp/lerpListandShapeBorder.scale.GradientShadow.lerpbetween aGradientShadowand a plainBoxShadowinterpolates the gradient instead of dropping it.GradientBorderSide.lerpfades a side withBorderStyle.nonein and out instead of switching it at full opacity.- Forward
TextDirectionto the background and border gradient shaders; gradients withAlignmentDirectionalno longer throw. - Shadows with negative offsets are clipped and painted correctly.
DecoratedInputBorderkeeps itsisOutlinewhile interpolating.- The child's side is preserved when
borderGradienthasstyle: BorderStyle.nonebut is not identical toGradientBorderSide.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
offsetwill become visible where they used to be clipped away or painted over the interior. - Animations that used to jump will animate.
Additions:
DecoratedOutlinedBorder.clipInnerconstructor parameter (defaulttrue).GradientBorderSide.isNoneandGradientBorderSide.toPaint(textDirection:).GradientShadow.fromBoxShadow,GradientShadow.scaleandGradientShadow.copyWithreturningGradientShadow.copyWithandscaleof the decorated borders return the concrete type.DecorationPainter.paintGradientBorder;paintBorder2is 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
borderGradientreplaces the child's side and how buttons,CheckboxandChipresolve their side from the style. - Tests added.
0.1.1 #
- lint rules updated
0.1.0 #
- document public members
- place the code in
srcfolder - fix SDK version
0.0.3 #
- Replaced deprecated functions.
- Updated lint rules.
0.0.2 #
- Fixed bugs in
lerpfunctions.
0.0.1 #
- Initial release.
