Overview

Niku comes from the Japanese word "Niku" (肉) means "meat" which I originally intended to plays with the word "Yakiniku" (焼肉). Yakiniku is a Japanese-style BBQ. The person will put bite-sized meat over a flame, flipping meat to grill it until desired.

Niku is also like that. You put a slice of meat (Widget), grill it with fire (property builder) until desired, and flip (switch between builder) to grill the other side and eat (build).

Example

Niku uses property builder to compose UI in Flutter as the following:

Text("Hello World")
  .asNiku()
  .color(Colors.blue)
  .bold()

There are two types of property builder in Niku Style Builder Parent Builder

Style Builder

Style Property builder uses to compose styling on each predefined widget and only exists on some like Text, TextButton, or TextField.

To use property builder, you have to use a predefined Widget.

NikuText("Hello World")
  ..color(Colors.blue)
  ..fontSize(21);

However, you can also use .asNiku() on widgets which has the same type as a predefined Widgets.

Text("Hello World")
  .asNiku()
  ..color(Colors.blue)
  ..fontSize(21);

Parent Builder

Parent Property Builder uses to compose parent widget on where the method is called. Wrapping the widget inside the property builder as a result.

Unlike style builder, parent builder can be called on any widget which extends Widget.

To use parent builder, simply call .niku().

Text("Hello World")
  .niku()
  ..bg(Colors.blue);

Above code will return nested widget in traditional Flutter:

ColoredBox(
  color: Colors.blue,
  child: Text("Hello World"),
);