Skip to content

Cupertino library sometimes depends on specific widget types #12078

@Hixie

Description

@Hixie

We should always be agnostic about the child widget type, otherwise it violates our composition model.

There's basically two principles we can apply here:

  • Wrapping a widget X in a widget Y that does nothing but return the widget X should always work exactly the same as using X directly. For example, wrapping a Text in a Tooltip should always work.

  • Replacing a widget X with an entirely independent widget Y that happens to be implemented exactly the same way should always work exactly the same as using X directly.

Ideally, anywhere you accept a Widget you should accept a Placeholder or a widget equivalent to Placeholder, and act the same as if you'd gotten anything else.

Places I've noticed where we violate this:

  • CupertinoNavigationBar.middle + CupertinoNavigationBar.largeTitle, we assert that middle is Text.
  • CupertinoScaffold.tabbed requires a CupertinoTabBar.
  • CupertinoScaffold.navigationBar is handled differently if it is a CupertinoNavigationBar

cc @xster @cbracken

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: proposalA detailed proposal for a change to Flutterf: cupertinoflutter/packages/flutter/cupertino repositoryframeworkflutter/packages/flutter repository. See also f: labels.team-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions