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:38
Flutter: neu
// In _NeumorphicContainerState.build > Listener > Container > BoxDecoration
// ...
colors: [
_isPressed ? color : color.mix(Colors.black, .1),
_isPressed ? color.mix(Colors.black, .05) : color,
_isPressed ? color.mix(Colors.black, .05) : color,
color.mix(Colors.white, _isPressed ? .2 : .5),
],
// ...
@av
av / main.dart
Last active January 13, 2020 18:33
Flutter: neu
// In _NeumorphicContainerState.build > Listener > Container > BoxDecoration
boxShadow: _isPressed ? null : [...]
// ...
@av
av / main.dart
Created January 13, 2020 18:27
Flutter: neu
// In _NeumorphicContainerState.build > Listener > Container > BoxDecoration
// ...
color: color.mix(Colors.black, .05),
// ...
@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,