Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide conveniences for avoiding and positioning traffic light buttons #437

Open
matthew-carroll opened this issue Jun 23, 2023 · 0 comments

Comments

@matthew-carroll
Copy link

Every Mac desktop window has three little window control buttons, often called "traffic lights".

These buttons have a default appearance, but their location can be changed by the developer.

I filed macosui/macos_window_utils.dart#27 to provide access to this info and behavior from Flutter.

In addition to that lower level control, the macos_ui package could provide a couple widgets that remove most of the onus from end-users.

First, a special version of SafeArea could be added to easily avoid the traffic lights:

// Imagine that this row is positioning things across the top of the window
Row(
  children: [
     // Adjust the first item so that its content is pushed away from
     // the traffic lights.
     TrafficLightsSafeArea(
       child: Text("First"),
     ),
     Text("Second"),
     Text("Third"),
  ],
);

Second, an app bar container can simultaneously position the traffic lights, and avoid them:

MacAppBar(
  height: // optional height, defers to intrinsic child size if not provided
  background: // optional background widget that fills the space (including behind the traffic lights)
  foreground: // optional foreground widget that fills the space (including in front of the traffic lights)
  child: MyToolbar,
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants