QR.Flutter는 위젯이나 커스텀 페인터를 사용하여 효율적으로 QR 코드를 생성할 수 있는 가벼운 Flutter 패키지입니다. Android, iOS, Web, macOS, Windows, Linux 등 여러 플랫폼을 지원하여 크로스플랫폼 애플리케이션에 적합합니다. 라이브러리는 크기, 색상, 오류 수정 수준을 사용자 정의할 수 있는 QR 코드 렌더링을 위한 간단한 API를 제공합니다. 빠른 성능과 기존 Flutter 프로젝트에의 쉬운 통합을 위해 설계되었습니다.
사용 사례
로그인 토큰용 QR 코드 생성
제품 또는 이벤트 티켓 생성
URL 또는 연락처 정보 공유
앱에 QR 코드 스캔 통합
동적 데이터를 QR 코드로 표시
주요 기능
간단한 위젯 기반 QR 코드 생성
사용자 정의 페인터 지원
크로스 플랫폼 호환성
사용자 정의 가능한 오류 보정 수준
사용자 지정 가능한 색상 및 크기
빠른 렌더링 성능
적합한 대상
모바일 앱 개발자
웹 애플리케이션 제작자
이벤트 티켓팅 시스템
인증 워크플로우
디지털 명함
고려 사항
QR 코드 생성에 한정됨(스캔 불가)
이미지 내보내기의 수동 처리가 필요합니다
QR 코드 읽기용 내장 지원 없음
스캔 기능을 위해 추가 패키지가 필요할 수 있습니다
매우 큰 QR 코드에 최적화되지 않음
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
QR.Flutter is a Flutter library for simple and fast QR code rendering via a Widget or custom painter.
Need help?
Please do not submit an issue for a "How do i ..?" or "What is the deal with ..?" type question. They will pretty much be closed instantly. If you have questions, please ask them on the Discussions board or on Stack Overflow. They will get answered there.
Using issues creates a large amount of noise and results in real issues getting fixed slower.
Automatic QR code version/type detection or manual entry
Supports QR code versions 1 - 40
Error correction / redundancy
Configurable output size, padding, background and foreground colors
Supports image overlays
Export to image data to save to file or use in memory
No internet connection required
Installing
Version compatibility: 4.0.0+ supports null safety and requires a version of Flutter that is compatible.
If you're using an incompatible version of flutter, please use a 3.x version of this library.
You should add the following to your pubspec.yaml file:
dependencies:qr_flutter:^4.1.0
Note: If you're using the Flutter master channel, if you encounter build issues, or want to try the latest and greatest then you should use the master branch and not a specific release version. To do so, use the following configuration in your pubspec.yaml:
Depending on your data requirements you may want to tweak the QR code output. The following options are available:
Property
Type
Description
version
int
QrVersions.auto or a value between 1 and 40. See http://www.qrcode.com/en/about/version.html for limitations and details.
errorCorrectionLevel
int
A value defined on QrErrorCorrectLevel. e.g.: QrErrorCorrectLevel.L.
size
double
The (square) size of the image. If not given, will auto size using shortest size constraint.
padding
EdgeInsets
Padding surrounding the QR code data.
backgroundColor
Color
The background color (default is none).
eyeStyle
QrEyeStyle
Configures the QR code eyes' (corners') shape and color.
dataModuleStyle
QrDataModuleStyle
Configures the shape and the color of the dots.
gapless
bool
Adds an extra pixel in size to prevent gaps (default is true).
errorStateBuilder
QrErrorBuilder
Allows you to show an error state Widget in the event there is an error rendering the QR code (e.g.: version is too low, input is too long, etc).
constrainErrorBounds
bool
If true, the error Widget will be constrained to the square that the QR code was going to be drawn in. If false, the error state Widget will grow/shrink to whatever size it needs.
embeddedImage
ImageProvider
An ImageProvider that defines an image to be overlaid in the center of the QR code.
embeddedImageStyle
QrEmbeddedImageStyle
Properties to style the embedded image.
embeddedImageEmitsError
bool
If true, any failure to load the embedded image will trigger the errorStateBuilder or render an empty Container. If false, the QR code will be rendered and the embedded image will be ignored.
semanticsLabel
String
semanticsLabel will be used by screen readers to describe the content of the QR code.
borderRadius
double
Setting corner rounding for shape types QrEyeShape.square, QrDataModuleShape.square, EmbeddedImageShape.square. Set in appropriate styles.
roundedOutsideCorners
bool
If true, the outer corners of the data are rounded. Set to QrDataModuleStyle. Rounded to borderRadius by default. Only QrDataModuleShape.square.
outsideBorderRadius
double
It is set if the outer rounding outsideBorderRadius should differ from the inner one borderRadius. No more than borderRadius. Only QrDataModuleShape.square
gradient
Gradient
Changing the solid color of the code to a gradient, e.g. LinearGradient.
safeArea
bool
If true, data is hidden behind the embeddedImage. Set to QrEmbeddedImageStyle.
safeAreaMultiplier
double
Multiplier safeArea size.
Examples
There is a simple, working, example Flutter app in the /example directory. You can use it to play with all
the options.
Also, the following examples give you a quick overview on how to use the library.
A basic QR code will look something like:
QrImageView(
data: 'This is a simple QR code',
version: QrVersions.auto,
size: 320,
gapless: false,
)
A QR code with an image (from your application's assets) will look like:
QrImageView(
data: 'This QR code has an embedded image as well',
version: QrVersions.auto,
size: 320,
gapless: false,
embeddedImage: AssetImage('assets/images/my_embedded_image.png'),
embeddedImageStyle: QrEmbeddedImageStyle(
size: Size(80, 80),
),
)
To show an error state in the event that the QR code can't be validated:
QrImageView(
data: 'This QR code will show the error state instead',
version: 1,
size: 320,
gapless: false,
errorStateBuilder: (cxt, err) {
returnContainer(
child: Center(
child: Text(
'Uh oh! Something went wrong...',
textAlign: TextAlign.center,
),
),
);
},
)
A QR code with inside and outside corners rounding and safe area of embedded image:
QrImageView(
data: 'London is the capital of Great Britain',
version: QrVersions.auto,
size: 320,
eyeStyle: constQrEyeStyle(
borderRadius: 10,
),
dataModuleStyle: constQrDataModuleStyle(
borderRadius: 5,
roundedOutsideCorners: true,
),
embeddedImage: AssetImage('assets/images/my_embedded_image.png'),
embeddedImageStyle: QrEmbeddedImageStyle(
size: Size.square(40),
color: Colors.white,
safeArea: true,
safeAreaMultiplier: 1.1,
embeddedImageShape: EmbeddedImageShape.square,
borderRadius: 10,
),
)