-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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` |