Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic color change for penColor #96

Open
tushar0518 opened this issue Dec 21, 2023 · 1 comment
Open

Dynamic color change for penColor #96

tushar0518 opened this issue Dec 21, 2023 · 1 comment
Labels
invalid This doesn't seem right waiting-for-response Further information is requested

Comments

@tushar0518
Copy link

tushar0518 commented Dec 21, 2023

Since penColor, penStrokeWidth and other properties are final we can't change them dynamically.
Like sometimes we need different colors in the same canvas with different strockWidth.
Due to the above the current controller is overridden.

Currently is there a way to do it?

Here is my sample code,

final SignatureController _controller = SignatureController(
    penStrokeWidth: 4,
    penColor: Colors.red,
    exportBackgroundColor: Colors.transparent,
    exportPenColor: Colors.red,
    onDrawStart: () => log('onDrawStart called!'),
    onDrawEnd: () => log('onDrawEnd called!'),
  );
MaterialPicker(
              pickerColor: Colors.red,
              portraitOnly: true,
              onColorChanged: (Color color) {
                //on color picked
                print(color);
                _controller
                  ..penColor = color
                  ..penStrokeWidth = 4;
                setState(() {});
                Navigator.pop(context);
              },
            );

Screenshot 2023-12-21 at 11 41 34 AM

@rohitbhoite
Copy link

Added a change in below PR
#105

@MartinHlavna MartinHlavna added the invalid This doesn't seem right label May 7, 2024
@MartinHlavna MartinHlavna added the waiting-for-response Further information is requested label May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right waiting-for-response Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants