Skip to content

Commit

Permalink
Merge pull request #1082 from WXL-steven/fix/pane-item-expander-flyout
Browse files Browse the repository at this point in the history
fix: `PaneItem` Behavior in Compact Mode (#1082)
  • Loading branch information
bdlukaa committed Jul 8, 2024
2 parents c89f168 + 7ec07b3 commit dfc2044
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## NEXT
* fix: Resolved issue where `PaneItem` within `PaneItemExpander` remained accessible in `NavigationPane` compact mode ([#1081](https://github.com/bdlukaa/fluent_ui/issues/1081))

## 4.9.0

* fix: ¹ `DropDownButton.closeAfterClick` is now correctly applied. ² Added `MenuFlyoutItem.closeAfterClick`, which defaults to `true`. ([#1016](https://github.com/bdlukaa/fluent_ui/issues/1016))
Expand Down
25 changes: 22 additions & 3 deletions lib/src/controls/navigation/navigation_view/pane_items.dart
Original file line number Diff line number Diff line change
Expand Up @@ -927,13 +927,26 @@ class _PaneItemExpanderMenuItem extends MenuFlyoutItemBase {
Widget build(BuildContext context) {
assert(debugCheckHasFluentTheme(context));
final theme = FluentTheme.of(context);
final navigationTheme = NavigationPaneTheme.of(context);
final size = Flyout.of(context).size;
return Container(
width: size.isEmpty ? null : size.width,
padding: MenuFlyout.itemsPadding,
child: HoverButton(
onPressed: onPressed,
onPressed: item.enabled ? onPressed : null,
forceEnabled: item.enabled,
builder: (context, states) {
final textStyle = (isSelected
? navigationTheme.selectedTextStyle?.resolve(states)
: navigationTheme.unselectedTextStyle?.resolve(states)) ??
const TextStyle();
final iconTheme = IconThemeData(
color: textStyle.color ??
(isSelected
? navigationTheme.selectedIconColor?.resolve(states)
: navigationTheme.unselectedIconColor?.resolve(states)),
size: textStyle.fontSize ?? 16.0,
);
return Container(
padding: const EdgeInsets.symmetric(
horizontal: 10.0,
Expand All @@ -951,11 +964,17 @@ class _PaneItemExpanderMenuItem extends MenuFlyoutItemBase {
child: Row(mainAxisSize: MainAxisSize.min, children: [
Padding(
padding: const EdgeInsetsDirectional.only(end: 12.0),
child: item.icon,
child: IconTheme.merge(
data: iconTheme,
child: item.icon,
),
),
Flexible(
fit: size.isEmpty ? FlexFit.loose : FlexFit.tight,
child: item.title ?? const SizedBox.shrink(),
child: DefaultTextStyle(
style: textStyle,
child: item.title ?? const SizedBox.shrink(),
),
),
if (item.infoBadge != null)
Padding(
Expand Down

0 comments on commit dfc2044

Please sign in to comment.