Skip to content

Add a widget that applies an ImageFit type to its child widget #5830

Closed

Description

@mpcomplete

Example use case: have a Text widget that scales its text size depending on the size of its container.

From @Hixie:

using https://docs.flutter.io/flutter/painting/applyImageFit.html that'd be pretty easy
the short answer is, you create a RenderShiftedBox that is somewhat of a cross between RenderTransform and RenderPadding
that takes an ImageFit instead of an EdgeInset or Matrx4
it then has the child lay itself out unbounded, takes its size, passes that size to that function along with the current widget's size
and then figures the the transform you need to render the widget as per the result
that last part is the only tricky part i think
and yeah, we should totally make this a generic widget

Activity

  1. abarth commented on Sep 22, 2016

    @abarth
    Contributor
  2. self-assigned this
    on Sep 22, 2016
  3. added a commit that references this issue on Sep 24, 2016
    c27b03b
  4. github-actions commented on Sep 5, 2021

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

  5. locked as resolved and limited conversation to collaborators on Sep 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions