neumorphism method

Widget neumorphism({
  1. Offset offset = const Offset(5, 5),
  2. double blurRadius = 10,
  3. Color topShadowColor = Colors.white60,
  4. Color bottomShadowColor = const Color(0x266A7183),
})

Implementation

Widget neumorphism({
  /// By changing the [offset] the direction of neumorphism shadow will change
  Offset offset = const Offset(5, 5),

  /// [blurRadius] is the value to define the extned of bluriness on the shadow
  double blurRadius = 10,

  /// [topShadowColor] is the starting color on neumorphism
  Color topShadowColor = Colors.white60,

  /// [bottomShadowColor] is the end color on neumorphism
  Color bottomShadowColor = const Color(0x266A7183),
}) {
  return Container(
    decoration: BoxDecoration(
      boxShadow: <BoxShadow>[
        BoxShadow(
          offset: offset,
          blurRadius: blurRadius,
          color: bottomShadowColor,
        ),
        BoxShadow(
          offset: Offset(-offset.dx, -offset.dx),
          blurRadius: blurRadius,
          color: topShadowColor,
        ),
      ],
    ),
    child: this,
  );
}