Skip to content

Commit

Permalink
fix(YaruTitleBar): windows close button color and clipping (#820)
Browse files Browse the repository at this point in the history
  • Loading branch information
Feichtmeier authored Dec 22, 2023
1 parent 3f86f3c commit 62937cd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
7 changes: 6 additions & 1 deletion example/windows/flutter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ include(${EPHEMERAL_DIR}/generated_config.cmake)
# https://github.com/flutter/flutter/issues/57146.
set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")

# Set fallback configurations for older versions of the flutter tool.
if (NOT DEFINED FLUTTER_TARGET_PLATFORM)
set(FLUTTER_TARGET_PLATFORM "windows-x64")
endif()

# === Flutter Library ===
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")

Expand Down Expand Up @@ -92,7 +97,7 @@ add_custom_command(
COMMAND ${CMAKE_COMMAND} -E env
${FLUTTER_TOOL_ENVIRONMENT}
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
windows-x64 $<CONFIG>
${FLUTTER_TARGET_PLATFORM} $<CONFIG>
VERBATIM
)
add_custom_target(flutter_assemble DEPENDS
Expand Down
27 changes: 18 additions & 9 deletions lib/src/widgets/yaru_title_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class YaruTitleBar extends StatelessWidget implements PreferredSizeWidget {
final bPadding = buttonPadding ??
titleBarTheme.buttonPadding ??
(!kIsWeb && Platform.isWindows
? const EdgeInsets.only(bottom: 17)
? const EdgeInsets.only(bottom: 18)
: const EdgeInsets.symmetric(horizontal: 10));
final windowControlPlatform = platform ??
(!kIsWeb && Platform.isWindows
Expand Down Expand Up @@ -227,6 +227,15 @@ class YaruTitleBar extends StatelessWidget implements PreferredSizeWidget {
);
}

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,
Expand Down Expand Up @@ -292,14 +301,14 @@ class YaruTitleBar extends StatelessWidget implements PreferredSizeWidget {
: null,
),
if (isClosable == true)
YaruWindowControl(
platform: windowControlPlatform,
foregroundColor: 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 Down

0 comments on commit 62937cd

Please sign in to comment.