From 94c6ed5c000814d1e885d30861bd55957948136d Mon Sep 17 00:00:00 2001 From: Alexandru Mariuti Date: Tue, 7 Jan 2025 17:17:37 +0100 Subject: [PATCH] docs: order policy --- docs/src/content/docs/Utils/order_policy.md | 35 +++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 docs/src/content/docs/Utils/order_policy.md diff --git a/docs/src/content/docs/Utils/order_policy.md b/docs/src/content/docs/Utils/order_policy.md new file mode 100644 index 00000000..e7d5c636 --- /dev/null +++ b/docs/src/content/docs/Utils/order_policy.md @@ -0,0 +1,35 @@ +--- +title: OrderPolicy +sidebar: + order: 5 +--- + +The **OrderPolicy** class handles the order of the items in a list. +It can be very useful to update the order of how items of a shadcn component are rendered. + +For example to place the child of a button before the icon you can write: + +```diff lang=dart +ShadButton( + icon: const Icon( + Icons.mail_outlined, + size: 16, + ), ++ orderPolicy: const WidgetOrderPolicy.reverse(), + child: const Text('Login with Email'), +) +``` + +## LinearOrderPolicy + +The default, keeps the order of the items as they are. + +## ReverseOrderPolicy + +Reverses the order of the items + +## CustomOrderPolicy + +A custom order policy, orders the items based on the provided indexes. +For example an indexes value of `2, 0, 1` will order the items as follows: +`last, first, second`