Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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.
* Updates README to improve example of using `CSSColors`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improves README example and updates it to use code excerpts.


## 1.1.3

Expand Down
4 changes: 3 additions & 1 deletion packages/css_colors/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ from `dart:ui`, which means they're useful for Flutter apps.
Import
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The entire "Import" section, including the excerpt, can be removed; the installation tab on pub.dev has that information now, so we are removing it from READMEs.

------

<?code-excerpt "example/lib/readme_excerpts.dart (Import)"?>
```dart
import 'package:css_colors/css_colors.dart';
```

Use
---

<?code-excerpt "example/lib/readme_excerpts.dart (Usage)"?>
```dart
new Container(color: CSSColors.orange)
final Container orange = Container(color: CSSColors.orange);
```
17 changes: 17 additions & 0 deletions packages/css_colors/example/lib/readme_excerpts.dart
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be really easy for us to get this from an actual example main.dart rather than having to maintain a second file. I think it'll also be pretty confusing to have the example directory and pubspec and such, but not actually have an example to run.

Given that, I think we should either wait for #5512, or fold creating an actual example into this PR.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternately, we could do this with test/, since looking at the other PR I'm not sure we actually want an example.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// 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.

// #docregion Import
import 'package:css_colors/css_colors.dart';
// #enddocregion Import
import 'package:flutter/material.dart';

/// Demonstrates using CSS Colors for the README.
Container useCSSColors() {
// #docregion Usage
final Container orange = Container(color: CSSColors.orange);
// #enddocregion Usage

return orange;
}
21 changes: 21 additions & 0 deletions packages/css_colors/example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: css_colors_example
description: Demonstrates how to use CSS Colors.
publish_to: none

environment:
sdk: ">=3.0.0 <4.0.0"

dependencies:
css_colors:
# When depending on this package from a real application you should use:
# css_colors: ^x.y.z
# See https://dart.dev/tools/pub/dependencies#version-constraints
# The example app is bundled with the plugin so we use a path dependency on
# the parent directory to use the current plugin's version.
path: ../
flutter:
sdk: flutter

dev_dependencies:
flutter_test:
sdk: flutter
23 changes: 23 additions & 0 deletions packages/css_colors/example/test/readme_excerpts_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// 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:css_colors_example/readme_excerpts.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
testWidgets('Container uses CSSColors.orange', (WidgetTester tester) async {
// Build the container and trigger a frame.
await tester.pumpWidget(MaterialApp(home: Scaffold(body: useCSSColors())));

// Verify that the Container has the correct color.
expect(
find.byWidgetPredicate(
(Widget widget) =>
widget is Container && widget.color == CSSColors.orange,
),
findsOneWidget);
});
}
2 changes: 1 addition & 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 Down
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
- flutter_image
Expand Down