flutter_neumo

A complete, ready to use, Neumo ui kit for Flutter

flutter_logo

Try Flutter_Neumo on your browser : πŸ‘‰ https://flutter_neumo.firebaseapp.com/ 🌐

neumo_playground

βš™οΈ Installation

https://pub.dev/packages/flutter_neumo

pub package pub package

dependencies:
  flutter_neumo: ^1.0.0

//requires  flutter: ">=1.17.0"

The in your .dart files

import 'package:flutter_neumo/flutter_neumo.dart';

πŸ—‚ Widgets

Preview Widget Description
Neumo The main Neumo Widget, a container which adds white/dark gradient depending on a lightsource and a depth
NeumoButton A neumo button that plays with the depth to respond to user interraction
NeumoRadio A set of neumophic button whith only one selected at time, depending on a value and groupValue
NeumoCheckbox A button associated with a value, can be checked/unckecked, if checked, takes the accent color
NeumoText A Neumo text (only work with positive depth)
NeumoIcon A Neumo icon (only work with positive depth)
material.TextField For TextFields, just surround your existing material textfield widget with a Neumo (container)
NeumoSwitch An On/Off toggle, associated with a value, if toggled, takes the accent color
NeumoToggle An mutiple value toggle, associated with a selecteedIndex
NeumoSlider A Neumo seekbar (range slider), the user can select a value in a range
NeumoProgress A determinate progress, takes the displayed percentage
NeumoProgressIndeterminate An inderminate progress-bar
NeumoBackground Take the background color of the theme, can clip the screen with a borderRadius
NeumoApp An application that uses Neumo design. Handle theme, navigation, localisation, and much more
NeumoAppBar A Neumorphhic design app bar. Can be used inside Scaffold

πŸ‘€ Showcases

Neumo Neumo

Neumo Neumo

πŸ“¦ Neumo


Neumo(
  style: NeumoStyle(
    shape: NeumoShape.concave,
    boxShape: NeumoBoxShape.roundRect(BorderRadius.circular(12)),
    depth: 8,
    lightSource: LightSource.topLeft,
    color: Colors.grey
  ),
  child: ...
)

Neumo Neumo

☝️ Playing with LightSource & Depth

πŸ› οΈ Attributes

Attributes Values Description
LightSource TopLeft, BottomRight, etc. / (dx, dy) The source of light specifit to the theme or the widget, used to project white/dark shadows on neumo elements
Shape Concave / Convex / Flat The shape of the curve used in the neumo container
Depth -20 <= double <= 20 The distance of the widget to his parent. Can be negative => emboss. It influences on the shadow's color and its size/blur
Intensity 0 <= double <= 1 The intensity of the Light, it influences on the shadow's color
SurfaceIntensity 0 <= double <= 1 The intensity of the Surface, it influences on the concave/convex darkness
Color any Color The default color of Neumo elements
Accent any Color The default accent color of the Neumo element when activated (eg: checkbox)
Variant any Color The default secondary color of the Neumo element (eg: used as second color on the progress gradient)
BoxShape Circle, RoundRect(radius), Stadium, Path The box shape of a Neumo element. Stadium : roundrect with cirlces on each side
Border NeumoBorder A border (color/width) to enhance contrast with background and others elements

Neumo Neumo Neumo Neumo

πŸ”§ Shapes

Shape Widget Image Condition
Flat depth >= 0 && shape == Flat
Convex depth >= 0 && shape == Convex
Concave depth >= 0 && shape == Concave
Emboss depth < 0

Neumo Text

text

Text only handle positive depth

child: NeumoText(
        "I love flutter",
        style: NeumoStyle(
          depth: 4,  //customize depth here
          color: Colors.white, //customize color here
        ),
        textStyle: NeumoTextStyle(
          fontSize: 18, //customize size here
          // AND others usual text style properties (fontFamily, fontWeight, ...)
        ),
    ),

Neumo Icon

custom_shape

child: NeumoIcon(
        Icons.add_circle,
        size: 80,
    ),

How to display SVG icons ?

