Coder Social home page Coder Social logo

Comments (10)

itome avatar itome commented on September 4, 2024 3

Currently approach above doesn't work because of a bug in library. I'm working on this issue.

from flutter_circle_color_picker.

itome avatar itome commented on September 4, 2024

You can change the color by changing initial color.

class SomeViewState extends State<SomeView> {
  Color selectedColor = Colors.red;

  Widget build(BuildContext context) {
    return Column(
      children: [
        CircleColorPicker(
          initialColor: selectedColor,
          onChanged: (color) => this.setState({ selectedColor: color }),
          size: const Size(240, 240),
          strokeWidth: 4,
          thumbSize: 36,
        ),
        TextField(
          onChanged: (text) => this.setState({selectedColor: Color(text)})
        ),
      ]
    );
  }
}

from flutter_circle_color_picker.

S-Man42 avatar S-Man42 commented on September 4, 2024

Your code gives the error "error: The argument type 'Map<Color, Color>' can't be assigned to the parameter type 'void Function()'. (argument_type_not_assignable at ...)" for the setState() lines.

I tried this:

class ColorPickerState extends State<ColorPicker> {
  Color _currentColor = Colors.red;

  @override
  Widget build(BuildContext context) {
    return Column(
      children: <Widget>[
        CircleColorPicker(
          initialColor: _currentColor,
          strokeWidth: 6,
          onChanged: (Color color) {
            setState(() {
              _currentColor = color;
            });
          },
        ),
       TextField(
          onChanged: (text) {
            setState(() {
              _currentColor = Colors.yellow; // the red value should turn into yellow when entering something into the TextField
            });
          },
        )
      ],
    );
  }
}

But it does nothing. When I have a look into your code, the controller values are only set in initState(), am I right? In that case, after creating the widget, the controller never changes its value.

from flutter_circle_color_picker.

S-Man42 avatar S-Man42 commented on September 4, 2024

Hi,

do have a solution for this? I tried do change your code by myself but I believe, things got even worse with my approach :D

I really would appreciate a solution here, as well. Because without it, I couldn't use your very nice component anyway. I do need to be able to set values from external widgets (so the component becomes both: A color picker and a color viewer :D)

from flutter_circle_color_picker.

S-Man42 avatar S-Man42 commented on September 4, 2024

Hi :)

Do you have any news here? It would be awesome to get this feature. Currently my feature branch is waiting for this, because I'd love to integrate you widget. Do you have any idea if or when you get it fixed? (for planning purposes ;))

from flutter_circle_color_picker.

itome avatar itome commented on September 4, 2024

Sorry, I was busy last month. I'll fix this until the end of May.

from flutter_circle_color_picker.

jdeltoft avatar jdeltoft commented on September 4, 2024

+1 on this. I love your work! I'm using it with Hubitat to play with a neopixel. I wanted to pull the current color from the LED on start up/resume of flutter, but I don't see any way to set the color wheel to a value.

from flutter_circle_color_picker.

CripyIce avatar CripyIce commented on September 4, 2024

Great library and looking forward for this new feature!
Will it be ready soon?

from flutter_circle_color_picker.

AliRn76 avatar AliRn76 commented on September 4, 2024

we need a controller for this widget, can we create one for this :\

from flutter_circle_color_picker.

itome avatar itome commented on September 4, 2024

@S-Man42 Sorry for being very late!
I merged PR #21 which add controller parameter to control picker color from outside.
Thanks.

from flutter_circle_color_picker.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.