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

YaruTitleBar: trailing -> actions #517

Merged
merged 1 commit into from
Jan 14, 2023
Merged

YaruTitleBar: trailing -> actions #517

merged 1 commit into from
Jan 14, 2023

Conversation

jpnurmi
Copy link
Member

@jpnurmi jpnurmi commented Jan 14, 2023

To make YaruTitleBar closer to a drop-in replacement of AppBar.

Close: #515

@jpnurmi
Copy link
Member Author

jpnurmi commented Jan 14, 2023

Hmm, I noticed that AppBar has an interesting check for determining whether to center the title depending on the amount of actions. I wonder if we should have something similar... 🤔

  bool _getEffectiveCenterTitle(ThemeData theme) {
    bool platformCenter() {
      assert(theme.platform != null);
      switch (theme.platform) {
        case TargetPlatform.android:
        case TargetPlatform.fuchsia:
        case TargetPlatform.linux:
        case TargetPlatform.windows:
          return false;
        case TargetPlatform.iOS:
        case TargetPlatform.macOS:
          return actions == null || actions!.length < 2;
      }
    }

    return centerTitle
      ?? theme.appBarTheme.centerTitle
      ?? platformCenter();
  }

@Feichtmeier
Copy link
Member

Still we mimic the "api" here in most places: sounds good

@jpnurmi
Copy link
Member Author

jpnurmi commented Jan 14, 2023

Sure, it was just something that caught my attention while checking how AppBar handles actions. I think this change is fine regardless of what we decide to do with centerTitle.

@Feichtmeier Feichtmeier merged commit 9bec7f7 into ubuntu:main Jan 14, 2023
@jpnurmi jpnurmi deleted the title-bar-actions branch January 14, 2023 12:01
@jpnurmi jpnurmi mentioned this pull request Jan 15, 2023
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

Successfully merging this pull request may close these issues.

YaruTitleBar trailing vs. actions
2 participants