v6.3.0
signature
사용자 정의 스타일, 경계 및 초기 상태를 설정할 수 있는 성능 최적화된 서명 캔버스를 제공하는 플러터 플러그인입니다.
657좋아요 21.1만30일 다운로드160Pub 점수
AndroidiOSWebmacOSWindowsLinux
서명을 작성할 수 있는 캔버스를 생성하는 플러터 플러그인
{"sdk":"flutter"}^2.1.0{"sdk":"flutter"}아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
A Flutter plugin providing performance optimized signature canvas with ability to set custom style, boundaries and initial state. This is native flutter implementation, so it supports all platforms.
In time of creation of this plugin, there was no available solution that had:
Signature in Expanded widget if you are using
it without specifying dimensionsIncorrect use of ParentDataWidget, see
this issue for more
information.Row, Column or Flex
widgets, you have to wrap Signature inside Expanded yourself.To use this plugin, add signature as a
dependency in your pubspec.yaml file.
Take a look at our example project as well: Signature Demo
// IMPORT PACKAGE
import 'package:signature/signature.dart';
// Initialise a controller. It will contains signature points, stroke width and pen color.
// It will allow you to interact with the widget
final SignatureController _controller = SignatureController(
penStrokeWidth: 5,
penColor: Colors.red,
exportBackgroundColor: Colors.blue,
);
// INITIALIZE. RESULT IS A WIDGET, SO IT CAN BE DIRECTLY USED IN BUILD METHOD
var _signatureCanvas = Signature(
controller: _controller,
width: 300,
height: 300,
backgroundColor: Colors.lightBlueAccent,
);
// CLEAR CANVAS
_controller.clear();
// EXPORT BYTES AS PNG
// The exported image will be limited to the drawn area
_controller.toPngBytes();
// isEmpty/isNotEmpty CAN BE USED TO CHECK IF SIGNATURE HAS BEEN PROVIDED
_controller.isNotEmpty; //true if signature has been provided
_controller.isEmpty; //true if signature has NOT been provided
// EXPORT POINTS (2D POINTS ROUGHLY REPRESENTING WHAT IS VISIBLE ON CANVAS)
var exportedPoints = _controller.points;
//EXPORTED POINTS CAN BE USED TO INITIALIZE PREVIOUS CONTROLLER
final SignatureController _controller = SignatureController(points: exportedPoints);
//DONT FORGET TO DISPOSE IT IN THE `dispose()` METHOD OF STATEFUL WIDGETS
@override
void dispose() {
_controller.dispose();
super.dispose();
}
Example image