v2.0.1progressive_image
一個 Flutter 小部件,使用低品質圖像佔位符逐步載入較大的影像。
390喜歡 792近 30 天下載150Pub 分數
AndroidiOSWebmacOSWindowsLinux
一個 Flutter 小部件,使用低品質圖像佔位符逐步載入大圖像。
{"sdk":"flutter"}{"sdk":"flutter"}以下為英文專案原文快照,最新內容請造訪 GitHub。
A flutter widget which progressively loads large images using Low Quality Image Placeholders.
https://i.imgur.com/hKbYIQ6.gif https://i.imgur.com/sr7N8zi.gif
v2.0.0Following steps will help you add this library as a dependency in your flutter project.
pubspec.yaml file in the root of your projectdependencies:
progressive_image: ^2.0.0
$ flutter packages get
import 'package:progressive_image/progressive_image.dart';
For a more detailed look at how to use this library, there is a sweet project in the example directory and various examples can be found here
A simple example usage of the ProgressiveImage widget is shown below:
import 'package:flutter/material.dart';
import 'package:progressive_image/progressive_image.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: Text('Progressive Image Example')),
body: ProgressiveImageExample(),
),
);
}
}
class ProgressiveImageExample extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
child: ProgressiveImage(
placeholder: AssetImage('assets/placeholder.jpg'),
// size: 1.87KB
thumbnail: NetworkImage('https://i.imgur.com/7XL923M.jpg'),
// size: 1.29MB
image: NetworkImage('https://i.imgur.com/xVS07vQ.jpg'),
height: 300,
width: 500,
),
);
}
}