flutter_img는 자산, 네트워크 및 SVG 파일에서 이미지를 효율적으로 로드하고 표시할 수 있는 향상된 이미지 위젯을 제공하는 Flutter 패키지입니다. Android, iOS, Web, macOS, Windows, Linux 등 여러 플랫폼에서 이미지 처리를 간소화합니다. PNG 및 JPG와 같은 일반적인 이미지 형식뿐만 아니라 확장 가능한 벡터 그래픽(SVG)도 지원하여 유연하고 반응형 이미지 렌더링이 필요한 앱에 적합합니다. `flutter pub add flutter_img`를 통해 최소한의 설정으로 개발자는 애플리케이션에 강력한 이미지 기능을 원활하게 통합할 수 있습니다.
사용 사례
네트워크 이미지 로딩
로컬 자산 이미지 표시
Flutter 앱에서 SVG 렌더링
크로스 플랫폼 이미지 지원
간단한 이미지 위젯 교체
주요 기능
PNG, JPG 및 SVG를 지원합니다
자산 및 네트워크 이미지 모두를 처리합니다
필요한 최소 구성
모든 주요 플랫폼에서 작동합니다
내장된 오류 및 로딩 상태
적합한 대상
SVG 지원이 필요한 앱
간단한 이미지 위젯을 찾는 개발자
크로스 플랫폼 프로젝트
UI 중심 애플리케이션
빠른 프로토타이핑
고려 사항
기본 이미지 작업에 한정
내장된 고급 캐시 없음
외부 SVG 렌더링 라이브러리에 의존합니다
복잡한 이미지 처리에 적합하지 않습니다
고급 기능을 사용하려면 추가 종속성이 필요할 수 있습니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
flutter_img
A Flutter widget with SVG code support and the ability to handle SVG, png, and jpg pictures from
assets and the network. Cached photos can be handled by it.
❗ In order to start using flutter_img you must have the Flutter SDK
installed on your machine.
Add flutter_img to your pubspec.yaml:
dependencies:flutter_img:
Install it:
flutter pub add flutter_img
Parameters
Param
Description
String src
src is the one and only positional parameter here, and it's required it will take the asset link, HTTP image link, or SVG code as a string. as you know it takes a string, so for SVG code make sure there is no new line.
double? height
If you want to set image height explicitly you can pass a height value or it will adjust the height based on image height and screen height
double? width
Similar to the height, the width parameter also can be used for explicit value
BoxShape? shape
The shape parameter can be used to change the shape of the image.
BoxBorder? border
The border parameter can be used to add the shape of the image.
BorderRadiusGeometry? borderRadius
using borderRadius You can add a border to the image
EdgeInsetsGeometry? margin
the margin of the image
EdgeInsetsGeometry? padding
the padding of the image
ColorFilter? colorFilter
The colorFilter allow you to set a color filter over the image
Widget? placeholder
The placeholder parameter allows you to provide any widget as a placeholder before the network image is fully loaded. this parameter only works with png, jpg/jpeg network images. asset images or SVG images will not be affected
String? blurHash
The blurHash parameter also allows you to load blurhash images before the network image is fully loaded. this parameter only works with png, jpg/jpeg network images. asset images or SVG images will not be affected. By default, if you don't provide placeholder blurhash will apply. and the default value is L5H2EC=PM+yV0g-mq.wG9c010J}I
Color? bgColor
bgColor will set the background color of the image
Widget? errorWidget
errorWidget parameter allows you to provide any widget that will visible if network request failed or any error happened during loading network image
final String? package
package is the name of the package where the image is located. It's only used for asset images