Skip to content

Replace MediaQuery.sizeOf with heightOf and widthOf. #168478

Closed

Description

@ksokolovskyi

Use case

Recently, #167829 introduced MediaQuery.heightOf and MediaQuery.widthOf methods. After checking the Flutter repo, I noticed that 14 out of 28 calls to sizeOf use just one dimension.

Proposal

I'd like to propose the following:

  1. Replace MediaQuery.sizeOf(context).height with MediaQuery.heightOf(context)
  2. Replace MediaQuery.sizeOf(context).width with MediaQuery.widthOf(context)

Activity

  1. added
    P3Issues that are less important to the Flutter project
    on May 7, 2025
  2. github-actions commented on May 21, 2025

    @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.

  3. locked as resolved and limited conversation to collaborators on May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions