-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/ui-pagination
- Loading branch information
Showing
41 changed files
with
1,591 additions
and
134 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
File renamed without changes.
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,210 @@ | ||
import { Callout, Tabs } from 'nextra/components'; | ||
import { Widget } from "../../../components/widget.tsx"; | ||
import LinkBadge from "../../../components/link-badge/link-badge.tsx"; | ||
import LinkBadgeGroup from "../../../components/link-badge/link-badge-group.tsx"; | ||
|
||
# Picker | ||
|
||
A generic picker that allows an item to be selected. It is composed of one or more wheels, optionally, with separators | ||
between those wheels. | ||
|
||
The picker supports arrow key navigation: | ||
* Up/Down arrows: Increment/decrement selected value | ||
* Left/Right arrows: Move between wheels | ||
|
||
Recommended for touch devices. | ||
|
||
<LinkBadgeGroup> | ||
<LinkBadge label="API Reference" href="https://pub.dev/documentation/forui/latest/forui.widgets.picker/"/> | ||
</LinkBadgeGroup> | ||
|
||
<Tabs items={['Preview', 'Code']}> | ||
<Tabs.Tab> | ||
<Widget name='picker' query={{}}/> | ||
</Tabs.Tab> | ||
<Tabs.Tab> | ||
```dart copy | ||
const FPicker( | ||
children: [ | ||
FPickerWheel( | ||
children: [ | ||
Text('January'), | ||
Text('February'), | ||
Text('March'), | ||
Text('April'), | ||
Text('May'), | ||
Text('June'), | ||
Text('July'), | ||
Text('August'), | ||
Text('September'), | ||
Text('October'), | ||
Text('November'), | ||
Text('December'), | ||
], | ||
), | ||
], | ||
); | ||
``` | ||
</Tabs.Tab> | ||
</Tabs> | ||
|
||
## Usage | ||
|
||
### `FPicker(...)` | ||
|
||
```dart copy | ||
const FPicker( | ||
controller: FPickerController(), | ||
style: style, | ||
children: [ | ||
const FPickerWheel( | ||
flex: 2, | ||
loop: true, | ||
itemExtent: 20, | ||
autofocus: true, | ||
focusNode: FocusNode(), | ||
onFocusChange: (focused) {}, | ||
children: [ | ||
Text('1'), | ||
Text('2'), | ||
], | ||
), | ||
const FPickerWheel( | ||
flex: 2, | ||
itemExtent: 20, | ||
autofocus: true, | ||
focusNode: FocusNode(), | ||
onFocusChange: (focused) {}, | ||
builder: (context, index) => Text('$1'), | ||
), | ||
], | ||
); | ||
``` | ||
|
||
## Examples | ||
|
||
### Loop | ||
|
||
<Tabs items={['Preview', 'Code']}> | ||
<Tabs.Tab> | ||
<Widget name='picker' query={{loop: 'true'}}/> | ||
</Tabs.Tab> | ||
<Tabs.Tab> | ||
```dart {4} copy | ||
const FPicker( | ||
children: [ | ||
FPickerWheel( | ||
loop: true, | ||
children: [ | ||
Text('January'), | ||
Text('February'), | ||
Text('March'), | ||
Text('April'), | ||
Text('May'), | ||
Text('June'), | ||
Text('July'), | ||
Text('August'), | ||
Text('September'), | ||
Text('October'), | ||
Text('November'), | ||
Text('December'), | ||
], | ||
), | ||
], | ||
); | ||
``` | ||
</Tabs.Tab> | ||
</Tabs> | ||
|
||
### Lazy | ||
|
||
<Tabs items={['Preview', 'Code']}> | ||
<Tabs.Tab> | ||
<Widget name='picker' query={{builder: 'true'}}/> | ||
</Tabs.Tab> | ||
<Tabs.Tab> | ||
```dart {3-5} copy | ||
const FPicker( | ||
children: [ | ||
FPickerWheel.builder( | ||
builder: (context, index) => Text('$index'), | ||
), | ||
], | ||
); | ||
``` | ||
</Tabs.Tab> | ||
</Tabs> | ||
|
||
### Multiple Wheels | ||
|
||
<Tabs items={['Preview', 'Code']}> | ||
<Tabs.Tab> | ||
<Widget name='picker' variant='multiple'/> | ||
</Tabs.Tab> | ||
<Tabs.Tab> | ||
```dart copy | ||
SizedBox( | ||
width: 200, | ||
child: FPicker( | ||
children: [ | ||
const FPickerWheel( | ||
flex: 3, | ||
loop: true, | ||
children: [ | ||
Text('January'), | ||
Text('February'), | ||
Text('March'), | ||
Text('April'), | ||
Text('May'), | ||
Text('June'), | ||
Text('July'), | ||
Text('August'), | ||
Text('September'), | ||
Text('October'), | ||
Text('November'), | ||
Text('December'), | ||
], | ||
), | ||
FPickerWheel.builder( | ||
flex: 2, | ||
builder: (context, index) => Text('${(index % 31) + 1}'), | ||
), | ||
], | ||
), | ||
); | ||
``` | ||
</Tabs.Tab> | ||
</Tabs> | ||
|
||
### With Separators | ||
|
||
<Tabs items={['Preview', 'Code']}> | ||
<Tabs.Tab> | ||
<Widget name='picker' variant='separator'/> | ||
</Tabs.Tab> | ||
<Tabs.Tab> | ||
```dart {3-5} copy | ||
SizedBox( | ||
width: 200, | ||
child: FPicker( | ||
children: [ | ||
FPickerWheel.builder( | ||
builder: (context, index) => Text((index % 12).toString().padLeft(2, '0')), | ||
), | ||
const Text(':'), | ||
FPickerWheel.builder( | ||
builder: (context, index) => Text((index % 60).toString().padLeft(2, '0')), | ||
), | ||
const FPickerWheel( | ||
children: [ | ||
Text('AM'), | ||
Text('PM'), | ||
], | ||
), | ||
], | ||
), | ||
); | ||
``` | ||
</Tabs.Tab> | ||
</Tabs> | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
Oops, something went wrong.