Skip to content

Commit

Permalink
fix: Visibility of Tab's close button when Tab.onClosed is null
Browse files Browse the repository at this point in the history
  • Loading branch information
bdlukaa authored Dec 20, 2024
2 parents ad8cad8 + 827d32c commit b33b510
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [next]

- fix: hide Tab's close button when `onClosed` is null

## 4.10.0

- fix: Add missing properties (`closeIconSize`, `closeButtonStyle`) in `debugFillProperties` and `InfoBarThemeData.merge` ([#1128](https://github.com/bdlukaa/fluent_ui/issues/1128)
Expand Down
7 changes: 4 additions & 3 deletions lib/src/controls/navigation/tab_view/tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,10 @@ class Tab extends StatefulWidget {
/// Usually an [Icon] widget.
final Widget? closeIcon;

/// Called when clicking x-to-close button or when thec`Ctrl + T` or
/// Called when clicking x-to-close button or when the `Ctrl + T` or
/// `Ctrl + F4` is executed
///
/// If null, the tab is not closeable
/// If null, the tab is not closeable and the close button will not be shown.
final VoidCallback? onClosed;

/// {@macro fluent_ui.controls.inputs.HoverButton.semanticLabel}
Expand Down Expand Up @@ -405,7 +405,8 @@ class TabState extends State<Tab>
),
),
),
if (widget.closeIcon != null &&
if (widget.onClosed != null &&
widget.closeIcon != null &&
(tab.visibilityMode ==
CloseButtonVisibilityMode.always ||
(tab.visibilityMode ==
Expand Down

0 comments on commit b33b510

Please sign in to comment.