Skip to content

Proposal: a simple MaterialInkController widget #147392

@nate-thegrate

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),
    ),
  );
}

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 Flutterf: material designflutter/packages/flutter/material repository.frameworkflutter/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