Skip to content

Should be able to subscribe to changes on properties of MediaQuery instead of all changes #102060

Closed

Description

@moffatman

Since flutter-team-archive/engine#29281 during keyboard opening animation the root MediaQuery will be updated with each frame. There are a lot of widgets which might call MediaQuery.of(context) but not all depend on all of the MediaQuery properties. It would be more efficient to only rebuild those widgets which depend on the change in screen dimensions, but not the widgets which depend on the text scale factor, which presumably isn't changing with each frame.

Related to #98115
Somewhat related to #96044

Activity

  1. added
    in triagePresently being triaged by the triage team
    frameworkflutter/packages/flutter repository. See also f: labels.
    p: material_uimaterial_ui package in flutter/packages
    p: cupertino_uicupertino_ui package in flutter/packages
    c: proposalA detailed proposal for a change to Flutter
    and removed
    in triagePresently being triaged by the triage team
    on Apr 18, 2022
  2. HansMuller commented on Apr 18, 2022

    @HansMuller
    Contributor

    InheritedModel enables dependency on just one "aspect" of an inherited widget. It might be possible to retrofit MediaQuery to be an InheritedModel.

  3. moffatman commented on Apr 18, 2022

    @moffatman
    ContributorAuthor

    @HansMuller See the linked PR #97928. I used InheritedModel and it noticeably improved performance during keyboard animation.

  4. jseminck commented on Sep 3, 2022

    @jseminck

    We use MediaQuery a lot to access certain properties like (padding.bottom), but are having issues that keyboard animations are triggering unnecessary rebuilds on the pages in the navigator stack, and that causes jankyness. So having the ability to subscribe to certain changes only would be amazing for us.

  5. djhkfe3234 commented on Oct 11, 2022

    @djhkfe3234

    any update on this?

  6. github-actions commented on Mar 5, 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 Mar 5, 2023
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

    c: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.p: cupertino_uicupertino_ui package in flutter/packagesp: material_uimaterial_ui package in flutter/packages

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions