[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:
Ravi Singh Lodhi
2024-02-13 01:16:51 +05:30
committed by GitHub
parent 0a692590a8
commit d1f1f0fdaf
4 changed files with 58 additions and 2 deletions

View File

@ -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

View 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).

View File

@ -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

View 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);
},
);
}