Skip to content

Instantly share code, notes, and snippets.

View av's full-sized avatar
💻
🌚

Ivan Charapanau av

💻
🌚
View GitHub Profile
@av
av / main.dart
Last active January 13, 2020 17:48
Flutter: neu
// In NeumorphicContainer.build > Container > BoxDecoration
// ...
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
color.mix(Colors.white, .2),
color.mix(Colors.black, .1),
]
),
@av
av / main.dart
Created January 13, 2020 17:31
Flutter: neu
// In NeumorphicContainer.build > Container > BoxShadow
// Mixing with white
color: color.mix(Colors.white, .6),
// ...
// Mixing with black
color: color.mix(Colors.black, .3),
// ...
@av
av / main.dart
Created January 13, 2020 17:28
Flutter: neu
class NeumorphicContainer extends StatelessWidget {
// ...
// New property, will store overridden color
// if passed from outside
final Color color;
NeumorphicContainer({
Key key,
this.child,
@av
av / main.dart
Created January 13, 2020 16:13
Flutter: neu
class NeumorphicContainer extends StatelessWidget {
// ...
// New property, will store overridden color
// if passed from outside
final Color color;
NeumorphicContainer({
Key key,
this.child,
@av
av / main.dart
Created January 13, 2020 16:07
Flutter: neu
// In NeumorphicApp.build > MaterialApp > ThemeData
// ...
backgroundColor: Colors.blueGrey.shade200,
scaffoldBackgroundColor: Colors.blueGrey.shade200,
dialogBackgroundColor: Colors.blueGrey.shade200,
// ...
@av
av / main.dart
Created January 13, 2020 16:01
Flutter: neu
extension ColorUtils on Color {
Color mix(Color another, double amount) {
return Color.lerp(this, another, amount);
}
}
@av
av / main.dart
Created January 13, 2020 15:45
Flutter: neu
// In NeumorphicApp
// ...
home: Scaffold(
// Adding some background
backgroundColor: Colors.blueGrey.shade200,
body: Center(
child: NeumorphicContainer(child: Text('Neumorphic')),
),
)
// ...
@av
av / main.dart
Created January 13, 2020 15:38
Flutter: neu
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(bevel),
color: Colors.grey.shade200,
boxShadow: [
BoxShadow(
blurRadius: bevel,
offset: -blurOffset,
color: Colors.white,
),
@av
av / main.dart
Created January 13, 2020 15:05
Flutter: neu
// In NeumorphicContainer.build
// ...
return Container(
decoration: BoxDecoration(
border: Border(
top: BorderSide(width: bevel, color: Color(0xFFFFFFFFFF)),
left: BorderSide(width: bevel, color: Color(0xFFFFFFFFFF)),
right: BorderSide(width: bevel, color: Color(0xFFFF000000)),
bottom: BorderSide(width: bevel, color: Color(0xFFFF000000)),
),
@av
av / main.dart
Last active January 13, 2020 15:04
Flutter: neu
// In NeumorphicContainer
// ...
// New property
final double bevel;
// Also adding initializer to a constructor
const NeumorphicContainer({
Key key,
this.child,