Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add convenience static members to AlignmentGeometry #169709

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
Loading
from

Conversation

loic-sharma
Copy link
Member

@loic-sharma loic-sharma commented May 29, 2025

This adds convenience members to AlignmentGeometry in preparation for Dart shorthands.

Before:

Container(
  alignment: Alignment.topLeft,
  child: Text('Hello world'),
),

After (with Dart shorthands):

Container(
  alignment: .topLeft,
  child: Text('Hello world'),
),

Prior art: #165597

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions bot added the framework flutter/packages/flutter repository. See also f: labels. label May 29, 2025
@loic-sharma loic-sharma marked this pull request as ready for review May 29, 2025 23:26
@loic-sharma loic-sharma requested review from justinmc and Piinks May 29, 2025 23:26
Copy link
Contributor

@justinmc justinmc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Comment on lines -18 to +19
/// A property or argument of this type accepts classes created either with [
/// Alignment] and its variants, or [AlignmentDirectional.new].
/// A property or argument of this type accepts classes created either with
/// [Alignment] and its variants, or [AlignmentDirectional.new].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

Comment on lines 35 to 36
/// The top left corner.
static const AlignmentGeometry topLeft = Alignment.topLeft;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Would it be useful to link these to their Alignment equivalent in the docs? Or maybe AlignmentGeometry shouldn't technically know about Alignment? Anyway, up to you.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added!

Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also LGTM! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.