Skip to content

Commit 276bee2

Browse files
authored
Create neumorphism.dart
1 parent 292f3ad commit 276bee2

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

neumorphism.dart

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//This extension has been made by abuanwar072
2+
// The code has been taken from there
3+
//It helps in creating a 3D effect to the widgets.
4+
5+
import 'package:flutter/material.dart';
6+
7+
extension Neumorphism on Widget {
8+
addNeumorphism({
9+
double borderRadius = 10.0,
10+
Offset offset = const Offset(5, 5),
11+
double blurRadius = 10,
12+
Color topShadowColor = Colors.white60,
13+
Color bottomShadowColor = const Color(0x26234395),
14+
}) {
15+
return Container(
16+
decoration: BoxDecoration(
17+
borderRadius: BorderRadius.all(Radius.circular(borderRadius)),
18+
boxShadow: [
19+
BoxShadow(
20+
offset: offset,
21+
blurRadius: blurRadius,
22+
color: bottomShadowColor,
23+
),
24+
BoxShadow(
25+
offset: Offset(-offset.dx, -offset.dx),
26+
blurRadius: blurRadius,
27+
color: topShadowColor,
28+
),
29+
],
30+
),
31+
child: this,
32+
);
33+
}
34+
}

0 commit comments

Comments
 (0)