Skip to content

Proposal: a simple MaterialInkController widget #147392

Open

Description

@nate-thegrate

Imagine if _Padding and _Container were private classes, and there was only one way to add padding:

AnimatedContainer(
  duration: Duration.zero,
  padding: const EdgeInsets.only(top: 5),
  child: widget.child,
)

☹️


I made a fun little theme-picker widget that looks really cool, but the implementation gives me the same gross feeling as the animated container from above.

demo

theme picker

class _ThemePickerState extends State<ThemePicker> with SingleTickerProviderStateMixin {
  late final controller = AnimationController(vsync: this);

  Widget _builder(context, child) {
    return Material(
      color: _color,
      animationDuration: Duration.zero,
      borderRadius: BorderRadius.all(_radiusFrom(controller.value)),
      child: _inkWell,
    );
  }
}

I had a look through material.dart. Unfortunately, many components in the Material build method are private, so for now it's a package deal.


Proposal

There should be a public class that builds a stripped-down (yet fully functional) Material.

Widget _builder(context, child) {
  return ClipRRect(
    borderRadius: BorderRadius.all(_radiusFrom(controller.value)),
    child: ColoredBox(
      color: _color,
      child: BlankMaterial(child: _inkWell),
    ),
  );
}

Activity

  1. changed the title [-]Proposal: super-efficient `Material`[/-] [+]Proposal to make `Material` class more public[/+] on Apr 26, 2024
  2. added
    c: new featureNothing broken; request for a new capability
    frameworkflutter/packages/flutter repository. See also f: labels.
    p: material_uimaterial_ui package in flutter/packages
    c: proposalA detailed proposal for a change to Flutter
    team-designOwned by Design Languages team
    and removed
    in triagePresently being triaged by the triage team
    on Apr 26, 2024
  3. added
    P3Issues that are less important to the Flutter project
    triaged-designTriaged by Design Languages team
    on May 1, 2024
  4. changed the title [-]Proposal to make `Material` class more public[/-] [+]Proposal: a simple `MaterialInkController` widget[/+] on Jun 12, 2024
  5. added
    packageflutter/packages repository. See also p: labels.
    and removed
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Aug 17, 2026
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 projectc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterp: material_uimaterial_ui package in flutter/packagespackageflutter/packages repository. See also p: 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