Skip to content

Commit af3d7cd

Browse files
PanteCopilot
andauthored
Misc improvements (#605)
* Add support for actions etc * Improve FSelect's error message & docs * Add item variants & prepare for 0.13.0 release * Prepare Forui for review * Update macos-latest goldens * Update windows-latest goldens * Update forui/test/src/widgets/popover_menu/popover_menu_golden_test.dart Co-authored-by: Copilot <[email protected]> * Fix failing build * Fix docs * Fix failing issues * Prepare Forui for review * Update windows-latest goldens * Fix incorrect macro ref * Fix more refs * Let's go * Prepare Forui for review * Update windows-latest goldens --------- Co-authored-by: Pante <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 5a9f264 commit af3d7cd

File tree

435 files changed

+2684
-3454
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

435 files changed

+2684
-3454
lines changed

docs/app/docs/data/item/page.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ import LinkBadgeGroup from '@/components/ui/link-badge/link-badge-group.tsx';
88

99
An item is typically used to group related information together.
1010

11+
<Callout type="info">
12+
This widget is typically used to create more complex widgets rather than being used directly.
13+
</Callout>
14+
1115
<LinkBadgeGroup>
1216
<LinkBadge label="API Reference" href="https://pub.dev/documentation/forui/latest/forui.widgets.item/"/>
1317
</LinkBadgeGroup>
@@ -56,6 +60,8 @@ FItem(
5660
onStateChange: (states) {},
5761
onPress: () {},
5862
onLongPress: () {},
63+
shortcuts: { SingleActivator(LogicalKeyboardKey.enter): ActivateIntent() },
64+
actions: { ActivateIntent: CallbackAction<ActivateIntent>(onInvoke: (_) {}) },
5965
);
6066
```
6167

@@ -74,6 +80,8 @@ FItem.raw(
7480
onStateChange: (states) {},
7581
onPress: () {},
7682
onLongPress: () {},
83+
shortcuts: { SingleActivator(LogicalKeyboardKey.enter): ActivateIntent() },
84+
actions: { ActivateIntent: CallbackAction<ActivateIntent>(onInvoke: (_) {}) },
7785
);
7886
```
7987

docs/app/docs/form/button/page.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ FButton(
4242
style: FButtonStyle(...),
4343
mainAxisSize: MainAxisSize.min,
4444
onPress: () {},
45+
shortcuts: { SingleActivator(LogicalKeyboardKey.enter): ActivateIntent() },
46+
actions: { ActivateIntent: CallbackAction<ActivateIntent>(onInvoke: (_) {}) },
4547
child: const Text('Button'),
4648
);
4749
```
@@ -52,6 +54,8 @@ FButton(
5254
FButton.raw(
5355
style: FButtonStyle(...),
5456
onPress: () {},
57+
shortcuts: { SingleActivator(LogicalKeyboardKey.enter): ActivateIntent() },
58+
actions: { ActivateIntent: CallbackAction<ActivateIntent>(onInvoke: (_) {}) },
5559
child: const Text('Button'),
5660
);
5761
```

docs/app/docs/form/select/page.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ FSelect<User>.searchFromMap(
247247
value: 'Feature',
248248
),
249249
FSelectItem.from(
250-
prefix: const Icon(FIcons.messageCircleQuestion),
250+
prefix: const Icon(FIcons.messageCircleQuestionMark),
251251
title: const Text('Question'),
252252
subtitle: const Text('A question or clarification'),
253253
value: 'Question',

docs/app/docs/foundation/tappable/page.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ const FTappable(
6060
behavior: HitTestBehavior.translucent,
6161
onPress: () {},
6262
onLongPress: () {},
63+
shortcuts: { SingleActivator(LogicalKeyboardKey.enter): ActivateIntent() },
64+
actions: { ActivateIntent: CallbackAction<ActivateIntent>(onInvoke: (_) {}) },
6365
builder: (context, state, child) => child!,
6466
child: const Text('Tappable'),
6567
);
@@ -83,6 +85,8 @@ FTappable.static(
8385
behavior: HitTestBehavior.translucent,
8486
onPress: () {},
8587
onLongPress: () {},
88+
shortcuts: { SingleActivator(LogicalKeyboardKey.enter): ActivateIntent() },
89+
actions: { ActivateIntent: CallbackAction<ActivateIntent>(onInvoke: (_) {}) },
8690
builder: (context, state, child) => child!,
8791
child: const Text('Tappable'),
8892
);

docs/app/docs/navigation/breadcrumb/page.mdx

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ It allows navigation up to any of the ancestors.
2323
FBreadcrumbItem(onPress: () {}, child: const Text('Forui')),
2424
FBreadcrumbItem.collapsed(
2525
menu: [
26-
FTileGroup(
26+
FItemGroup(
2727
children: [
28-
FTile(
28+
FItem(
2929
title: const Text('Documentation'),
3030
onPress: () {},
3131
),
32-
FTile(
32+
FItem(
3333
title: const Text('Themes'),
3434
onPress: () {},
3535
),
@@ -89,6 +89,41 @@ FBreadcrumb(
8989

9090
## Examples
9191

92+
### Tiles
93+
94+
<Tabs items={['Preview', 'Code']}>
95+
<Tabs.Tab>
96+
<Widget name='breadcrumb' variant='tiles' height={400}/>
97+
</Tabs.Tab>
98+
<Tabs.Tab>
99+
```dart {4} copy
100+
FBreadcrumb(
101+
children: [
102+
FBreadcrumbItem(onPress: () {}, child: const Text('Forui')),
103+
FBreadcrumbItem.collapsedTiles(
104+
menu: [
105+
FTileGroup(
106+
children: [
107+
FTile(
108+
title: const Text('Documentation'),
109+
onPress: () {},
110+
),
111+
FTile(
112+
title: const Text('Themes'),
113+
onPress: () {},
114+
),
115+
],
116+
),
117+
],
118+
),
119+
FBreadcrumbItem(onPress: () {}, child: const Text('Layout')),
120+
FBreadcrumbItem(current: true, child: const Text('Widgets')),
121+
],
122+
);
123+
```
124+
</Tabs.Tab>
125+
</Tabs>
126+
92127
### Custom Divider
93128

94129
<Tabs items={['Preview', 'Code']}>
@@ -109,13 +144,13 @@ FBreadcrumb(
109144
FBreadcrumbItem(onPress: () {}, child: const Text('Forui')),
110145
FBreadcrumbItem.collapsed(
111146
menu: [
112-
FTileGroup(
147+
FItemGroup(
113148
children: [
114-
FTile(
149+
FItem(
115150
title: const Text('Documentation'),
116151
onPress: () {},
117152
),
118-
FTile(
153+
FItem(
119154
title: const Text('Themes'),
120155
onPress: () {},
121156
),

docs/app/docs/navigation/sidebar/page.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,10 @@ A sidebar widget that provides an opinionated layout for navigation on the side
122122
FBreadcrumbItem(onPress: () {}, child: const Text('Forui')),
123123
FBreadcrumbItem.collapsed(
124124
menu: [
125-
FTileGroup(
125+
FItemGroup(
126126
children: [
127-
FTile(title: const Text('Documentation'), onPress: () {}),
128-
FTile(title: const Text('Themes'), onPress: () {}),
127+
FItem(title: const Text('Documentation'), onPress: () {}),
128+
FFItemTile(title: const Text('Themes'), onPress: () {}),
129129
],
130130
),
131131
],

docs/app/docs/overlay/popover-menu/page.mdx

Lines changed: 79 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ A popover menu displays a menu in a portal aligned to a child.
2626
menuAnchor: Alignment.topRight,
2727
childAnchor: Alignment.bottomRight,
2828
menu: [
29-
FTileGroup(
29+
FItemGroup(
3030
children: [
31-
FTile(prefix: const Icon(FIcons.user), title: const Text('Personalization'), onPress: () {}),
32-
FTile(prefix: const Icon(FIcons.paperclip), title: const Text('Add attachments'), onPress: () {}),
33-
FTile(prefix: const Icon(FIcons.qrCode), title: const Text('Scan Document'), onPress: () {}),
31+
FItem(prefix: const Icon(FIcons.user), title: const Text('Personalization'), onPress: () {}),
32+
FItem(prefix: const Icon(FIcons.paperclip), title: const Text('Add attachments'), onPress: () {}),
33+
FItem(prefix: const Icon(FIcons.qrCode), title: const Text('Scan Document'), onPress: () {}),
3434
],
3535
),
36-
FTileGroup(
36+
FItemGroup(
3737
children: [
38-
FTile(prefix: const Icon(FIcons.list), title: const Text('List View'), onPress: () {}),
39-
FTile(prefix: const Icon(FIcons.layoutGrid), title: const Text('Grid View'), onPress: () {}),
38+
FItem(prefix: const Icon(FIcons.list), title: const Text('List View'), onPress: () {}),
39+
FItem(prefix: const Icon(FIcons.layoutGrid), title: const Text('Grid View'), onPress: () {}),
4040
],
4141
),
4242
],
@@ -64,6 +64,35 @@ dart run forui style create popover-menu
6464

6565
```dart copy
6666
FPopoverMenu(
67+
popoverController: FPopoverController(vsync: this),
68+
scrollController: ScrollController(),
69+
style: FPopoverMenuStyle(...),
70+
cacheExtent: 100,
71+
maxHeight: 200,
72+
dragStartBehavior: DragStartBehavior.start,
73+
menuAnchor: Alignment.topCenter,
74+
childAnchor: Alignment.bottomCenter,
75+
spacing: FPortalSpacing.zero,
76+
shift: FPortalShift.flip,
77+
offset: Offset.zero,
78+
groupId: 'popover-menu-group',
79+
hideOnTapOutside: FHidePopoverRegion.excludeTarget,
80+
traversalEdgeBehavior: TraversalEdgeBehavior.closedLoop,
81+
menuBuilder: (context, controller, menu) => [FItemGroup(children: [])],
82+
menu: [
83+
FItemGroup(
84+
children: [],
85+
),
86+
],
87+
builder: (context, controller, child) => const Placeholder(),
88+
child: const Placeholder(),
89+
);
90+
```
91+
92+
### `FPopoverMenu.tiles(...)`
93+
94+
```dart copy
95+
FPopoverMenu.tiles(
6796
popoverController: FPopoverController(vsync: this),
6897
scrollController: ScrollController(),
6998
style: FPopoverMenuStyle(...),
@@ -88,3 +117,46 @@ FPopoverMenu(
88117
child: const Placeholder(),
89118
);
90119
```
120+
121+
## Examples
122+
123+
### Tiles
124+
125+
<Tabs items={['Preview', 'Code']}>
126+
<Tabs.Tab>
127+
<Widget name='popover-menu' variant='tiles' query={{}} height={500}/>
128+
</Tabs.Tab>
129+
<Tabs.Tab>
130+
```dart {6} copy
131+
class PopoverMenuPage extends StatelessWidget {
132+
@override
133+
Widget build(BuildContext context) => FHeader(
134+
title: const Text('Edit Notes'),
135+
suffixes: [
136+
FPopoverMenu.tiles(
137+
menuAnchor: Alignment.topRight,
138+
childAnchor: Alignment.bottomRight,
139+
menu: [
140+
FTileGroup(
141+
children: [
142+
FTile(prefix: const Icon(FIcons.user), title: const Text('Personalization'), onPress: () {}),
143+
FTile(prefix: const Icon(FIcons.paperclip), title: const Text('Add attachments'), onPress: () {}),
144+
FTile(prefix: const Icon(FIcons.qrCode), title: const Text('Scan Document'), onPress: () {}),
145+
],
146+
),
147+
FTileGroup(
148+
children: [
149+
FTile(prefix: const Icon(FIcons.list), title: const Text('List View'), onPress: () {}),
150+
FTile(prefix: const Icon(FIcons.layoutGrid), title: const Text('Grid View'), onPress: () {}),
151+
],
152+
),
153+
],
154+
builder: (context, controller, child) => FHeaderAction(icon: const Icon(FIcons.ellipsis), onPress: controller.toggle),
155+
),
156+
],
157+
);
158+
}
159+
```
160+
161+
</Tabs.Tab>
162+
</Tabs>

docs/app/docs/page.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ flutter pub add forui
2121

2222
Flutter does not automatically upgrade minor versions of packages prior to `1.0.0`.
2323

24-
This means that that following entry in your `pubspec.yaml` file will **not** automatically upgrade to `0.12.0`:
24+
This means that that following entry in your `pubspec.yaml` file will **not** automatically upgrade to `0.13.0`:
2525

2626
```yaml filename="pubspec.yaml"
2727
dependencies:
28-
forui: ^0.11.0 // ❌ will not upgrade to 0.12.0
28+
forui: ^0.12.0 // ❌ will not upgrade to 0.13.0
2929
```
3030
3131
To upgrade to the latest version of Forui, run the following command:

docs/app/docs/tile/select-menu-tile/page.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ FSelectMenuTile<Value>(
8888
suffix: Icon(FIcons.chevronsUpDown),
8989
onChange: (all) => print(all),
9090
onSelect: (selection) => print(selection),
91+
shortcuts: { SingleActivator(LogicalKeyboardKey.enter): ActivateIntent() },
92+
actions: { ActivateIntent: CallbackAction<ActivateIntent>(onInvoke: (_) {}) },
9193
initialValue: Value.something,
9294
menu: [
9395
FSelectTile(
@@ -134,6 +136,8 @@ FSelectMenuTile<Value>.builder(
134136
count: 100,
135137
onChange: (all) => print(all),
136138
onSelect: (selection) => print(selection),
139+
shortcuts: { SingleActivator(LogicalKeyboardKey.enter): ActivateIntent() },
140+
actions: { ActivateIntent: CallbackAction<ActivateIntent>(onInvoke: (_) {}) },
137141
);
138142
```
139143

docs/app/docs/tile/select-tile-group/page.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ FSelectTileGroup<Value>(
8686
);
8787
```
8888

89-
### `FTileGroup.builder(...)`
89+
### `FSelectTileGroup.builder(...)`
9090

9191
```dart copy
9292
FSelectTileGroup<Value>.builder(

0 commit comments

Comments
 (0)