Skip to content

Instantly share code, notes, and snippets.

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

Christopher Ransom nicky-song

🏠
Working from home
  • Seattle, 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;