flutter_tailwind 2.1.8
flutter_tailwind: ^2.1.8 copied to clipboard
I hope to make something like tailwind that can simplify the description of style and improve efficiency.
2.1.7 #
Features #
-
.placeBuilder(...)and.errorBuilder(...)on the.imagechain: a network image's own placeholder while it loads (in place ofImageLoader.config's shimmer) and its own fallback when it cannot load. They reach plain, rounded and circle images, and the error one a missing file or asset too. An image that sets either is loaded byImageLoadereven when animageFactoryis configured, sinceBaseImageFactorytakes no builders.url.image.s36.circle.placeBuilder((_, __) => bundledFlag).errorBuilder((_, __, ___) => bundledFlag).mk
Fixes #
- A network image with an
errorBuildershows it as soon as the load fails. It used to retry the URL with an uncachedImage.networkfirst and call theerrorBuilderonly when that failed too, so an unreachable host left a blank box for a second timeout.
2.1.6 #
Fixes #
- Plain network images (
'url'.image.w(...), no radius, not a circle) are now decoded at the size they are drawn instead of at the original resolution. ThetypeNormalandtypeBlurbranches ofImageLoaderdid not forwarduseSingleCache, so_Imagefell back to its own default (true) and passed nomemCacheWidth/memCacheHeighttoCachedNetworkImage. A screen with a dozen large photos decoded hundreds of MB of bitmaps at once and froze. Use.singleCachewhere an image really must keep the original resolution. - Network images are decoded along one side only (the width when one is set, else the height).
ResizeImagedefaults toResizeImagePolicy.exact, so passing both sides - as the rounded and circle-with-LayoutBuilder branches did, withheightdefaulting towidth- squashed every non-square image into its box. - Circle images (
ImageLoader.circlewith a radius) are decoded at their diameter (radius * 2), along the width only. They were decoded atradius- half the drawn size, so every avatar was upscaled 2x - with width and height swapped and both set. A local-file circle is now decoded at the same size instead of at full resolution. - Tests cover the decode size handed to
CachedNetworkImagefor width, size, rounded, height-only, no-size,.singleCacheand circle images, and the local-file circle.
2.0.1 #
Fixes #
- Fix
AutoSizeTextassertion crash when using.text.fN.fM.mk(auto-shrink-to-fit text) together with a non-IdentitySizeAdapter. v2.0.0'sssp()threading produced fractional values that violatedAutoSizeText'sstepGranularity=1requirement. BothminFontSizeand the style'sfontSizeare now rounded to integers afterssp(). Regression test added covering a_MockFractionalSpAdapter(mimics screenutil-on-desktop.spfactors).
2.0.0 #
Breaking changes #
- Removed
adaptW/adaptH/adaptR/adaptSpgetters. Replaced by global configuration viaTailwind.instance.configSizeAdapter(...). To preserve the old behavior, write a 4-line SizeAdapter that wraps screenutil — seedoc/patterns/screen-adaptation.md. - Removed
flutter_screenutildependency. The library no longer transitively pulls screenutil. If your project relied on the indirect export (e.g.ScreenUtilInitimported viapackage:flutter_tailwind), addflutter_screenutilto your ownpubspec.yaml. - Removed
Tailwind.instance.contextfield.init()now extracts needed values from the context immediately and does not retain it..primaryno longer needs a try-catch (the deactivated-context throw scenario cannot happen anymore). p16/p20are now top-level getters (werefinalvariables). Calling syntax (padding: p16) unchanged but each access now routes throughSizeAdapter.
New #
SizeAdapterabstract class — 4-method interface (w/h/r/sp) that decouples the library from any specific screen-adaptation package. DefaultIdentitySizeAdapter(no scaling).Tailwind.instance.screenW/screenH— cached screen dimensions populated byinit(context). Used internally by thehFull/wFullfamily; also exposed for user code.Tailwind.instance.configSizeAdapter(adapter)— install your scaling implementation, typically once at app startup.
Migration (1.x → 2.0) #
- Remove every
.adaptW/.adaptH/.adaptR/.adaptSpcall from your code. - If you used screen scaling, write a SizeAdapter subclass:
class ScreenUtilSizeAdapter implements SizeAdapter { const ScreenUtilSizeAdapter(); @override double w(double v) => v.w; @override double h(double v) => v.h; @override double r(double v) => v.r; @override double sp(double v) => v.sp; } void main() { Tailwind.instance.configSizeAdapter(const ScreenUtilSizeAdapter()); runApp(...); } - If you used
hFull/wFull-family getters, callTailwind.instance.init(context)from insideMaterialApp.builder(or any context inside MaterialApp).
1.8.0 #
Tailwind.instance.primaryno longer throwsLooking up a deactivated widget's ancestor is unsafewhen accessed after the holding widget has been disposed; it now falls back toprimaryColor ?? Colors.amber. Added 5 widget tests covering init/no-init/disposal scenarios — the first real unit tests in this repo.- Replaced deprecated
Color.withOpacitywithColor.withValues(alpha:)internally (no behavior change for users — same alpha-modified color, better precision in the new color pipeline). - New
doc/directory as the documentation single-source-of-truth:doc/getting-started.md— install, bare-minimum usage, theme primary color setup with the correct init positiondoc/patterns/screen-adaptation.md—.adaptW/.adaptH/.adaptR/.adaptSp(the opt-in screen-scaling API introduced in 1.7.x but undocumented until now)doc/patterns/spacing.md—spacing2..spacing32shortcuts vs manual spacers
.cursor/rules/flutter_tailwind.mdcfixed several stale teachings:- Removed the recommendation to run
flutter packages pub run build_runner build(this library does not usebuild_runner) - Rewrote the
Tailwind.instance.init(context)example — init must be called from insideMaterialApp, not fromScreenUtilInit.builder(the context there is above MaterialApp, soTheme.ofreturnsThemeData.fallback()instead of your theme —.primaryends up the wrong color)
- Removed the recommendation to run
- README adds a documentation-navigation section at the top and an explicit note that this library does not use
build_runner. guide.mdadds a migration banner pointing atdoc/.
1.4.8 #
- Add the wrap widget
1.4.7 #
- 1.Support maxW, maxH
- 2.Support setting the color of a border individually for the container
1.4.4 #
- add the positioned widget
1.4.2 #
- Just update the document
1.4.1 #
- Provide more expanded*
1.3.9 #
- Provide the function for container to have key
1.3.8 #
- also let the container have expanded feature
1.3.7 #
- add the p,to generate the EdgeInsetsGeometry
1.3.6 #
- fix the bug which cannot load the rounded image
1.3.5 #
- let the image loader support loading base64 picture
1.3.4 #
- add the AutoSizeText as basic component,people can use 'text.f30.f10.black.mk',f30:max font size,f10 min font size
1.3.2 #
- let text support expanded
1.3.1 #
- fixed the padding problem
1.3.0 #
- add more prefer define padding ,margin and others
1.2.8 #
- add the padding widget and let some width directly support padding,so no need wrap into padding
1.2.7 #
- add more padding value and margin value
1.2.6 #
- fixed the web cannot load image problem.
- fixed the warning of flutter lints
1.2.5 #
- add other default size,people use it should open obfuscate,let system reduce the useless code
1.1.3 #
- fixed the input widget bugs
1.1.0 #
- add the widget like input,checkbox,radio
1.0.1 #
- add some description and demo
1.0.0 #
- Initial version,