docs(ui_kit): add theme negociation explaination

This commit is contained in:
Hugo Pointcheval 2023-02-14 14:20:00 +01:00
parent c942e2aacf
commit bd636e9d24
Signed by: hugo
GPG Key ID: 3AAC487E131E00BC

View File

@ -25,6 +25,21 @@
UIKit and Design System used in Wyatt Studio.
## Theme negociation
When building a component, most of its attributes can be 'null'.
The `build()` method then starts to negotiate the theme in the tree to obtain the most consistent style possible.
Explanation:
When you build a component `Button({double? radius})`.
You have several possibilities:
1) Pass the "radius" into the constructor, `Button(radius: 12)`.
2) Set up a theme extension `ButtonThemeExtension(radius: 15)`.
3) Let `wyatt_ui_kit` "negotiate" and try to find a suitable style in the flutter theme. If this negotiation phase fails, then the style is simply not applied.
If, for example, you don't use option 1, then the radius will be 15. If you use neither option 1 nor option 2 then the radius will be 4 as this is the [official Material Design value](https://m2.material.io/design/shape/about-shape.html#shape-customization-tool).
## Features
TODO: List what your package can do. Maybe include images, gifs, or videos.