Skip to content

Commit

Permalink
fix: only clip the button
Browse files Browse the repository at this point in the history
  • Loading branch information
Feichtmeier committed Dec 7, 2023
1 parent 1720a5c commit d4e9b92
Showing 1 changed file with 18 additions and 23 deletions.
41 changes: 18 additions & 23 deletions lib/src/widgets/yaru_title_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,16 @@ class YaruTitleBar extends StatelessWidget implements PreferredSizeWidget {
);
}

final textFieldTapRegion = TextFieldTapRegion(
final closeButton = YaruWindowControl(
platform: windowControlPlatform,
foregroundColor:
windowControlPlatform == YaruWindowControlPlatform.windows
? null
: foregroundColor,
type: YaruWindowControlType.close,
onTap: onClose != null ? () => onClose!(context) : null,
);
return TextFieldTapRegion(
child: YaruTitleBarGestureDetector(
onDrag: isDraggable == true ? (_) => onDrag?.call(context) : null,
onDoubleTap: () => isMaximizable == true
Expand Down Expand Up @@ -292,17 +301,14 @@ class YaruTitleBar extends StatelessWidget implements PreferredSizeWidget {
: null,
),
if (isClosable == true)
YaruWindowControl(
platform: windowControlPlatform,
foregroundColor: windowControlPlatform ==
YaruWindowControlPlatform.windows
? null
: foregroundColor,
type: YaruWindowControlType.close,
onTap: onClose != null
? () => onClose!(context)
: null,
),
isMaximizable == true
? closeButton
: ClipRRect(
borderRadius: const BorderRadius.only(
topRight: Radius.circular(6),
),
child: closeButton,
),
].withSpacing(bSpacing),
),
),
Expand All @@ -314,17 +320,6 @@ class YaruTitleBar extends StatelessWidget implements PreferredSizeWidget {
),
),
);

if (windowControlPlatform == YaruWindowControlPlatform.windows &&
isMaximizable == false) {
return ClipRRect(
borderRadius: const BorderRadius.only(
topRight: Radius.circular(6),
),
child: textFieldTapRegion,
);
}
return textFieldTapRegion;
}
}

Expand Down

0 comments on commit d4e9b92

Please sign in to comment.