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
Created January 13, 2020 18:18
Flutter: neu
// Converting NeumorphicContainer to a StatefulWidget
class NeumorphicContainer extends StatefulWidget {
final Widget child;
final double bevel;
final Offset blurOffset;
final Color color;
NeumorphicContainer({
Key key,
this.child,
@av
av / main.dart
Created January 13, 2020 18:04
Flutter: neu
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
color.mix(Colors.black, .1),
color,
color,
color.mix(Colors.white, .5),
],
stops: [
@av
av / main.dart
Created January 13, 2020 18:00
Flutter: neu
// ...
padding: const EdgeInsets.all(24.0),
// ...
@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')),
),
)
// ...