jaspr-declarative-tailwind

A declarative Tailwind class generator written in dart

dart pub add jaspr-declarative-tailwind

Usage

Wherever you may need Tailwind classes instantiate a TWClassList

//example with Jaspr's DomComponent
DomComponent(tag: "p", classes: TWClassList(generators: ));

The package provides a declarative interface to Tailwind's utility classes categorized by many common use cases in the form of TWGenerators

i.e

//example with flex styling in the layout generator
 DomComponent(
      tag: "p",
      classes: TWClassList(
          generators: TWGenerators.layout(flex: TWFlexValue.flexAuto)));

How does this work? Well, TwClass list is a descendant of the ListBase

i.e

 //this will work!
 List<String> classes = TWClassList(
          generators: TWGenerators.layout(flex: TWFlexValue.flexAuto));

If you need a super-string of all classes, We have overrided to the toString method

  print(TWClassList(
          generators: TWGenerators.layout(flex: TWFlexValue.flexAuto)));

  // output: 'flex flex-auto'