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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- fix: `NavigationView` auto display mode no longer shows a brief overlay when resizing from minimal to compact mode ([#1316](https://github.com/bdlukaa/fluent_ui/pull/1316))
- fix: `MenuFlyout` sub-item tree now correctly expands to the left and shows a `chevron_left` icon when right-to-left directionality is enabled ([#1342](https://github.com/bdlukaa/fluent_ui/issues/1342))
- fix: `NavigationView` compact pane `PaneItemExpander` flyout is now correctly placed in right-to-left directionality; Flyout `leftTop` and `rightTop` placement modes now correctly align with the top of the target element when the flyout is taller than the available space above the target ([#1289](https://github.com/bdlukaa/fluent_ui/issues/1289))
- fix: `Tab` in `TabView` is now draggable from its entire area, including the padding ([#1356](https://github.com/bdlukaa/fluent_ui/issues/1356))

## 4.15.0

Expand Down
234 changes: 116 additions & 118 deletions lib/src/controls/navigation/tab_view/tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -367,132 +367,130 @@ class TabState extends State<Tab>
}).resolve(states);

const borderRadius = BorderRadius.vertical(top: Radius.circular(6));
Widget child = FocusBorder(
focused: states.isFocused,
renderOutside: false,
style: const FocusThemeData(borderRadius: borderRadius),
child: Container(
key: widget._tabKey,
height: _kTileHeight,
constraints: tab.tabWidthBehavior == TabWidthBehavior.sizeToContent
? const BoxConstraints(minHeight: 28)
: const BoxConstraints(maxWidth: _kMaxTileWidth, minHeight: 28),
padding: tab.selected
? const EdgeInsetsDirectional.only(
start: 9,
top: 3,
end: 5,
bottom: 4,
)
: const EdgeInsetsDirectional.only(
start: 8,
top: 3,
end: 4,
bottom: 3,
),
decoration: BoxDecoration(
borderRadius: borderRadius,
// if selected, the background is painted by _TabPainter
color:
(tab.selected
? widget.selectedBackgroundColor
: widget.backgroundColor)
?.resolve(states) ??
backgroundColor,
),
child: () {
final result = ClipRect(
child: DefaultTextStyle.merge(
style: (theme.typography.body ?? const TextStyle()).copyWith(
fontSize: 12,
fontWeight: tab.selected ? FontWeight.w600 : null,
color:
(tab.selected
? widget.selectedForegroundColor
: widget.foregroundColor)
?.resolve(states) ??
foregroundColor,
),
child: IconTheme.merge(
data: IconThemeData(
color:
(tab.selected
? widget.selectedForegroundColor
: widget.foregroundColor)
?.resolve(states) ??
foregroundColor,
size: 16,
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (widget.icon != null)
Padding(
padding: const EdgeInsetsDirectional.only(end: 10),
child: widget.icon,
),
if (tab.tabWidthBehavior != TabWidthBehavior.compact ||
(tab.tabWidthBehavior == TabWidthBehavior.compact &&
tab.selected))
Flexible(
fit: tab.tabWidthBehavior == TabWidthBehavior.equal
? FlexFit.tight
: FlexFit.loose,
child: Padding(
padding: const EdgeInsetsDirectional.only(end: 4),
child: DefaultTextStyle.merge(
softWrap: false,
maxLines: 1,
overflow: TextOverflow.clip,
style: const TextStyle(fontSize: 12),
child: widget.text,
),
),
Widget tabContainer = Container(
key: widget._tabKey,
height: _kTileHeight,
constraints: tab.tabWidthBehavior == TabWidthBehavior.sizeToContent
? const BoxConstraints(minHeight: 28)
: const BoxConstraints(maxWidth: _kMaxTileWidth, minHeight: 28),
padding: tab.selected
? const EdgeInsetsDirectional.only(
start: 9,
top: 3,
end: 5,
bottom: 4,
)
: const EdgeInsetsDirectional.only(
start: 8,
top: 3,
end: 4,
bottom: 3,
),
decoration: BoxDecoration(
borderRadius: borderRadius,
// if selected, the background is painted by _TabPainter
color:
(tab.selected
? widget.selectedBackgroundColor
: widget.backgroundColor)
?.resolve(states) ??
backgroundColor,
),
child: ClipRect(
child: DefaultTextStyle.merge(
style: (theme.typography.body ?? const TextStyle()).copyWith(
fontSize: 12,
fontWeight: tab.selected ? FontWeight.w600 : null,
color:
(tab.selected
? widget.selectedForegroundColor
: widget.foregroundColor)
?.resolve(states) ??
foregroundColor,
),
child: IconTheme.merge(
data: IconThemeData(
color:
(tab.selected
? widget.selectedForegroundColor
: widget.foregroundColor)
?.resolve(states) ??
foregroundColor,
size: 16,
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (widget.icon != null)
Padding(
padding: const EdgeInsetsDirectional.only(end: 10),
child: widget.icon,
),
if (tab.tabWidthBehavior != TabWidthBehavior.compact ||
(tab.tabWidthBehavior == TabWidthBehavior.compact &&
tab.selected))
Flexible(
fit: tab.tabWidthBehavior == TabWidthBehavior.equal
? FlexFit.tight
: FlexFit.loose,
child: Padding(
padding: const EdgeInsetsDirectional.only(end: 4),
child: DefaultTextStyle.merge(
softWrap: false,
maxLines: 1,
overflow: TextOverflow.clip,
style: const TextStyle(fontSize: 12),
child: widget.text,
),
if (widget.onClosed != null &&
widget.closeIcon != null &&
),
),
if (widget.onClosed != null &&
widget.closeIcon != null &&
(tab.visibilityMode ==
CloseButtonVisibilityMode.always ||
(tab.visibilityMode ==
CloseButtonVisibilityMode.always ||
(tab.visibilityMode ==
CloseButtonVisibilityMode.onHover &&
states.isHovered)))
Padding(
padding: const EdgeInsetsDirectional.only(start: 4),
child: FocusTheme(
data: const FocusThemeData(
primaryBorder: BorderSide.none,
secondaryBorder: BorderSide.none,
),
child: Tooltip(
message: localizations.closeTabLabel,
child: SizedBox(
height: 24,
width: 32,
child: IconButton(
icon: widget.closeIcon!,
onPressed: tab.onClose,
focusable: false,
),
),
CloseButtonVisibilityMode.onHover &&
states.isHovered)))
Padding(
padding: const EdgeInsetsDirectional.only(start: 4),
child: FocusTheme(
data: const FocusThemeData(
primaryBorder: BorderSide.none,
secondaryBorder: BorderSide.none,
),
child: Tooltip(
message: localizations.closeTabLabel,
child: SizedBox(
height: 24,
width: 32,
child: IconButton(
icon: widget.closeIcon!,
onPressed: tab.onClose,
focusable: false,
),
),
),
],
),
),
),
),
],
),
);
if (tab.reorderIndex != null) {
return ReorderableDragStartListener(
index: tab.reorderIndex!,
enabled: !widget.disabled,
child: result,
);
}
return result;
}(),
),
),
),
);
if (tab.reorderIndex != null) {
tabContainer = ReorderableDragStartListener(
index: tab.reorderIndex!,
enabled: !widget.disabled,
child: tabContainer,
);
}
Widget child = FocusBorder(
focused: states.isFocused,
renderOutside: false,
style: const FocusThemeData(borderRadius: borderRadius),
child: tabContainer,
);
if (text != null) {
child = Tooltip(
message: text,
Expand Down
Loading