Skip to main content

flutter_tailwind 2.1.7 copy "flutter_tailwind: ^2.1.7" to clipboard
flutter_tailwind: ^2.1.7 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 .image chain: a network image's own placeholder while it loads (in place of ImageLoader.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 by ImageLoader even when an imageFactory is configured, since BaseImageFactory takes no builders.

    url.image.s36.circle.placeBuilder((_, __) => bundledFlag).errorBuilder((_, __, ___) => bundledFlag).mk
    

Fixes #

  • A network image with an errorBuilder shows it as soon as the load fails. It used to retry the URL with an uncached Image.network first and call the errorBuilder only 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. The typeNormal and typeBlur branches of ImageLoader did not forward useSingleCache, so _Image fell back to its own default (true) and passed no memCacheWidth / memCacheHeight to CachedNetworkImage. A screen with a dozen large photos decoded hundreds of MB of bitmaps at once and froze. Use .singleCache where 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). ResizeImage defaults to ResizeImagePolicy.exact, so passing both sides - as the rounded and circle-with-LayoutBuilder branches did, with height defaulting to width - squashed every non-square image into its box.
  • Circle images (ImageLoader.circle with a radius) are decoded at their diameter (radius * 2), along the width only. They were decoded at radius - 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 CachedNetworkImage for width, size, rounded, height-only, no-size, .singleCache and circle images, and the local-file circle.

2.0.1 #

Fixes #

  • Fix AutoSizeText assertion crash when using .text.fN.fM.mk (auto-shrink-to-fit text) together with a non-Identity SizeAdapter. v2.0.0's ssp() threading produced fractional values that violated AutoSizeText's stepGranularity=1 requirement. Both minFontSize and the style's fontSize are now rounded to integers after ssp(). Regression test added covering a _MockFractionalSpAdapter (mimics screenutil-on-desktop .sp factors).

2.0.0 #

Breaking changes #

  • Removed adaptW / adaptH / adaptR / adaptSp getters. Replaced by global configuration via Tailwind.instance.configSizeAdapter(...). To preserve the old behavior, write a 4-line SizeAdapter that wraps screenutil — see doc/patterns/screen-adaptation.md.
  • Removed flutter_screenutil dependency. The library no longer transitively pulls screenutil. If your project relied on the indirect export (e.g. ScreenUtilInit imported via package:flutter_tailwind), add flutter_screenutil to your own pubspec.yaml.
  • Removed Tailwind.instance.context field. init() now extracts needed values from the context immediately and does not retain it. .primary no longer needs a try-catch (the deactivated-context throw scenario cannot happen anymore).
  • p16 / p20 are now top-level getters (were final variables). Calling syntax (padding: p16) unchanged but each access now routes through SizeAdapter.

New #

  • SizeAdapter abstract class — 4-method interface (w/h/r/sp) that decouples the library from any specific screen-adaptation package. Default IdentitySizeAdapter (no scaling).
  • Tailwind.instance.screenW / screenH — cached screen dimensions populated by init(context). Used internally by the hFull/wFull family; also exposed for user code.
  • Tailwind.instance.configSizeAdapter(adapter) — install your scaling implementation, typically once at app startup.

Migration (1.x → 2.0) #

  1. Remove every .adaptW/.adaptH/.adaptR/.adaptSp call from your code.
  2. 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(...);
    }
    
  3. If you used hFull/wFull-family getters, call Tailwind.instance.init(context) from inside MaterialApp.builder (or any context inside MaterialApp).

1.8.0 #

  • Tailwind.instance.primary no longer throws Looking up a deactivated widget's ancestor is unsafe when accessed after the holding widget has been disposed; it now falls back to primaryColor ?? Colors.amber. Added 5 widget tests covering init/no-init/disposal scenarios — the first real unit tests in this repo.
  • Replaced deprecated Color.withOpacity with Color.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 position
    • doc/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..spacing32 shortcuts vs manual spacers
  • .cursor/rules/flutter_tailwind.mdc fixed several stale teachings:
    • Removed the recommendation to run flutter packages pub run build_runner build (this library does not use build_runner)
    • Rewrote the Tailwind.instance.init(context) example — init must be called from inside MaterialApp, not from ScreenUtilInit.builder (the context there is above MaterialApp, so Theme.of returns ThemeData.fallback() instead of your theme — .primary ends up the wrong color)
  • README adds a documentation-navigation section at the top and an explicit note that this library does not use build_runner.
  • guide.md adds a migration banner pointing at doc/.

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,
9
likes
140
points
1.37k
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

I hope to make something like tailwind that can simplify the description of style and improve efficiency.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (license)

Dependencies

auto_size_text, cached_network_image, flutter, flutter_cache_manager, flutter_staggered_grid_view, flutter_svg, shimmer

More

Packages that depend on flutter_tailwind