-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cupertino_icons] Add example to cupertino icons (#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/flutter#137682
- Loading branch information
1 parent
0a69259
commit d1f1f0f
Showing
4 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?code-excerpt path-base="../test"?> | ||
|
||
This package is used via [`CupertinoIcons`](https://api.flutter.dev/flutter/cupertino/CupertinoIcons-class.html): | ||
|
||
<?code-excerpt "cupertino_icons_test.dart (CupertinoIcon)"?> | ||
```dart | ||
const Icon icon = Icon( | ||
CupertinoIcons.heart_fill, | ||
color: Colors.pink, | ||
size: 24.0, | ||
); | ||
``` | ||
|
||
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). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
third_party/packages/cupertino_icons/test/cupertino_icons_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// 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. | ||
|
||
/// This test file is primarily here to serve as a source for code excerpts. | ||
library; | ||
|
||
import 'package:flutter/cupertino.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
|
||
void main() { | ||
testWidgets( | ||
'Cupertino Icon Test', | ||
(WidgetTester tester) async { | ||
// #docregion CupertinoIcon | ||
const Icon icon = Icon( | ||
CupertinoIcons.heart_fill, | ||
color: Colors.pink, | ||
size: 24.0, | ||
); | ||
// #enddocregion CupertinoIcon | ||
|
||
await tester.pumpWidget( | ||
const MaterialApp( | ||
home: Scaffold( | ||
body: icon, | ||
), | ||
), | ||
); | ||
|
||
expect(find.byType(Icon), findsOne); | ||
}, | ||
); | ||
} |