mirror of
https://github.com/flutter/packages.git
synced 2025-06-27 21:28:33 +08:00
[css_colors] Adopt code excerpts in README (#5478)
Updates the README to use a compiled excerpt source for its example of importing and using `CSSColors`. Part of [flutter/flutter#102679](https://github.com/flutter/flutter/issues/102679)
This commit is contained in:

committed by
GitHub

parent
2c5469777c
commit
a0fadd00c2
@ -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
|
||||
|
||||
|
@ -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);
|
||||
```
|
||||
|
@ -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"
|
||||
@ -11,6 +11,8 @@ environment:
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
topics:
|
||||
- color
|
||||
|
20
packages/css_colors/test/css_colors_test.dart
Normal file
20
packages/css_colors/test/css_colors_test.dart
Normal file
@ -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)));
|
||||
});
|
||||
}
|
@ -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
|
||||
|
Reference in New Issue
Block a user