Skip to content

Proposal to add shrinkWrap property for platform views #77416

@bdlukaa

Description

@bdlukaa

Use case

Currently, when using a platform view, it's necessary to give it a size using a SizedBox or a Container. It'd be great if we could introduce it to the tree without needing to give it a size. For example, using the plugin native_admob_flutter, it's necessary to give the ad a size. The same with google_mobile_ads with Native Ads

Proposal

I'd like to be able to just set shrinkWrap to true in a PlatformView and insert it in the Widget tree without problems:

// For android:
AndroidView(
   shrinkWrap: true,
   viewType: widget.viewType,
   creationParamsCodec: StandardMessageCodec(),
   creationParams: widget.params,
);

// For iOS:
UiKitView(
  shrinkWrap: true,
  viewType: _viewType,
  creationParamsCodec: StandardMessageCodec(),
  creationParams: params,
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projecta: platform-viewsEmbedding Android/iOS views in Flutter appsc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.team-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