@@ -6,7 +6,7 @@ import 'package:flutter_form_builder/flutter_form_builder.dart';
6
6
import 'package:signature/signature.dart' ;
7
7
8
8
/// Field with drawing pad on which user can doodle
9
- class FormBuilderSignaturePad extends FormBuilderField <Uint8List > {
9
+ class FormBuilderSignaturePad extends FormBuilderFieldDecoration <Uint8List > {
10
10
/// Controls the value of the signature pad.
11
11
///
12
12
/// If null, this widget will create its own [SignatureController] .
@@ -37,38 +37,25 @@ class FormBuilderSignaturePad extends FormBuilderField<Uint8List> {
37
37
38
38
/// Creates field with drawing pad on which user can doodle
39
39
FormBuilderSignaturePad ({
40
- Key ? key,
41
- //From Super
42
- required String name,
43
- FormFieldValidator <Uint8List >? validator,
44
- Uint8List ? initialValue,
45
- InputDecoration decoration = const InputDecoration (),
46
- ValueChanged <Uint8List ?>? onChanged,
47
- ValueTransformer <Uint8List ?>? valueTransformer,
48
- bool enabled = true ,
49
- FormFieldSetter <Uint8List >? onSaved,
50
- AutovalidateMode autovalidateMode = AutovalidateMode .disabled,
51
- VoidCallback ? onReset,
52
- FocusNode ? focusNode,
40
+ super .key,
41
+ required super .name,
42
+ super .validator,
43
+ super .initialValue,
44
+ super .decoration,
45
+ super .onChanged,
46
+ super .valueTransformer,
47
+ super .enabled,
48
+ super .onSaved,
49
+ super .autovalidateMode,
50
+ super .onReset,
51
+ super .focusNode,
53
52
this .backgroundColor = Colors .transparent,
54
53
this .clearButtonText,
55
54
this .width,
56
55
this .height = 200 ,
57
56
this .controller,
58
57
this .border,
59
58
}) : super (
60
- autovalidateMode: autovalidateMode,
61
- decoration: decoration,
62
- enabled: enabled,
63
- focusNode: focusNode,
64
- initialValue: initialValue,
65
- key: key,
66
- name: name,
67
- onChanged: onChanged,
68
- onReset: onReset,
69
- onSaved: onSaved,
70
- validator: validator,
71
- valueTransformer: valueTransformer,
72
59
builder: (FormFieldState <Uint8List ?> field) {
73
60
final state = field as FormBuilderSignaturePadState ;
74
61
final theme = Theme .of (state.context);
@@ -85,12 +72,9 @@ class FormBuilderSignaturePad extends FormBuilderField<Uint8List> {
85
72
width: width,
86
73
decoration: BoxDecoration (
87
74
border: border,
88
- image:
89
- (null != initialValue && initialValue == state.value)
90
- ? DecorationImage (
91
- image: MemoryImage (state.value! ),
92
- )
93
- : null ,
75
+ image: null != initialValue && initialValue == state.value
76
+ ? DecorationImage (image: MemoryImage (state.value! ))
77
+ : null ,
94
78
),
95
79
child: state.enabled
96
80
? GestureDetector (
@@ -133,8 +117,8 @@ class FormBuilderSignaturePad extends FormBuilderField<Uint8List> {
133
117
FormBuilderSignaturePadState createState () => FormBuilderSignaturePadState ();
134
118
}
135
119
136
- class FormBuilderSignaturePadState
137
- extends FormBuilderFieldState < FormBuilderSignaturePad , Uint8List > {
120
+ class FormBuilderSignaturePadState extends FormBuilderFieldDecorationState <
121
+ FormBuilderSignaturePad , Uint8List > {
138
122
late SignatureController _controller;
139
123
140
124
SignatureController get effectiveController => _controller;
0 commit comments