Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accordion #188

Merged
merged 60 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
61c2e56
Initial draft
Daviiddoo Sep 1, 2024
b0850d3
Almost done, How to calculate child height effectively?
Daviiddoo Sep 2, 2024
181aaea
Added custom RenderObject
Daviiddoo Sep 4, 2024
77f3a58
Fix accordion
Pante Sep 4, 2024
721bcd7
Fix hit testing
Pante Sep 4, 2024
3a3e312
Ready for checking, controller implemented
Daviiddoo Sep 11, 2024
0228115
reconfigured FAccordionController
Daviiddoo Sep 12, 2024
40d3d9e
Ready for review, Docs and Tests implemented
Daviiddoo Sep 15, 2024
55d0a4a
Update forui/lib/src/widgets/accordion.dart
Daviiddoo Sep 15, 2024
00ad586
Update forui/lib/src/widgets/accordion.dart
Daviiddoo Sep 15, 2024
850f04d
Commit from GitHub Actions (Forui Presubmit)
Daviiddoo Sep 15, 2024
a560fa9
Commit from GitHub Actions (Forui Samples Presubmit)
Daviiddoo Sep 15, 2024
3183390
fixed pr issues
Daviiddoo Sep 15, 2024
3756b3c
Update forui/lib/src/widgets/accordion.dart
Daviiddoo Sep 15, 2024
e2b9c2e
Update accordion
Pante Sep 15, 2024
345b55d
Update accordion.dart
Daviiddoo Sep 15, 2024
4a27939
Commit from GitHub Actions (Forui Presubmit)
Pante Sep 15, 2024
2ac6ec2
Sketch accordion
Pante Sep 15, 2024
d7f1265
ops
Pante Sep 15, 2024
9c5bca2
Commit from GitHub Actions (Forui Samples Presubmit)
Pante Sep 15, 2024
c9900d0
Fixed branch issues, ready to reimplement accordion group
Daviiddoo Sep 15, 2024
08e6774
Commit from GitHub Actions (Forui Presubmit)
Daviiddoo Sep 15, 2024
93c2cb1
individual controllers hooked up
Daviiddoo Sep 16, 2024
1515426
Hooked up to FAcoordion controller, RadioFAccordionController next
Daviiddoo Sep 16, 2024
6be9e14
Update installation guide (#197)
Pante Sep 19, 2024
983da2d
Accordion ready for review
Daviiddoo Sep 19, 2024
2322594
Update shown.png
Daviiddoo Sep 19, 2024
2a4f632
Apply suggestions from code review
Daviiddoo Sep 19, 2024
78b5546
Apply suggestions from code review
Daviiddoo Sep 19, 2024
fe1d45b
Fixed some issues
Daviiddoo Sep 19, 2024
7fab65d
Should we implement Inherited widget for FAcoordionItem
Daviiddoo Sep 19, 2024
9fdc4f6
new changes to be made
Daviiddoo Sep 22, 2024
1134307
Commit from GitHub Actions (Forui Presubmit)
Daviiddoo Sep 19, 2024
9a43e9c
Implemented FAccordionItemData, restructured controllers
Daviiddoo Sep 22, 2024
88c6f22
Commit from GitHub Actions (Forui Samples Presubmit)
Daviiddoo Sep 22, 2024
e7413d9
Ready for next review
Daviiddoo Sep 22, 2024
9c3b8ca
Commit from GitHub Actions (Forui Presubmit)
Daviiddoo Sep 22, 2024
51cb604
Apply suggestions from code review
Daviiddoo Sep 24, 2024
9184191
Fixed some pr issues
Daviiddoo Sep 24, 2024
9d65ee4
Commit from GitHub Actions (Forui Presubmit)
Daviiddoo Sep 24, 2024
74c7623
resolved merge conflicts
Daviiddoo Sep 24, 2024
5392c48
Tests still need rework
Daviiddoo Sep 25, 2024
5fb7303
Commit from GitHub Actions (Forui Presubmit)
Daviiddoo Sep 25, 2024
b9f4a83
Accordion ready for review, tests implemented
Daviiddoo Sep 27, 2024
a17189c
Commit from GitHub Actions (Forui Samples Presubmit)
Daviiddoo Sep 27, 2024
a1aa6f1
Commit from GitHub Actions (Forui Samples Presubmit)
Pante Sep 27, 2024
8e3cc8a
Commit from GitHub Actions (Forui Presubmit)
Pante Sep 27, 2024
01ebe95
Apply suggestions from code review
Daviiddoo Sep 29, 2024
0944ed5
Apply suggestions from code review
Daviiddoo Sep 29, 2024
78a736e
Commit from GitHub Actions (Forui Presubmit)
Daviiddoo Sep 29, 2024
d39092f
left to edit controller tests
Daviiddoo Sep 29, 2024
3c3dd5e
Merge branch 'feature/accordion' of https://github.com/forus-labs/for…
Daviiddoo Sep 29, 2024
01b79c3
Ready for review
Daviiddoo Oct 1, 2024
136495e
Merge branch 'main' into feature/accordion
Daviiddoo Oct 1, 2024
c4bbbf4
Update accordion_item.dart
Daviiddoo Oct 1, 2024
8ae0af7
Commit from GitHub Actions (Forui Presubmit)
Daviiddoo Oct 1, 2024
92fa7ba
Fixed next pr issues
Daviiddoo Oct 2, 2024
05eca3b
Apply suggestions from code review
Daviiddoo Oct 2, 2024
25e822a
Merge branch 'main' into feature/accordion
Daviiddoo Oct 2, 2024
7d14f1a
Commit from GitHub Actions (Forui Presubmit)
Daviiddoo Oct 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 142 additions & 0 deletions docs/pages/docs/accordion.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
import { Tabs } from 'nextra/components';
import { Widget } from "../../components/widget";
import LinkBadge from "../../components/link-badge/link-badge";
import LinkBadgeGroup from "../../components/link-badge/link-badge-group";

# Accordion
A vertically stacked set of interactive headings that each reveal a section of content.

<LinkBadgeGroup>
<LinkBadge label="API Reference" href="https://pub.dev/documentation/forui/latest/forui.widgets.accordion/forui.widgets.accordion-library.html"/>
</LinkBadgeGroup>

<Tabs items={['Preview', 'Code']}>
<Tabs.Tab>
<Widget name='accordion' query={{controller: 'default-max'}} height={500}/>
</Tabs.Tab>
<Tabs.Tab>
```dart
const Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
FAccordion(
controller: FAccordionController(max: 2),
items: [
FAccordionItem(
title: const Text('Is it accessible?'),
child: const Text('Yes. It adheres to the WAI-ARIA design pattern.'),
),
FAccordionItem(
initiallyExpanded: true,
title: const Text('Is it Styled?'),
child: const Text(
"Yes. It comes with default styles that matches the other components' aesthetics",
),
),
FAccordionItem(
title: const Text('Is it Animated?'),
child: const Text(
'Yes. It is animated by default, but you can disable it if you prefer',
),
),
],
),
],
);
```
</Tabs.Tab>
</Tabs>

## Usage

### `FAccordion(...)`

```dart
FAccordion(
controller: FAccordionController(min: 1, max: 2), // or FAccordionController.radio()
items: [
FAccordionItem(
title: const Text('Is it accessible?'),
child: const Text('Yes. It adheres to the WAI-ARIA design pattern.'),
),
],
),
```

## Examples

### With Radio Behaviour
<Tabs items={['Preview', 'Code']}>
<Tabs.Tab>
<Widget name='accordion' query={{controller: 'radio'}} height={500}/>
</Tabs.Tab>
<Tabs.Tab>
```dart {5}
const Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
FAccordion(
controller: FAccordionController.radio(),
items: [
FAccordionItem(
title: const Text('Is it accessible?'),
child: const Text('Yes. It adheres to the WAI-ARIA design pattern.'),
),
FAccordionItem(
title: const Text('Is it Styled?'),
initiallyExpanded: true,
child: const Text(
"Yes. It comes with default styles that matches the other components' aesthetics",
),
),
FAccordionItem(
title: const Text('Is it Animated?'),
child: const Text(
'Yes. It is animated by default, but you can disable it if you prefer',
),
),
],
),
],
);
```
</Tabs.Tab>
</Tabs>

### With Multi-select Behaviour
<Tabs items={['Preview', 'Code']}>
<Tabs.Tab>
<Widget name='accordion' query={{controller: 'default'}} height={500}/>
</Tabs.Tab>
<Tabs.Tab>
```dart {5}
const Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
FAccordion(
controller: FAccordionController(),
items: [
FAccordionItem(
title: const Text('Is it accessible?'),
child: const Text('Yes. It adheres to the WAI-ARIA design pattern.'),
),
FAccordionItem(
initiallyExpanded: true,
title: const Text('Is it Styled?'),
child: const Text(
"Yes. It comes with default styles that matches the other components' aesthetics",
),
),
FAccordionItem(
title: const Text('Is it Animated?'),
child: const Text(
'Yes. It is animated by default, but you can disable it if you prefer',
),
),
],
),
],
);
```
</Tabs.Tab>
</Tabs>
53 changes: 51 additions & 2 deletions forui/example/lib/sandbox.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,56 @@ class _SandboxState extends State<Sandbox> {
}

@override
Widget build(BuildContext context) => FSlider(
controller: FContinuousSliderController.range(selection: FSliderSelection(min: 0.30, max: 0.35)),
Widget build(BuildContext context) => Column(
children: [
FAccordion(
controller: FAccordionController(max: 2),
children: [
const FAccordionItem(
title: Text('Title 1'),
initiallyExpanded: true,
child: Text(
'Yes. It adheres to the WAI-ARIA design pattern, wfihwe fdhfiwf dfhwiodf dfwhoif',
),
),
FAccordionItem(
title: const Text('Title 2'),
child: Container(
width: 100,
color: Colors.yellow,
child: const Text(
'Yes. It adheres to the WAI-ARIA design pattern geg wjfiweo dfjiowjf dfjio',
textAlign: TextAlign.center,
),
),
),
const FAccordionItem(
title: Text('Title 3'),
child: Text(
'Yes. It adheres to the WAI-ARIA design pattern',
textAlign: TextAlign.left,
),
),
const FAccordionItem(
title: Text('Title 4'),
child: Text(
'Yes. It adheres to the WAI-ARIA design pattern',
textAlign: TextAlign.left,
),
),
],
),
const SizedBox(height: 20),
FSelectGroup(
label: const Text('Select Group'),
description: const Text('Select Group Description'),
controller: FMultiSelectGroupController(min: 1, max: 2, values: {1}),
items: [
FSelectGroupItem.checkbox(value: 1, label: const Text('Checkbox 1'), semanticLabel: 'Checkbox 1'),
FSelectGroupItem.checkbox(value: 2, label: const Text('Checkbox 2'), semanticLabel: 'Checkbox 2'),
FSelectGroupItem.checkbox(value: 3, label: const Text('Checkbox 3'), semanticLabel: 'Checkbox 3'),
],
),
],
);
}
1 change: 1 addition & 0 deletions forui/lib/forui.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export 'assets.dart';
export 'foundation.dart';
export 'theme.dart';

export 'widgets/accordion.dart';
export 'widgets/alert.dart';
export 'widgets/avatar.dart';
export 'widgets/badge.dart';
Expand Down
10 changes: 10 additions & 0 deletions forui/lib/src/theme/theme_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ final class FThemeData with Diagnosticable {
/// The style. It is used to configure the miscellaneous properties, such as border radii, of Forui widgets.
final FStyle style;

/// The accordion style.
final FAccordionStyle accordionStyle;

/// The alert styles.
final FAlertStyles alertStyles;

Expand Down Expand Up @@ -103,6 +106,7 @@ final class FThemeData with Diagnosticable {
FThemeData({
required this.colorScheme,
required this.style,
required this.accordionStyle,
required this.alertStyles,
required this.avatarStyle,
required this.badgeStyles,
Expand Down Expand Up @@ -141,6 +145,7 @@ final class FThemeData with Diagnosticable {
colorScheme: colorScheme,
typography: typography,
style: style,
accordionStyle: FAccordionStyle.inherit(colorScheme: colorScheme, typography: typography),
alertStyles: FAlertStyles.inherit(colorScheme: colorScheme, typography: typography, style: style),
avatarStyle: FAvatarStyle.inherit(colorScheme: colorScheme, typography: typography),
badgeStyles: FBadgeStyles.inherit(colorScheme: colorScheme, typography: typography, style: style),
Expand Down Expand Up @@ -214,6 +219,7 @@ final class FThemeData with Diagnosticable {
///```
@useResult
FThemeData copyWith({
FAccordionStyle? accordionStyle,
FAlertStyles? alertStyles,
FAvatarStyle? avatarStyle,
FBadgeStyles? badgeStyles,
Expand Down Expand Up @@ -242,6 +248,7 @@ final class FThemeData with Diagnosticable {
colorScheme: colorScheme,
typography: typography,
style: style,
accordionStyle: accordionStyle ?? this.accordionStyle,
alertStyles: alertStyles ?? this.alertStyles,
avatarStyle: avatarStyle ?? this.avatarStyle,
badgeStyles: badgeStyles ?? this.badgeStyles,
Expand Down Expand Up @@ -274,6 +281,7 @@ final class FThemeData with Diagnosticable {
..add(DiagnosticsProperty('colorScheme', colorScheme, level: DiagnosticLevel.debug))
..add(DiagnosticsProperty('typography', typography, level: DiagnosticLevel.debug))
..add(DiagnosticsProperty('style', style, level: DiagnosticLevel.debug))
..add(DiagnosticsProperty('accordionStyle', accordionStyle))
..add(DiagnosticsProperty('alertStyles', alertStyles, level: DiagnosticLevel.debug))
..add(DiagnosticsProperty('avatarStyle', avatarStyle, level: DiagnosticLevel.debug))
..add(DiagnosticsProperty('badgeStyles', badgeStyles, level: DiagnosticLevel.debug))
Expand Down Expand Up @@ -307,6 +315,7 @@ final class FThemeData with Diagnosticable {
colorScheme == other.colorScheme &&
typography == other.typography &&
style == other.style &&
accordionStyle == other.accordionStyle &&
alertStyles == other.alertStyles &&
avatarStyle == other.avatarStyle &&
badgeStyles == other.badgeStyles &&
Expand Down Expand Up @@ -336,6 +345,7 @@ final class FThemeData with Diagnosticable {
colorScheme.hashCode ^
typography.hashCode ^
style.hashCode ^
accordionStyle.hashCode ^
alertStyles.hashCode ^
avatarStyle.hashCode ^
badgeStyles.hashCode ^
Expand Down
Loading
Loading