BertrandBev / code_field

A customizable code text field supporting syntax highlighting
https://bertrandbev.github.io/code_field/
MIT License
230 stars 61 forks source link

Enable Selection for disabled Textfield #68

Closed S-Man42 closed 1 year ago

S-Man42 commented 1 year ago

Hi,

I am using the CodeField mainly for displaying code, rather then writing it. So mainly I have it "enabled = false". Nonetheless I'd like to select some code snippets here and there, but as I see, the selection is only possible on enabled/writeable Textfields.

Is this possible?

Thanks in advance, Mark

mack-at-pieces commented 1 year ago

@S-Man42 readOnly is the property you're looking for.

Mark enabled:true and readOnly: true and you should be good to go!

S-Man42 commented 1 year ago

Hi,

When using the last stable version 1.0.2, there is no readOnly... So, I need to use the Git repo directly? Are there any plans for a stable release? Can it be used within a productive project?

Next question: I need to modify the selection controls. Normal TextFormField and SelectableText have a hook selectionControls for it. Is there anything similar in CodeField (the idea is, that I need to do something with a copied text directly)

gumbarros commented 1 year ago

Hi,

When using the last stable version 1.0.2, there is no readOnly... So, I need to use the Git repo directly? Are there any plans for a stable release? Can it be used within a productive project?

Next question: I need to modify the selection controls. Normal TextFormField and SelectableText have a hook selectionControls for it. Is there anything similar in CodeField (the idea is, that I need to do something with a copied text directly)

Hey @S-Man42 , reference the package on pubspec the package like this while @BertrandBev don't publish the package.

S-Man42 commented 1 year ago

Yes, I did this. However it feels not good to do so in a ready for launch project, that's why I asked for stability. Which commit it preferred and can be used for it? The one you mentioned or simething later?

gumbarros commented 1 year ago

Yes, I did this. However it feels not good to do so in a ready for launch project, that's why I asked for stability. Which commit it preferred and can be used for it? The one you mentioned or simething later?

Yes I agree it's better a pub.dev version. I used the lastest commit from this repo.

S-Man42 commented 1 year ago

Next question: I need to modify the selection controls. Normal TextFormField and SelectableText have a hook selectionControls for it. Is there anything similar in CodeField (the idea is, that I need to do something with a copied text directly)

Can you say something to this one?

gumbarros commented 1 year ago

Next question: I need to modify the selection controls. Normal TextFormField and SelectableText have a hook selectionControls for it. Is there anything similar in CodeField (the idea is, that I need to do something with a copied text directly)

Can you say something to this one?

Created https://github.com/BertrandBev/code_field/pull/69