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

Fix visibility of Tab's close button when onClosed is null #1159

Merged
merged 1 commit into from
Dec 20, 2024

Conversation

diluculo
Copy link
Contributor

@diluculo diluculo commented Dec 17, 2024

Added missing isClosable property to Tab widget to match WinUI 3's TabViewItem.IsClosable implementation.

The property defaults to true. When isClosable is false:

  • Close button is not shown
  • Keyboard shortcuts (Ctrl+W, Ctrl+F4) are disabled
  • I have updated CHANGELOG.md with my changes
  • I have run "dart format ." on the project
  • I have added/updated relevant documentation

@bdlukaa
Copy link
Owner

bdlukaa commented Dec 17, 2024

We use a different pattern in Flutter. If the onClose callback is null, it is automatically marked as disabled, therefore there is no need for another property.

@diluculo
Copy link
Contributor Author

diluculo commented Dec 18, 2024

Thank you for the feedback about onClosed.

I was actually trying to find a way to hide the close button in certain tabs. Looking at the current code, I noticed that the close button is shown even when onClosed is null.

To address this, I reworked it to simplify the implementation by adding a null check for onClosed.

image

As shown in the image, the first tab has onClosed = null. With the updated implementation, its close button is now properly hidden, while other tabs show their close buttons as expected. This matches the behavior of the TabView control in WinUI 3, which hides the close button when IsClosable is false.

@diluculo diluculo changed the title Add misisng isClosable property to Tab widget Fix visibility of Tab's close button when onClosed is null Dec 18, 2024
Copy link
Owner

@bdlukaa bdlukaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add it to the changelog?

- Add null check to hide close button when onClosed is null
- Update onClosed property documentation
- Add changelog entry
@diluculo
Copy link
Contributor Author

@bdlukaa, Done! I added the fix to the changelog and also squashed the commits into a single one.

@bdlukaa bdlukaa merged commit b33b510 into bdlukaa:master Dec 20, 2024
3 checks passed
@diluculo diluculo deleted the tab_isclosable branch December 20, 2024 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants