|
|
|
|
@ -19,7 +19,8 @@ class ESignature extends StatefulWidget {
|
|
|
|
|
final bool showShadow;
|
|
|
|
|
final String title;
|
|
|
|
|
|
|
|
|
|
const ESignature({Key? key, required this.title, required this.oldSignature, this.backgroundColor, this.onSaved, this.onChange, this.showShadow=true, required this.newSignature}) : super(key: key);
|
|
|
|
|
const ESignature({Key? key, required this.title, required this.oldSignature, this.backgroundColor, this.onSaved, this.onChange, this.showShadow = true, required this.newSignature})
|
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
State<ESignature> createState() => _ESignatureState();
|
|
|
|
|
@ -66,7 +67,7 @@ class _ESignatureState extends State<ESignature> {
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: widget.backgroundColor ?? (context.isDark ? AppColor.background(context) : Colors.white),
|
|
|
|
|
borderRadius: _editable ? const BorderRadius.only(topLeft: Radius.circular(10), topRight: Radius.circular(10)) : BorderRadius.circular(10),
|
|
|
|
|
boxShadow: widget.showShadow? [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 10)]:null,
|
|
|
|
|
boxShadow: widget.showShadow ? [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 10)] : null,
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
@ -89,7 +90,7 @@ class _ESignatureState extends State<ESignature> {
|
|
|
|
|
.onPress(() async {
|
|
|
|
|
if (_editable) {
|
|
|
|
|
signature = await _controller!.toPngBytes();
|
|
|
|
|
if (widget.onChange != null) {
|
|
|
|
|
if (widget.onChange != null && signature != null) {
|
|
|
|
|
widget.onChange!(signature!);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -103,7 +104,7 @@ class _ESignatureState extends State<ESignature> {
|
|
|
|
|
height: 135.toScreenHeight,
|
|
|
|
|
width: MediaQuery.of(context).size.width,
|
|
|
|
|
padding: const EdgeInsets.only(bottom: 8),
|
|
|
|
|
child: signature != null ? Image.memory(signature!) : ImageLoader(showDefaultIcon: true,boxFit: BoxFit.contain, url: URLs.getFileUrl(widget.oldSignature)??''),
|
|
|
|
|
child: signature != null ? Image.memory(signature!) : ImageLoader(showDefaultIcon: true, boxFit: BoxFit.contain, url: URLs.getFileUrl(widget.oldSignature) ?? ''),
|
|
|
|
|
)
|
|
|
|
|
: AbsorbPointer(
|
|
|
|
|
absorbing: !_editable,
|
|
|
|
|
|