Skip to content

Commit

Permalink
feat: create indigo gradients
Browse files Browse the repository at this point in the history
Closes #128
  • Loading branch information
rafamizes committed Jan 9, 2022
1 parent 229e44d commit 61f29d1
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `GradOf` constructors: `green`, `greenAccent`; `lightGreen`,
`lighGreenAccent`; `lime`, `limeAccent`; `teal`, `tealAccent`.

[Indigo gradients](https://github.com/dartoos-dev/eo_color/issues/128):

- `GradOf` constructors: `indigo`, `indigoAccent`.

## [2.1.0] - 2021-11-08

### Added
Expand Down
15 changes: 15 additions & 0 deletions lib/src/material/grad_of.dart
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,21 @@ class GradOf extends GradientSwatch {
); // coverage:ignore-line
// coverage:ignore-end

/// A gradient of ten shades of indigo.
///
/// See also: [Indigos].
const GradOf.indigo({bool growable = false})
: super(const Indigos(), growable: growable); // coverage:ignore-line
/// A gradient of four shades of indigo accent.
///
/// See also: [IndigoAccents].
const GradOf.indigoAccent({bool growable = false})
// coverage:ignore-start
: super(
const IndigoAccents(),
growable: growable,
); // coverage:ignore-line
// coverage:ignore-end
/// A gradient of ten shades of green.
///
/// See also: [Greens].
Expand Down
30 changes: 30 additions & 0 deletions test/material/grad_of_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,36 @@ void main() {
expect(growable.length, prevLength + 1);
});
});
group('indigo:', () {
final indigoGrad = const GradOf.indigo().colors;
test('gradient', () {
expect(indigoGrad, List.of(const Indigos().colors));
});
test('fixed-length list', () {
expect(() => indigoGrad.add(aColor), throwsUnsupportedError);
});
test('growable list', () {
final growable = const GradOf.indigo(growable: true).colors;
final prevLength = growable.length;
growable.add(aColor);
expect(growable.length, prevLength + 1);
});
});
group('indigo accent:', () {
final indigoAccentGrad = const GradOf.indigoAccent().colors;
test('gradient', () {
expect(indigoAccentGrad, List.of(const IndigoAccents().colors));
});
test('fixed-length list', () {
expect(() => indigoAccentGrad.add(aColor), throwsUnsupportedError);
});
test('growable list', () {
final growable = const GradOf.indigoAccent(growable: true).colors;
final prevLength = growable.length;
growable.add(aColor);
expect(growable.length, prevLength + 1);
});
});
group('green:', () {
final greenGrad = const GradOf.green().colors;
test('gradient', () {
Expand Down

0 comments on commit 61f29d1

Please sign in to comment.