andyduke / styled_text_package

Text widget with formatted text using tags. Makes it easier to use formatted text in multilingual applications.
https://pub.dev/packages/styled_text
BSD 3-Clause "New" or "Revised" License
74 stars 48 forks source link

Do not return the text pressed #44

Closed ROCKWAR closed 2 years ago

ROCKWAR commented 2 years ago

Before this worked well on version 1.0.1:

'f': ActionTextStyle( onTap: (TextSpan texto, Map<String, String> attrs) => _openRef(context, texto, attrs), ),

Now, on version 3.03; texto does not receive or returns anything : 'f': StyledTextActionTag( (texto, _) { selectRef = true; print('SELECCIONADO REFERENCIA, valor = $texto'); //texto = null _openRef(context, texto); }, ),

I need help please. I need to get the value within a text </ f> and then process it on my own. Thanks

andyduke commented 2 years ago

@ROCKWAR Please provide a minimum code to reproduce the problem.

ROCKWAR commented 2 years ago

// Just put this container in a Flutter application and you will see that it only prints the NULL value, when it should be: [1↑]

Container( padding: const EdgeInsets.symmetric(horizontal: 10), child: StyledText.selectable( toolbarOptions: const ToolbarOptions(copy: true), style: const TextStyle(fontSize: 18), text: "A text [1↑]", newLineAsBreaks: true, tags: { 'f': StyledTextActionTag( (texto, attr) { print('Texto value = $texto'); // texto = null // I should receive the value [1↑] when I click }, ), }, ), ),

andyduke commented 2 years ago

@ROCKWAR Please use the back tick to decorate the code, now I don't see where the "f" tag is located.

ROCKWAR commented 2 years ago
// Just put this container in a Flutter application and you will see 
// that it only prints the NULL value, when it should be: [1↑]

Container(
              padding: const EdgeInsets.symmetric(horizontal: 10),
              child: StyledText.selectable(
                toolbarOptions: const ToolbarOptions(copy: true),
                style: const TextStyle(fontSize: 18),
                text: "A text <f>[1↑]</f>",
                newLineAsBreaks: true,
                tags: {
                  'f': StyledTextActionTag(
                    (texto, attr) {
                      print('Texto value = $texto'); // texto = null
                      // I should receive the value [1↑] when I click
                    },
                  ),
                },
              ),
            ),
andyduke commented 2 years ago

@ROCKWAR This is a bug and has already been fixed in StyledText ^3.0.4.