mirror of
https://github.com/flutter/packages.git
synced 2025-06-25 18:12:57 +08:00
[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 https://github.com/flutter/flutter/issues/137682
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
## NEXT
|
||||
## 1.0.7
|
||||
|
||||
* Adds example.md file to display usage.
|
||||
* Updates minimum supported SDK version to Flutter 3.10/Dart 3.0.
|
||||
|
||||
## 1.0.6
|
||||
|
14
third_party/packages/cupertino_icons/example/example.md
vendored
Normal file
14
third_party/packages/cupertino_icons/example/example.md
vendored
Normal file
@ -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).
|
@ -3,11 +3,17 @@ name: cupertino_icons
|
||||
description: Default icons asset for Cupertino widgets based on Apple styled icons
|
||||
repository: https://github.com/flutter/packages/tree/main/third_party/packages/cupertino_icons
|
||||
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+cupertino_icons%22
|
||||
version: 1.0.6
|
||||
version: 1.0.7
|
||||
|
||||
environment:
|
||||
sdk: ">=3.0.0 <4.0.0"
|
||||
|
||||
dev_dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
flutter:
|
||||
fonts:
|
||||
- family: CupertinoIcons
|
||||
|
35
third_party/packages/cupertino_icons/test/cupertino_icons_test.dart
vendored
Normal file
35
third_party/packages/cupertino_icons/test/cupertino_icons_test.dart
vendored
Normal file
@ -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);
|
||||
},
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user