Skip to content

Commit

Permalink
Merge branch 'main' into feature/ui-pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
Daviiddoo committed Jan 31, 2025
2 parents c29ea8e + 7a6b9e3 commit df7c8e2
Show file tree
Hide file tree
Showing 41 changed files with 1,591 additions and 134 deletions.
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"homepage": "https://forui.dev",
"dependencies": {
"clsx": "^2.1.1",
"lucide-react": "^0.473.0",
"lucide-react": "^0.474.0",
"next": "^15.0.0",
"nextra": "^3.0.8",
"nextra-theme-docs": "^3.0.8",
Expand All @@ -24,7 +24,7 @@
"tailwind-merge": "^2.5.2"
},
"devDependencies": {
"@types/node": "22.10.7",
"@types/node": "22.12.0",
"autoprefixer": "^10.4.20",
"postcss": "^8.4.47",
"tailwindcss": "^3.4.13",
Expand Down
File renamed without changes.
210 changes: 210 additions & 0 deletions docs/pages/docs/form/picker.mdx
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>

20 changes: 10 additions & 10 deletions docs/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions forui/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

* Add `FDatePicker`.
* Add `FFormProperties`.
* Add `FPicker`.
* Add `FPopoverTagRegion`.
* Add `FBreadcrumb`.
* Add `FTextField.builder`.
Expand Down Expand Up @@ -39,6 +40,7 @@
* Fix `FCalendar` rebuilding whenever the given `initialType` and/or `initialMonth` changes.
* Fix `FCalendar`'s day picker not updating when a new start and/or end date is given.
* Fix `FPopover` not handling focus changes in popover properly.
* Fix `FTabs`'s scrollable alignment not being correct.
* Fix `FTappable` remaining in a hovered or touched state when its `onPress`/`onLongPress` callbacks were nulled after being non-null.
* Fix `FTextField` ignoring `enableInteractiveSelection` parameter.
* Fix `FTextField` ignoring `FTextFieldStyle.cursorColor`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
2 changes: 1 addition & 1 deletion forui/example/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pluginManagement {
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version '8.8.0' apply false
id "org.jetbrains.kotlin.android" version "2.1.0" apply false
id "org.jetbrains.kotlin.android" version "2.1.10" apply false
}

include ":app"
Loading

0 comments on commit df7c8e2

Please sign in to comment.