Skip to content

Instantly share code, notes, and snippets.

View nicky-song's full-sized avatar
🏠
Working from home

Nicholas Song nicky-song

🏠
Working from home
  • Puyallup, WA
View GitHub Profile
@nicky-song
nicky-song / utils.dart
Last active October 19, 2022 06:14
Flutter: Create MaterialColor from a hex color
MaterialColor createMaterialColor(Color color) {
List strengths = <double>[.05];
Map<int, Color> swatch = {};
final int r = color.red, g = color.green, b = color.blue;
for (int i = 1; i < 10; i++) {
strengths.add(0.1 * i);
}
for (var strength in strengths) {
final double ds = 0.5 - strength;