Skip to content

Commit

Permalink
docs: order policy
Browse files Browse the repository at this point in the history
  • Loading branch information
nank1ro committed Jan 7, 2025
1 parent 20672ee commit 94c6ed5
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions docs/src/content/docs/Utils/order_policy.md
Original file line number Diff line number Diff line change
@@ -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`

0 comments on commit 94c6ed5

Please sign in to comment.