@@ -73,17 +73,26 @@ class FormBuilderSignaturePad extends FormBuilderField<Uint8List> {
73
73
child: Column (
74
74
children: < Widget > [
75
75
Container (
76
- decoration: BoxDecoration (border: border),
77
- child: GestureDetector (
78
- onHorizontalDragUpdate: (_) {},
79
- onVerticalDragUpdate: (_) {},
80
- child: Signature (
81
- controller: state._controller,
82
- width: width,
83
- height: height,
84
- backgroundColor: backgroundColor,
76
+ height: height,
77
+ width: width,
78
+ decoration: BoxDecoration (
79
+ border: border,
80
+ image: state.enabled ? null : DecorationImage (
81
+ image: MemoryImage (state.value),
85
82
),
86
83
),
84
+ child: state.enabled
85
+ ? GestureDetector (
86
+ onHorizontalDragUpdate: (_) {},
87
+ onVerticalDragUpdate: (_) {},
88
+ child: Signature (
89
+ controller: state._controller,
90
+ width: width,
91
+ height: height,
92
+ backgroundColor: backgroundColor,
93
+ ),
94
+ )
95
+ : null ,
87
96
),
88
97
Row (
89
98
children: < Widget > [
@@ -145,35 +154,4 @@ class _FormBuilderSignaturePadState
145
154
_controller? .clear ();
146
155
super .reset ();
147
156
}
148
-
149
- /*@override
150
- void didUpdateWidget(FormBuilderSignaturePad oldWidget) {
151
- print("Widget did update...");
152
- super.didUpdateWidget(oldWidget);
153
- if (widget.controller != oldWidget.controller) {
154
- oldWidget.controller?.removeListener(_handleControllerChanged);
155
- widget.controller?.addListener(_handleControllerChanged);
156
-
157
- if (oldWidget.controller != null && widget.controller == null) {
158
- _controller = SignatureController(points: oldWidget.controller.value);
159
- }
160
- if (widget.controller != null) {
161
- setValue(widget.controller.value);
162
- if (oldWidget.controller == null) _controller = null;
163
- }
164
- }
165
- }
166
-
167
- void _handleControllerChanged() {
168
- // Suppress changes that originated from within this class.
169
- //
170
- // In the case where a controller has been passed in to this widget, we
171
- // register this change listener. In these cases, we'll also receive change
172
- // notifications for changes originating from within this class -- for
173
- // example, the reset() method. In such cases, the FormField value will
174
- // already have been set.
175
- if (signatureController.value != value) {
176
- didChange(signatureController.value);
177
- }
178
- }*/
179
157
}
0 commit comments