• Stars
    star
    435
  • Rank 100,085 (Top 2 %)
  • Language
    C++
  • License
    MIT License
  • Created almost 5 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Neumorphic containers and text widget primitives to serve as the foundation of your own unique neumorphic designs.

Clay Containers for implementing beautiful, modern neumorphic designs.

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.

Version 0.3.0 -- Null Safety!

Thanks to Sameerkash the project has been migrated to null safety as the 0.3.0 (the current version).

Installation

Add clay_containers to your project as a dependency in your pubspec.yaml file. This is a simple Dart plugin, so additional configuration for iOS and Android is not needed.

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!

You can use a ClayAnimatedContainer to create animations in the same way as you would an AnimatedContainer. An explanation of AnimatedContainers can be found on the Google Developers channel on YouTube.

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.

ClayAnimatedContainer

Positional Arguments

None.

Named Arguments
  • duration - The duration over which to animate the parameters of this container.
  • curve - The curve to apply when animating the parameters of this container.
  • Additional parameters are identical to ClayContainer.

More Repositories

1

pokejisho

Pokemon English Japanese Dictionary
JavaScript
8
star
2

pomodoro

Pomodoro clock made for FreeCodeCamp
JavaScript
7
star
3

serverless-go-build-extended

An extended version of Sean Keenan's serverless-go-build plugin.
JavaScript
3
star
4

ios-wanikani-leech-widget-scriptable

An iOS Wanikani Leech Widget implemented using Scriptable
JavaScript
3
star
5

japanese-handwriting

HTML
3
star
6

1996-homepage

A personal homepage and portfolio... like its still 1996.
HTML
3
star
7

starbuccaneer

ใ‚นใ‚ฟใƒผใƒใƒƒใ‚ฏใ‚นใ‚ธใƒฃใƒ‘ใƒณใฎ Wi-Fi ใซๆŽฅ็ถšใจๅ†ๆŽฅ็ถšใ™ใ‚‹ใ“ใจใ‚’่‡ชๅ‹•ๅŒ–ใ™ใ‚‹ใƒ„ใƒผใƒซใงใ™ใ€‚
TypeScript
3
star
8

scrappad

A simple text editor for the web.
HTML
2
star
9

materialyte-for-protonmail

Materialyte is a material design inspired theme for ProtonMail
CSS
2
star
10

wanikani-radicals

A small archive of image files for Wanikani radicals.
2
star
11

vue-append-to

A Vue directive to append an element in a component template to another part of the DOM.
JavaScript
2
star
12

drawable-anki-cards-for-kanji

A simple template for Anki cards that you can draw on for practicing kanji.
HTML
2
star
13

react-native-photo-view

A copy of tomtom94's react-native-photo-view
Objective-C
1
star
14

mylip

MyLIp (My Local IP) is a simple cli tool for getting your IPv4 address on your local network.
JavaScript
1
star
15

go_rest_api

Go
1
star
16

anki-deck-screener

A tool for screening Anki decks using the AnkiConnect plugin.
JavaScript
1
star
17

neumorphic-bmi-calculator

A neumorphic Flutter app to calculate BMI.
Dart
1
star
18

covid-19-akita

TypeScript
1
star
19

wasm_japanese-assisted-reader

A simple web app that adds furigana to text implemented in GO/Web Assembly.
Go
1
star
20

langchain-examples

Simple langchain examples
TypeScript
1
star
21

vercel-kv-redis-library-example

An example of using the redis node library to connect to Vercel KV
TypeScript
1
star
22

charity-akita-old

Landing page for Charity Akita
HTML
1
star
23

tic-tac-toe

A "build a tic-tac-toe game" project for FreeCodeCamp
JavaScript
1
star
24

readable-elapsed-timer

TypeScript
1
star
25

Homarezushi

Restaurant Website for Homarezushi Akita
TypeScript
1
star
26

cloud9

Cloud9 Docker container.
CSS
1
star
27

go-fiber-tutorial

Gorm/Fiber/REST API made by following TutorialEdge's YouTube tutorial.
Go
1
star
28

japanese_love_calculator

CSS
1
star
29

mainichi_rss

An RSS generator for Mainichi Shinbun's top stories.
JavaScript
1
star
30

wikipedia-search

A project for FreeCodeCamp
CSS
1
star
31

sakigake_rss_local

A tool for creating an RSS feed from the Sakigake LINE news feed. Must be run manually on a local machine.
Go
1
star
32

wanikani-kanjikingdom-compare

A tool to compare the available kanji in both WaniKani and JalupNEXT's Kanji Kingdom.
HTML
1
star
33

mcaubrey

1
star