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