Skip to content

Flutter: Is the official documentation for align wrong? #68680

Closed

Description

@LuodiJackShen

When I was reading through Align's documentation I found the following explanation.

enter image description here

The link is https://api.flutter.dev/flutter/widgets/Align-class.html#widgets.Align.2

The 0.2 is the xAlign and the 0.6 is the YAlign, follow the formulas in the official documentation and finally calculate a point (36.0,48.0). When xAlign is less than zero or yAlign is less than zero, the calculation according to this formula is always positive. And the formula for calculating the offset of FlutterLogo and Container in the source code is as follows(alignment.dart lines:290):

Offset other = size - child!.size as Offset;
final double centerX = other.dx / 2.0;
final double centerY = other.dy / 2.0;
childParentData.offset = Offset(centerX + xAlign * centerX, centerY + yAlign * centerY);

The result according to the formula in the source code does not seem to have any relation to (36,48). Did I misunderstand or did the document say something wrong?

Activity

  1. darshankawar commented on Oct 21, 2020

    @darshankawar
    Member

    Keeping this issue open for further analysis.

  2. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Oct 29, 2020
  3. self-assigned this
    on Jul 6, 2022
  4. added
    P2Important issues not at the top of the work list
    on Jul 6, 2022
  5. added
    r: fixedIssue is closed as already fixed in a newer version
    on Mar 28, 2023
  6. github-actions commented on Apr 11, 2023

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  7. locked as resolved and limited conversation to collaborators on Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listd: api docsIssues with https://api.flutter.dev/d: examplesSample code and demosframeworkflutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer version

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions