Skip to content

Commit 901bb7a

Browse files
committed
In signature pad avoid drawing out of bounds and form scroll
1 parent c3715bd commit 901bb7a

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

lib/src/form_builder.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -861,11 +861,14 @@ class FormBuilderState extends State<FormBuilder> {
861861
return formControl.validator(value);
862862
},
863863
builder: (FormFieldState<dynamic> field) {
864-
return SignaturePad(onChanged: (image){
865-
field.didChange(image);
866-
},);
864+
return SignaturePad(
865+
onChanged: (image) {
866+
field.didChange(image);
867+
},
868+
);
867869
},
868870
);
871+
869872
break;
870873
}
871874
}).toList(),

lib/src/signature_pad.dart

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,15 @@ class _SignaturePadState extends State<SignaturePad> {
5757
@override
5858
Widget build(BuildContext context) {
5959
return Container(
60-
height: 200,
60+
height: 250,
6161
child: Column(
6262
children: <Widget>[
6363
Container(
6464
decoration: BoxDecoration(
6565
color: Colors.white,
6666
border: Border.all(color: Colors.grey),
6767
),
68+
height: 200,
6869
child: GestureDetector(
6970
onPanUpdate: (DragUpdateDetails details) {
7071
setState(() {
@@ -82,9 +83,13 @@ class _SignaturePadState extends State<SignaturePad> {
8283
getImage();
8384
});
8485
},
85-
child: CustomPaint(
86-
painter: SignaturePainter(paint, points: _points),
87-
size: Size.fromHeight(150),
86+
onVerticalDragUpdate: (_) {},
87+
child: ClipRect(
88+
// borderRadius: BorderRadius.all(0),
89+
child: CustomPaint(
90+
painter: SignaturePainter(paint, points: _points),
91+
size: Size.fromHeight(150),
92+
),
8893
),
8994
// color: Colors.white,
9095
),

0 commit comments

Comments
 (0)