asjqkkkk / markdown_widget

📖Rendering markdown by flutter!Welcome for pr and issue.
MIT License
312 stars 90 forks source link

Add a "copy to clipboard" for code like chatgpt #162

Closed sharan21 closed 6 months ago

sharan21 commented 6 months ago

Is your feature request related to a problem? Please describe. There is no automatic code copy support

Describe the solution you'd like Whenever there is an opening and closing three consecutive backticks like this, the widget can create a copy to clipboard widget.

Describe alternatives you've considered Cannot think of any.

Additional context Refer to how it looks for chatgpt, can we do something similar here?

sharan21 commented 6 months ago

I think this feature is already there? Can you please provide an example for how this can be done?

sharan21 commented 6 months ago

this is my code:

 Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: MarkdownGenerator().buildWidgets(
                        config: MarkdownConfig.darkConfig,
                        message.message,
                      ),
                    ),
asjqkkkk commented 6 months ago

Hi @sharan21 , you can visit the online demo : https://asjqkkkk.github.io/markdown_widget/

there is already the copy button for code block

and the code is here

https://github.com/asjqkkkk/markdown_widget/blob/master/example/lib/widget/code_wrapper.dart