animated_neumorphic 0.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 75

animated_neumorphic #

A Flutter package that contains Neumorphismic theme Container.

Getting Started #

In the pubspec.yaml of your flutter project, add the following dependency:

dependencies:
  ...
  animated_neumorphic: "^0.1.0"

In your library add the following import:

import 'package:animated_neumorphic/animated_neumorphic.dart';

For help getting started with Flutter, view the online documentation.

Usage #

For simple button:

class NeumorphicButton extends StatefulWidget {
  final bool isActive;

  const NeumorphicButton({Key key, this.isActive}) : super(key: key);

  @override
  _NeumorphicButtonState createState() => _NeumorphicButtonState();
}

class _NeumorphicButtonState extends State<NeumorphicButton> {
  bool _isActive = false;

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        setState(() {
          _isActive = !_isActive;
        });
      },
      child: AnimatedNeumorphicContainer(
        depth: _isActive ? 0.0 : 1.0,
        color: Color(0xFFF2F2F2),
        width: 60,
        height: 60,
        radius: 16,
        child: Icon(Icons.access_time),
      ),
    );
  }
}

Changelog #

Please see the Changelog page to know what's recently changed.

Contributions #

Feel free to contribute to this project.

If you find a bug or want a feature, but don't know how to fix/implement it, please fill an issue.
If you fixed a bug or implemented a feature, please send a pull request.

Changelog #

0.1.0 #

Initial version of this package.

  • Add AnimatedNeumorphicContainer.

0.1.1 #

Improved documentation.

example/lib/main.dart

import 'package:animated_neumorphic/animated_neumorphic.dart';
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  double _width = 60.0;
  double _height = 60.0;
  double _depth = 0.0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      backgroundColor: Color(0xFFF2F2F2),
      body: Center(
          child: Column(
        children: <Widget>[
          const SizedBox(height: 32),
          NeumorphicButton(),
          const SizedBox(height: 32),
          AnimatedNeumorphicContainer(
            depth: _depth,
            width: _width,
            height: _height,
            color: const Color(0xFFF2F2F2),
            child: Icon(Icons.timeline),
          ),
          const SizedBox(height: 16),
          Slider(
            value: _width,
            min: 60,
            max: 180,
            onChanged: (v) {
              setState(() => _width = v);
            },
          ),
          Slider(
            value: _height,
            min: 60,
            max: 180,
            onChanged: (v) {
              setState(() => _height = v);
            },
          ),
          Slider(
            value: _depth,
            min: 0.0,
            max: 1.0,
            onChanged: (v) {
              setState(() => _depth = v);
            },
          ),
        ],
      )),
    );
  }
}

class NeumorphicButton extends StatefulWidget {
  final bool isActive;

  const NeumorphicButton({Key key, this.isActive}) : super(key: key);

  @override
  _NeumorphicButtonState createState() => _NeumorphicButtonState();
}

class _NeumorphicButtonState extends State<NeumorphicButton> {
  bool _isActive = false;

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        setState(() {
          _isActive = !_isActive;
        });
      },
      child: AnimatedNeumorphicContainer(
        depth: _isActive ? 0.0 : 1.0,
        color: Color(0xFFF2F2F2),
        width: 60,
        height: 60,
        radius: 16,
        child: Icon(Icons.access_time),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  animated_neumorphic: ^0.1.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:animated_neumorphic/animated_neumorphic.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
49
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
75
Learn more about scoring.

We analyzed this package on Jul 12, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.15
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • animated_neumorphic that is a package requiring null.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test