Skip to content

Instantly share code, notes, and snippets.

@maodo
maodo / Flutter background image
Last active May 25, 2022 14:45
Set an image as background with transparency
Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('images/image_name_with_the_extension'),
fit: BoxFit.cover,
colorFilter: ColorFilter.mode(
Colors.white.withOpacity(0.8), BlendMode.dstATop),
),
),
)
@maodo
maodo / flutter_background_image
Created May 17, 2022 00:40
This allows you to set an image as a background in flutter scaffold widget
return Scaffold(
body: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('images/background.png'),
fit: BoxFit.cover),
),),)
@maodo
maodo / splice-object-array.js
Created February 12, 2021 23:18 — forked from scottopolis/splice-object-array.js
Remove object from array of objects in Javascript
// source: http://stackoverflow.com/questions/16491758/remove-objects-from-array-by-object-property
// we have an array of objects, we want to remove one object using only the id property
var apps = [{id:34,name:'My App',another:'thing'},{id:37,name:'My New App',another:'things'}];
// get index of object with id:37
var removeIndex = apps.map(function(item) { return item.id; }).indexOf(37);
// remove object
apps.splice(removeIndex, 1);