Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

clay containers

easily create and customize beautiful, modern neumorphic containers for your flutter project. these clay containers can become the basis for your own unique neumorphic designs.

examples

simple claycontainer

for best results, set the background
color of a surrounding widget to match
the color you will set for your clay
container. since it is likely you’ll reuse this base color
multiple times (especially if you end up doing something fancy)
it’s good to set this color to a single value. in the following example it
is set to basecolor.

import 'package:clay_containers/clay_containers.dart';

class myexamplescreen extends statelesswidget {
  @override
  widget build(buildcontext context) {
    color basecolor = color(0xfff2f2f2);

    return container(
        color: basecolor,
        child: center(
          child: claycontainer(
            color: basecolor,
            height: 200,
            width: 200,
          ),
        ),
      );
  }
}

claycontainer example.

claycontainer with a claytext child.

in the previous example the claycontainer was given height
and width since it has no child. claycontainer behaves the
same as a normal container and needs to be either given
height and width or a child to be visible. in the
following example, the claycontainer will receive a child.

the child it will receive is a claytext wrapped in some padding.

claycontainer(
          color: basecolor,
          child: padding(
            padding: edgeinsets.all(20),
            child: claytext("seize the clay!", emboss: true, size: 40),
          ),
        ),

clay container example with child.

rounded claycontainers

don’t be a square! use borderradius to add some flare. if you want a uniform borderradius you can simply set it directly in the claycontainer constructor.

claycontainer(
          color: basecolor,
          height: 150,
          width: 150,
          borderradius: 50,
        ),

a rounded claycontainer.

if you want to pass your own custom borderradius object, that is available as well: in that case pass it to customborderradius.

claycontainer(
          color: basecolor,
          height: 150,
          width: 150,
          customborderradius: borderradius.only(
              topright: radius.elliptical(150, 150),
              bottomleft: radius.circular(50)),
        ),

a weird shaped claycontainer.

embossed claycontainers

you may have noticed earlier that the claytext can receive an emboss property. claycontainers can as well. all clay widgets start in a debossed state by default.

claycontainer(
          emboss: true,
          color: basecolor,
          height: 150,
          width: 150,
          borderradius: 50,
        ),

an embossed claycontainer.

change default spread and depth

don’t like the default look of the neumorphic effect? change the base variables. do whatever you want. i’m not your mom.

claycontainer(
          color: basecolor,
          height: 150,
          width: 150,
          borderradius: 75,
          depth: 40,
          spread: 40,
        ),

embossed!

concave and convex claycontainers

give your claycontainer a convex or a concave look by passing either curvetype.concave or curvetype.convex to the curvetype parameter.

row(
          mainaxisalignment: mainaxisalignment.center,
          children: <widget>[
            claycontainer(
              color: basecolor,
              height: 150,
              width: 150,
              borderradius: 75,
              curvetype: curvetype.concave,
            ),
            sizedbox(width: 50),
            claycontainer(
              color: basecolor,
              height: 150,
              width: 150,
              borderradius: 75,
              curvetype: curvetype.none,
            ),
            sizedbox(width: 50),
            claycontainer(
              color: basecolor,
              height: 150,
              width: 150,
              borderradius: 75,
              curvetype: curvetype.convex,
            ),
          ],
        ),

concave, flat, and convex claycontainers.

animate it!

animation is not something included in this plugin, but having these values abstracted makes it easier to do things like animate your neumorphic elements. you can find the source for the example image below in this project’s ./example folder.

very animated. much cool.

full api documentation

claycontainer

positional arguments

none.

named arguments
  • color – this sets the base color for the clay object. simply setting this to the background color of the parent object will give you a pretty good looking debossed neumorphic effect.
  • height – this sets the height of the container.
  • width – this sets the width of the container.
  • parentcolor – this tells the widget to use a different color for the outside emboss/deboss effect, despite whatever is set in the color field.
  • surfacecolor – this tells the widget to use a different color for the inside of the container, despite whatever is set in the color field.
  • spread – how far should the emboss/deboss effect spread?
  • depth – how strong should the emboss/deboss effect be?
  • child – this receives child widgets.
  • borderradius – this receives a number representing a border radius to be applied to all corners of the container.
  • customborderradius – this receives a borderradius object. setting this object will override whatever is set in the borderradius field.
  • curvetype – this receives a curvetype enum. use this to set the inside surface to look either convex or concave.
  • emboss – this is false by default. set this to true in order to make an embossed container.

claytext

positional arguments
  • text – this is the text to be displayed.
named arguments
  • color – this sets the base color for the clay object. simply setting this to the background color of the parent object will give you a pretty good looking debossed neumorphic effect.
  • parentcolor – this tells the widget to use a different color for the outside emboss/deboss effect, despite whatever is set in the color field.
  • textcolor – this tells the widget to use a different color for the fill of the text, despite whatever is set in the color field.
  • spread – how far should the emboss/deboss effect spread?
  • depth – how strong should the emboss/deboss effect be?
  • emboss – this is false by default. set this to true in order to make an embossed container.

Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.