Skip to content

Instantly share code, notes, and snippets.

@MBeliou
Created June 22, 2020 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MBeliou/e73e2b9d43835de0439ec9266356a89f to your computer and use it in GitHub Desktop.
Save MBeliou/e73e2b9d43835de0439ec9266356a89f to your computer and use it in GitHub Desktop.
Sample implementation for TWColor
import 'package:flutter/material.dart';
class TWColor extends ColorSwatch<int> {
/// Creates a color swatch with a variety of shades.
///
/// The `primary` argument should be the 32 bit ARGB value of one of the
/// values in the swatch, as would be passed to the [new Color] constructor
/// for that same color, and as is exposed by [value]. (This is distinct from
/// the specific index of the color in the swatch.)
const TWColor(int primary, Map<int, Color> swatch) : super(primary, swatch);
/// The lightest shade.
Color get shade50 => this[50];
/// The second lightest shade.
Color get shade100 => this[100];
/// The third lightest shade.
Color get shade200 => this[200];
/// The fourth lightest shade.
Color get shade300 => this[300];
/// The fifth lightest shade.
Color get shade400 => this[400];
/// The default shade.
Color get shade500 => this[500];
/// The fourth darkest shade.
Color get shade600 => this[600];
/// The third darkest shade.
Color get shade700 => this[700];
/// The second darkest shade.
Color get shade800 => this[800];
/// The darkest shade.
Color get shade900 => this[900];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment