Skip to content

Instantly share code, notes, and snippets.

@Sunbreak
Last active January 9, 2020 06:35
Show Gist options
  • Save Sunbreak/53049ac9419dcb16f0b70ad01317a768 to your computer and use it in GitHub Desktop.
Save Sunbreak/53049ac9419dcb16f0b70ad01317a768 to your computer and use it in GitHub Desktop.
BlendMode
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
var colorBlendMode = [
BlendMode.clear,
BlendMode.src,
BlendMode.dst,
BlendMode.srcOver,
BlendMode.dstOver,
BlendMode.srcIn,
BlendMode.dstIn,
BlendMode.srcOut,
BlendMode.dstOut,
BlendMode.srcATop,
BlendMode.dstATop,
BlendMode.xor,
BlendMode.plus,
BlendMode.modulate,
BlendMode.screen,
BlendMode.overlay,
BlendMode.darken,
BlendMode.lighten,
BlendMode.colorDodge,
BlendMode.colorBurn,
BlendMode.hardLight,
BlendMode.softLight,
BlendMode.difference,
BlendMode.exclusion,
BlendMode.multiply,
BlendMode.hue,
BlendMode.saturation,
BlendMode.color,
BlendMode.luminosity,
];
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: GridView.count(
crossAxisCount: 2,
children: <Widget>[
for (var mode in colorBlendMode)
GridTile(
child: Image.network(
'https://raw.githubusercontent.com/flutter/flutter/master/dev/docs/favicon.ico',
color: Colors.amber,
colorBlendMode: mode,
),
footer: Text(
'${mode.toString().split('.')[1]}',
textAlign: TextAlign.center,
),
),
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment