mirror of
https://github.com/flutter/packages.git
synced 2025-07-13 16:35:23 +08:00
[ios_platform_images] Adopt code-excerpts (#5682)
Replaces the Dart example code with a code excerpt. Part of https://github.com/flutter/flutter/issues/102679
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
## NEXT
|
## 0.2.3+1
|
||||||
|
|
||||||
|
* Improves example code in README.
|
||||||
* Updates minimum supported SDK version to Flutter 3.10/Dart 3.0.
|
* Updates minimum supported SDK version to Flutter 3.10/Dart 3.0.
|
||||||
|
|
||||||
## 0.2.3
|
## 0.2.3
|
||||||
|
@ -16,20 +16,13 @@ When loading images from Image.xcassets the device specific variant is chosen
|
|||||||
|
|
||||||
### iOS->Flutter Example
|
### iOS->Flutter Example
|
||||||
|
|
||||||
``` dart
|
<?code-excerpt "example/lib/main.dart (Usage)"?>
|
||||||
// Import package
|
```dart
|
||||||
import 'package:ios_platform_images/ios_platform_images.dart';
|
// "flutter" is a resource in Assets.xcassets.
|
||||||
|
final Image xcassetImage = Image(
|
||||||
Widget build(BuildContext context) {
|
image: IosPlatformImages.load('flutter'),
|
||||||
return MaterialApp(
|
semanticLabel: 'Flutter logo',
|
||||||
home: Scaffold(
|
);
|
||||||
body: Center(
|
|
||||||
child: Image(image: IosPlatformImages.load("flutter")),
|
|
||||||
),
|
|
||||||
//..
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
`IosPlatformImages.load` works similarly to [`UIImage(named:)`](https://developer.apple.com/documentation/uikit/uiimage/1624146-imagenamed).
|
`IosPlatformImages.load` works similarly to [`UIImage(named:)`](https://developer.apple.com/documentation/uikit/uiimage/1624146-imagenamed).
|
||||||
|
@ -28,17 +28,20 @@ class _MyAppState extends State<MyApp> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
// #docregion Usage
|
||||||
|
// "flutter" is a resource in Assets.xcassets.
|
||||||
|
final Image xcassetImage = Image(
|
||||||
|
image: IosPlatformImages.load('flutter'),
|
||||||
|
semanticLabel: 'Flutter logo',
|
||||||
|
);
|
||||||
|
// #enddocregion Usage
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('Plugin example app'),
|
title: const Text('Plugin example app'),
|
||||||
),
|
),
|
||||||
body: Center(
|
body: Center(
|
||||||
// "flutter" is a resource in Assets.xcassets.
|
child: xcassetImage,
|
||||||
child: Image(
|
|
||||||
image: IosPlatformImages.load('flutter'),
|
|
||||||
semanticLabel: 'Flutter logo',
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -2,7 +2,7 @@ name: ios_platform_images
|
|||||||
description: A plugin to share images between Flutter and iOS in add-to-app setups.
|
description: A plugin to share images between Flutter and iOS in add-to-app setups.
|
||||||
repository: https://github.com/flutter/packages/tree/main/packages/ios_platform_images
|
repository: https://github.com/flutter/packages/tree/main/packages/ios_platform_images
|
||||||
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+ios_platform_images%22
|
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+ios_platform_images%22
|
||||||
version: 0.2.3
|
version: 0.2.3+1
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=3.0.0 <4.0.0"
|
sdk: ">=3.0.0 <4.0.0"
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
- go_router_builder
|
- go_router_builder
|
||||||
- image_picker_for_web
|
- image_picker_for_web
|
||||||
- in_app_purchase/in_app_purchase
|
- in_app_purchase/in_app_purchase
|
||||||
- ios_platform_images
|
|
||||||
- palette_generator
|
- palette_generator
|
||||||
- pointer_interceptor
|
- pointer_interceptor
|
||||||
- quick_actions/quick_actions
|
- quick_actions/quick_actions
|
||||||
|
Reference in New Issue
Block a user