Skip to content

Commit d1f1f0f

Browse files
authored
[cupertino_icons] Add example to cupertino icons (flutter#5312)
## Description of PR: Adding an example app to showcase the usage of `cupertino_icons`. This addition will also increase the pub points of the package and will be helpful for other developers to quickly find relevant examples. Fixes flutter#137682
1 parent 0a69259 commit d1f1f0f

File tree

4 files changed

+58
-2
lines changed

4 files changed

+58
-2
lines changed

third_party/packages/cupertino_icons/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
## NEXT
1+
## 1.0.7
22

3+
* Adds example.md file to display usage.
34
* Updates minimum supported SDK version to Flutter 3.10/Dart 3.0.
45

56
## 1.0.6
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?code-excerpt path-base="../test"?>
2+
3+
This package is used via [`CupertinoIcons`](https://api.flutter.dev/flutter/cupertino/CupertinoIcons-class.html):
4+
5+
<?code-excerpt "cupertino_icons_test.dart (CupertinoIcon)"?>
6+
```dart
7+
const Icon icon = Icon(
8+
CupertinoIcons.heart_fill,
9+
color: Colors.pink,
10+
size: 24.0,
11+
);
12+
```
13+
14+
For a list of all icons, see [`CupertinoIcons`](https://api.flutter.dev/flutter/cupertino/CupertinoIcons-class.html#constants) [class documentation constants](https://api.flutter.dev/flutter/cupertino/CupertinoIcons-class.html#constants).

third_party/packages/cupertino_icons/pubspec.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@ name: cupertino_icons
33
description: Default icons asset for Cupertino widgets based on Apple styled icons
44
repository: https://github.com/flutter/packages/tree/main/third_party/packages/cupertino_icons
55
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+cupertino_icons%22
6-
version: 1.0.6
6+
version: 1.0.7
77

88
environment:
99
sdk: ">=3.0.0 <4.0.0"
1010

11+
dev_dependencies:
12+
flutter:
13+
sdk: flutter
14+
flutter_test:
15+
sdk: flutter
16+
1117
flutter:
1218
fonts:
1319
- family: CupertinoIcons
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
/// This test file is primarily here to serve as a source for code excerpts.
6+
library;
7+
8+
import 'package:flutter/cupertino.dart';
9+
import 'package:flutter/material.dart';
10+
import 'package:flutter_test/flutter_test.dart';
11+
12+
void main() {
13+
testWidgets(
14+
'Cupertino Icon Test',
15+
(WidgetTester tester) async {
16+
// #docregion CupertinoIcon
17+
const Icon icon = Icon(
18+
CupertinoIcons.heart_fill,
19+
color: Colors.pink,
20+
size: 24.0,
21+
);
22+
// #enddocregion CupertinoIcon
23+
24+
await tester.pumpWidget(
25+
const MaterialApp(
26+
home: Scaffold(
27+
body: icon,
28+
),
29+
),
30+
);
31+
32+
expect(find.byType(Icon), findsOne);
33+
},
34+
);
35+
}

0 commit comments

Comments
 (0)