0

i have a word like ABCDE each char in text span with different style recognizer not detect correctly EX:

recognizer: TapGestureRecognizer()
                  ..onTap = () => print('${char.key} onTap'), 

some of them not print accurate but when all spans takes same style it works fine Flutter Version Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Version 10.0.18362.720], locale en-US)

  • and your question is ...? – pskink Apr 24 '20 at 13:12
  • You tried to put the question the title, please edit it and add the question! – Abbas.M Apr 24 '20 at 13:12
  • question edited – Mahmoud Atef Apr 24 '20 at 14:44
  • it works just fine: `Text.rich(TextSpan( children: ['h', 'e', 'l', 'l', 'o'].map((l) => TextSpan( text: l, recognizer: TapGestureRecognizer() ..onTap = () => print('$l tapped') )).toList(), )), ` – pskink Apr 24 '20 at 17:32
  • with different styles not same style make 5 styles and test – Mahmoud Atef Apr 25 '20 at 17:54
  • so would you post your code? what styles did you use? – pskink Apr 26 '20 at 04:16
  • Map chars = { "A": Colors.red, "B": Colors.blue, "V": Colors.purple, "W w": Colors.black, "G": Colors.green, }; – Mahmoud Atef Apr 27 '20 at 01:25
  • for (MapEntry char in chars.entries) TextSpan( text: char.key, style: TextStyle(color: char.value), recognizer: TapGestureRecognizer() ..onTap = () => print('${char.key} onTap'), ) – Mahmoud Atef Apr 27 '20 at 01:25
  • `Text.rich(TextSpan( children: [for (var l in 'hello world'.split('')) TextSpan( text: l, style: TextStyle( fontSize: 5.0 + 4 * (l.codeUnitAt(0) - 'a'.codeUnitAt(0)), color: (l.codeUnitAt(0) - 'a'.codeUnitAt(0)).isOdd? Colors.red : Colors.orange, ), recognizer: TapGestureRecognizer() ..onTap = () => print('$l tapped') ) ] )),` – pskink Apr 27 '20 at 04:36
  • h tapped is result of all chars can you told me if it works for you – Mahmoud Atef Apr 27 '20 at 12:17
  • if works fine pls provide me with your flutter version and channel – Mahmoud Atef Apr 27 '20 at 12:18
  • how it works for you ? issue here is opened https://github.com/flutter/flutter/issues/54690 – Mahmoud Atef Apr 27 '20 at 12:24
  • Flutter 1.14.7-pre.83 • channel master • https://github.com/flutter/flutter.git Framework • revision e10df3c1a6 (3 months ago) • 2020-02-01 11:23:01 +0800 Engine • revision e625e174c5 Tools • Dart 2.8.0 (build 2.8.0-dev.6.0 5ae5aff640) – pskink Apr 27 '20 at 12:52
  • it works on master not stable :) – Mahmoud Atef Apr 27 '20 at 14:22

0 Answers0