Closed umer322 closed 2 years ago
Same here. If I don't set a width and height for Signature widget, I can draw outside of its border. It doesn't need to be inside Row.
Fix released in 5.0.1
I don't think this is fixed. Using 5.0.1, even added a row and flexible around it like in sample.
return Column(children: [ Row( children: [ Flexible( flex: 2, child: Signature( controller: _signatureController, backgroundColor: CoreTheme.gray, height: 100, )) ], ), Padding( padding: const EdgeInsets.symmetric(horizontal: 8.0), child: TextFormField( minLines: 1, maxLines: 1, textCapitalization: TextCapitalization.words, keyboardType: TextInputType.name, decoration: InputDecoration( hintText: 'Type Signatory Name', hintStyle: CoreTheme.textStyleParagraph(color: FontColor.gray), border: InputBorder.none, ), onSaved: (name) => onValueChanged(context, name: name) ), ), Divider(thickness: 1), ]);
Same here, still doesn't work. Signature seems to be open to the right and bottom side, even when i set a width value.
child: SingleChildScrollView(
child: Column(
children: [
const SizedBox(
height: 30,
),
Signature(
controller: _companySignatureController,
height: 150,
backgroundColor: Colors.grey,
),
Is there a hack to fix this on our side or a package version to go down in order that this works again meanwhile?
Same as me, I am drawing everywhere. Really a big problem for me. What can I do?
The workaround I did was, I made it a full screen landscape view problem solved for my use case.
Not possible for me since i have to offer 2 signature areas in my view. If the developer is not able to react soon i will have to find another package or implement this feature by myself.
My hack solution is the following: I adjusted function SignatureState::_addPoint like this:
final myWidth = widget.width ?? screenSize!.width;
final myHeight = widget.height ?? screenSize!.height;
//SAVE POINT ONLY IF IT IS IN THE SPECIFIED BOUNDARIES
if (o.dx > 0 && o.dx < myWidth &&
o.dy > 0 && o.dy < myHeight) {
And when defining a height and width explicitely or implicitely (e.g. by using a LayoutBuilder around Signature) it seems to work for me. The problem with the original code seems to be that it doesn't take into account the optionally defined width and height parameters, which both are <= their screenSize pendants, and if they are smaller drawing across the right and bottom borders is possible.
I have solved this issue by using ClipRect as the parent for the Signature widget .
If i set signature inside expanded in row widget and don't specify width i am able to draw out side of signature widget. For test purpose:
Row( children: [ Expanded(child: AutoSizeText("Citizen Signature")), Flexible( flex: 2, child: Signature( controller: SignatureController( penStrokeWidth: 5, penColor: Colors.black, exportBackgroundColor: Colors.blue, ), height: height * 0.1, backgroundColor: Colors.grey[300]!, ) ) ], )