Skip to content

[css_colors] Adopt code excerpts in README #5478

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/css_colors/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## NEXT
## 1.1.4

* Updates minimum supported SDK version to Flutter 3.10/Dart 3.0.
* Improves README example and updates it to use code excerpts.

## 1.1.3

Expand Down
10 changes: 2 additions & 8 deletions packages/css_colors/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,10 @@ This package defines color constants for the CSS colors. These color constants
use the [Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) class
from `dart:ui`, which means they're useful for Flutter apps.

Import
------

```dart
import 'package:css_colors/css_colors.dart';
```

Use
---

<?code-excerpt "test/css_colors_test.dart (Usage)"?>
```dart
new Container(color: CSSColors.orange)
final Container orange = Container(color: CSSColors.orange);
```
4 changes: 3 additions & 1 deletion packages/css_colors/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: css_colors
description: Defines constant dart:ui Color objects for CSS colors (for use in Flutter code).
repository: https://github.com/flutter/packages/tree/main/packages/css_colors
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+css_colors%22
version: 1.1.3
version: 1.1.4

environment:
sdk: ">=3.0.0 <4.0.0"
Expand All @@ -11,6 +11,8 @@ environment:
dependencies:
flutter:
sdk: flutter
flutter_test:
sdk: flutter

topics:
- color
Expand Down
20 changes: 20 additions & 0 deletions packages/css_colors/test/css_colors_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:css_colors/css_colors.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
testWidgets('CSSColors.orange should be correct',
(WidgetTester tester) async {
// Create a Container widget using CSSColors.orange.
// #docregion Usage
final Container orange = Container(color: CSSColors.orange);
// #enddocregion Usage

// Ensure the color of the container is the expected one.
expect(orange.color, equals(const Color(0xFFFFA500)));
});
}
1 change: 0 additions & 1 deletion script/configs/temp_exclude_excerpt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

# TODO(stuartmorgan): Remove everything from this list. See
# https://github.com/flutter/flutter/issues/102679
- css_colors
- espresso
- extension_google_sign_in_as_googleapis_auth
- go_router_builder
Expand Down