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
18 changes: 17 additions & 1 deletion lib/features/main_screen/querya_window_title_bar.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:io' show Platform;

import 'package:bitsdojo_window/bitsdojo_window.dart';
import 'package:flutter/material.dart' as material;
import 'package:querya_desktop/core/layout/ui_scale.dart';
Expand Down Expand Up @@ -57,6 +59,15 @@ class QueryaWindowTitleBar extends StatelessWidget {
);
}

@visibleForTesting
static double titleBarLeadingInset({
required bool isMacOS,
required double Function(double designPx) scale,
}) {
// macOS traffic lights sit in the transparent titlebar (bitsdojo custom frame).
return scale(isMacOS ? 72 : 16);
}

@visibleForTesting
static WindowButtonColors closeButtonColors(BuildContext context) {
final wb = context.workbench;
Expand Down Expand Up @@ -85,7 +96,12 @@ class QueryaWindowTitleBar extends StatelessWidget {
child: MoveWindow(
child: Row(
children: [
const SizedBox(width: 16),
SizedBox(
width: QueryaWindowTitleBar.titleBarLeadingInset(
isMacOS: Platform.isMacOS,
scale: context.scaled,
),
),
material.Icon(
material.Icons.storage_rounded,
size: 18,
Expand Down
7 changes: 6 additions & 1 deletion macos/Runner/MainFlutterWindow.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import Cocoa
import FlutterMacOS
import bitsdojo_window_macos

class MainFlutterWindow: BitsdojoWindow {
override func bitsdojo_window_configure() -> UInt {
return BDW_CUSTOM_FRAME | BDW_HIDE_ON_STARTUP
}

class MainFlutterWindow: NSWindow {
override func awakeFromNib() {
let flutterViewController = FlutterViewController()
let windowFrame = self.frame
Expand Down
18 changes: 18 additions & 0 deletions test/features/main_screen/querya_window_title_bar_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,24 @@ void main() {
expect(background, _customSurface);
});

testWidgets('title bar leading inset reserves macOS traffic-light space',
(tester) async {
expect(
QueryaWindowTitleBar.titleBarLeadingInset(
isMacOS: true,
scale: (v) => v,
),
72,
);
expect(
QueryaWindowTitleBar.titleBarLeadingInset(
isMacOS: false,
scale: (v) => v,
),
16,
);
});

testWidgets('read-only state is persistently visible in title bar',
(tester) async {
await tester.pumpWidget(
Expand Down
Loading