Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [2.2.2]
### 🛠 Fixed 🛠
- Fixed setState called after dispose issue in MacosPulldownButton.

## [2.2.1]
### 🔄 Updated 🔄
* Wrap toolbar items with `MacosToolbarPassthrough` to prevent window move or resize when interacting with toolbar items.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/buttons/pulldown_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -835,9 +835,9 @@ class _MacosPulldownButtonState extends State<MacosPulldownButton>
);

navigator.push(_pulldownRoute!).then<void>((_) {
if (!mounted) return;
setState(() => _pullDownButtonState = PulldownButtonState.enabled);
_removeMacosPulldownRoute();
if (!mounted) return;
});

widget.onTap?.call();
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: macos_ui
description: Flutter widgets and themes implementing the current macOS design language.
version: 2.2.1
version: 2.2.2
homepage: "https://macosui.dev"
repository: "https://github.com/GroovinChip/macos_ui"

Expand Down
42 changes: 42 additions & 0 deletions test/buttons/pulldown_button_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,48 @@ void main() {
expect(mockOnPressedFunction.called, 2);
});

testWidgets('MacosPulldownButton displays correctly items ',
(WidgetTester tester) async {
await tester.pumpWidget(MacosApp(
home: MacosWindow(
child: MacosScaffold(
children: [
ContentArea(
builder: (context, _) {
return Center(
child: MacosPulldownButton(
title: "Menu",
items: [
MacosPulldownMenuItem(
title: const Text('New folder'),
onTap: () {},
),
MacosPulldownMenuItem(
title: const Text('Document'),
onTap: () {},
),
],
),
);
},
),
],
),
),
));

// Verify that the title is rendered on the button.
expect(find.text('Menu'), findsOneWidget);

// tap on the button to open the pulldown menu.
await tester.tap(find.text('Menu'));
await tester.pumpAndSettle();

// Verify that the menu items are displayed.
expect(find.text('New folder'), findsOneWidget);
expect(find.text('Document'), findsOneWidget);
});

testWidgets(
'MacosPulldownButtonItems\' onTap callback is called when defined',
(WidgetTester tester) async {
Expand Down
Loading