Simply use https://fluttericon.com/ to export your svg as .ttf & use NeumoIcon(YOUR_ICON)

custom_shape

🎨 Custom Shape

custom_shape

Flutter Neumo supports custom shapes, just provide a path to

class MyShapePathProvider extends NeumoPathProvider {
  @override
  bool shouldReclip(NeumoPathProvider oldClipper) {
    return true;
  }

  @override
  Path getPath(Size size) {
    return Path()
      ..moveTo(0, 0)
      ..lineTo(size.width/2, 0)
      ..lineTo(size.width, size.height/2)
      ..lineTo(size.width/2, size.height/2)
      ..lineTo(size.width, size.height)
      ..lineTo(0, size.height)
      ..close();
  }
}

And use NeumoBoxShape.path

Neumo(
  style: NeumoStyle(
     boxShape: NeumoBoxShape.path(MyShapePathProvider()),
  ),
  ...
),

You can import the Flutter logo as a custom shape using

Neumo(
  style: NeumoStyle(
    shape: NeumoBoxShape.path(NeumoFlutterLogoPathProvider()),
  ),
  ...
),

πŸ”² Accessibility / Border

For design purposes, or simply to enhance accessibility, you can add a border on Neumo widgets

Neumo

Neumo(
      style: NeumoStyle(
        border: NeumoBorder(
          color: Color(0x33000000),
          width: 0.8,
        )
      ),
      ...
)

You can enable/disable it (eg: listening an Accessibility Provider) with isEnabled

border: NeumoBorder(
    isEnabled: true,
    color: Color(0x33000000),
    width: 0.8,
)

Note that borderColor and borderWidth default values has been added to NeumoThemeData

🎨 Neumo Theme

neumo_theme neumo_theme

NeumoTheme(
    themeMode: ThemeMode.light, //or dark / system
    darkTheme: NeumoThemeData(
        baseColor: Color(0xff333333),
        accentColor: Colors.green,
        lightSource: LightSource.topLeft,
        depth: 4,
        intensity: 0.3,
    ),
    theme: NeumoThemeData(
        baseColor: Color(0xffDDDDDD),
        accentColor: Colors.cyan,
        lightSource: LightSource.topLeft,
        depth: 6,
        intensity: 0.5,
    ),
    child: ...
)

To retrieve the current used theme :

final theme = NeumoTheme.currentTheme(context);
final baseColor = theme.baseColor;
final accentColor = theme.accentColor;
...

Toggle from light to dark

NeumoTheme.of(context).themeMode = ThemeMode.dark;

Know if using dark

if(NeumoTheme.of(context).isUsingDark){

}

NeumoApp

You can use direcly in your project a NeumoApp, surrounding your code

It handle directly NeumoTheme & Navigation (and all possibilities of MaterialApp )

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return NeumoApp(
      debugShowCheckedModeBanner: false,
      title: 'Neumo App',
      themeMode: ThemeMode.light,
      theme: NeumoThemeData(
        baseColor: Color(0xFFFFFFFF),
        lightSource: LightSource.topLeft,
        depth: 10,
      ),
      darkTheme: NeumoThemeData(
        baseColor: Color(0xFF3E3E3E),
        lightSource: LightSource.topLeft,
        depth: 6,
      ),
      home: MyHomePage(),
    );
  }
}

What's neumo

neumo

Material Cards

A Modern / Material (upgraded) card usually is a surface floating on top of our perceived background and casting a shadow onto it. The shadow both gives it depth and also in many cases defines the shape itself β€” as it’s quite often borderless.

Neumo cards

Neumo card however pretends to extrude from the background. It’s a raised shape made from the exact same material as the background. When we look at it from the side we see that it doesn’t β€œfloat”.

neumo_button

Here's a Nereumorphic Button tap (slowed x2) from the sample app, you can see how the element seems to change its depth to its surface.

πŸ“„ License

Flutter_Neumo is released under the Apache2 license. See LICENSE for details.

If you use the open-source library in your project, please make sure to credit and backlink to www.idean.com

bottom_banner

Libraries

flutter_neumo