「Flutter/画像/画像viewer」の版間の差分
提供: 初心者エンジニアの簡易メモ
(→サンプル) |
(→サンプル) |
||
| 行10: | 行10: | ||
==サンプル== | ==サンプル== | ||
| + | ローカル画像 | ||
| + | <pre> | ||
| + | import 'package:photo_view/photo_view.dart'; | ||
| + | PhotoView photoView = PhotoView( | ||
| + | imageProvider: AssetImage("assets/image1.jpg"), | ||
| + | minScale: PhotoViewComputedScale.contained * 1.0, | ||
| + | maxScale: 2.0, | ||
| + | ); | ||
| + | |||
| + | ネット画像 | ||
<pre> | <pre> | ||
import 'package:photo_view/photo_view.dart'; | import 'package:photo_view/photo_view.dart'; | ||
2020年1月17日 (金) 11:26時点における版
インストール
pubspec.yaml
dependencies: photo_view: ^0.9.1
公式
https://pub.dev/packages/photo_view
サンプル
ローカル画像
import 'package:photo_view/photo_view.dart';
PhotoView photoView = PhotoView(
imageProvider: AssetImage("assets/image1.jpg"),
minScale: PhotoViewComputedScale.contained * 1.0,
maxScale: 2.0,
);
ネット画像
<pre>
import 'package:photo_view/photo_view.dart';
PhotoView photoView = PhotoView(
imageProvider: NetworkImage(imageUrl),
minScale: PhotoViewComputedScale.contained * 1.0,
maxScale: 2.0,
);
