Skip to content

Commit

Permalink
smal fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tilucasoli committed Dec 18, 2024
1 parent 5d7e585 commit 0a7f341
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ class Accordion extends StatefulWidget {
super.key,
required this.header,
required this.content,
required this.onChanged,
this.expanded = false,
this.onChanged,
this.expanded = true,
this.variants = const [],
this.style,
});
Expand All @@ -16,7 +16,7 @@ class Accordion extends StatefulWidget {
final AccordionStyle? style;
final bool expanded;
final List<Variant> variants;
final void Function(bool) onChanged;
final void Function(bool)? onChanged;

@override
State<Accordion> createState() => _AccordionState();
Expand All @@ -33,7 +33,7 @@ class _AccordionState extends State<Accordion> {

void _handleTap() {
_controller.selected = !_controller.selected;
widget.onChanged(widget.expanded);
widget.onChanged?.call(widget.expanded);
}

@override
Expand Down
10 changes: 4 additions & 6 deletions packages/remix/lib/src/themes/fortaleza/tokens.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,8 @@ class FortalezaTokens {
neutral: RadixColors.slate.swatch,
neutralAlpha: RadixColors.slate.alphaSwatch,
),
radii: FortalezaRadius.values(
[4, 8, 12, 16, 24, 32],
),
spaces: FortalezaSpace.values(
[4, 8, 12, 16, 24, 32, 40, 48, 64],
),
radii: FortalezaRadius.values([4, 8, 12, 16, 24, 32]),
spaces: FortalezaSpace.values([4, 8, 12, 16, 24, 32, 40, 48, 64]),
textStyles: const FortalezaTextStyle(
text1: TextStyle(fontSize: 12, letterSpacing: 0.0025, height: 1.33),
text2: TextStyle(fontSize: 14, letterSpacing: 0, height: 1.43),
Expand Down Expand Up @@ -132,6 +128,7 @@ class FortalezaRadius {

factory FortalezaRadius.values(List<double> values) {
assert(values.length == 6, 'Expected 6 values, got ${values.length}');

return FortalezaRadius(
radius1: Radius.circular(values[0]),
radius2: Radius.circular(values[1]),
Expand Down Expand Up @@ -171,6 +168,7 @@ class FortalezaSpace {

factory FortalezaSpace.values(List<double> values) {
assert(values.length == 9, 'Expected 9 values, got ${values.length}');

return FortalezaSpace(
space1: values[0],
space2: values[1],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// This is a generated file; do not edit or check into version control.
FLUTTER_ROOT=/Users/lucasoliveira/fvm/versions/stable
FLUTTER_APPLICATION_PATH=/Users/lucasoliveira/Developer/Concepta/open_source/mix_ecosystem/mix/packages/remix
FLUTTER_APPLICATION_PATH=/Users/lucasoliveira/Developer/Mix/PoCs/remix_toast/packages/mix/packages/remix
COCOAPODS_PARALLEL_CODE_SIGN=true
FLUTTER_BUILD_DIR=build
FLUTTER_BUILD_NAME=0.0.2
FLUTTER_BUILD_NUMBER=5
FLUTTER_BUILD_NAME=0.0.3
FLUTTER_BUILD_NUMBER=0.0.3
DART_OBFUSCATION=false
TRACK_WIDGET_CREATION=true
TREE_SHAKE_ICONS=false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/Users/lucasoliveira/fvm/versions/stable"
export "FLUTTER_APPLICATION_PATH=/Users/lucasoliveira/Developer/Concepta/open_source/mix_ecosystem/mix/packages/remix"
export "FLUTTER_APPLICATION_PATH=/Users/lucasoliveira/Developer/Mix/PoCs/remix_toast/packages/mix/packages/remix"
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
export "FLUTTER_BUILD_DIR=build"
export "FLUTTER_BUILD_NAME=0.0.2"
export "FLUTTER_BUILD_NUMBER=5"
export "FLUTTER_BUILD_NAME=0.0.3"
export "FLUTTER_BUILD_NUMBER=0.0.3"
export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=true"
export "TREE_SHAKE_ICONS=false"
Expand Down
56 changes: 24 additions & 32 deletions packages/remix/test/components/accordion/accordion_widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,40 @@ import 'package:remix/remix.dart';

void main() {
group('XAccordion', () {
testWidgets('renders with required properties',
(WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: Accordion(
style: const AccordionStyle(),
header: (spec) => AccordionHeaderSpecWidget(
title: 'Test Accordion',
spec: spec,
),
content: (spec) => TextSpecWidget(
'Accordion Content',
spec: spec,
testWidgets(
'renders with required properties',
(WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: Accordion(
header: (spec) => AccordionHeaderSpecWidget(
spec: spec,
title: 'Test Accordion',
),
content: const Text('Accordion Content'),
expanded: true,
style: const AccordionStyle(),
),
),
),
);
);

expect(find.text('Test Accordion'), findsOneWidget);
expect(find.text('Accordion Content'), findsOneWidget);
});
expect(find.text('Test Accordion'), findsOneWidget);
expect(find.text('Accordion Content'), findsOneWidget);
},
);

testWidgets('renders with custom icons', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: Accordion(
style: const AccordionStyle(),
header: (spec) => AccordionHeaderSpecWidget(
title: 'Custom Icons',
spec: spec,
leadingIcon: Icons.star,
title: 'Custom Icons',
trailingIcon: Icons.arrow_drop_down,
),
content: (spec) => TextSpecWidget(
'Content',
spec: spec,
),
content: const Text('Content'),
style: const AccordionStyle(),
),
),
);
Expand Down Expand Up @@ -77,10 +74,7 @@ void main() {
title: 'Styled Accordion',
trailingIcon: Icons.rocket_launch,
),
content: (spec) => TextSpecWidget(
'Styled Content',
spec: spec,
),
content: const Text('Styled Content'),
style: const FakeAccordionStyle(color),
),
),
Expand All @@ -104,9 +98,7 @@ class FakeAccordionStyle extends AccordionStyle {
final $ = spec.utilities;

final baseStyle = super.makeStyle(spec);
return Style.create([
baseStyle(),
$.header.trailingIcon.color(color),
]);

return Style.create([baseStyle(), $.header.trailingIcon.color(color)]);
}
}

0 comments on commit 0a7f341

Please sign in to comment.