Cretezy / flutter_linkify

Turns text URLs and emails into clickable inline links in text for Flutter
https://pub.dartlang.org/packages/flutter_linkify
MIT License
263 stars 99 forks source link

Error when using SelectableLinkify #75

Closed NarHakobyan closed 3 years ago

NarHakobyan commented 3 years ago

Code example.

Row(
        mainAxisSize: MainAxisSize.min,
        crossAxisAlignment: CrossAxisAlignment.end,
        children: [
          Flexible(
            child: SelectableLinkify(
              onOpen: (link) async {
                if (await canLaunch(link.url)) {
                  await launch(link.url);
                } else {
                  throw 'Could not launch $link';
                }
              },
              text: 'text',
            ),
          ),
            Container(
              margin: const EdgeInsets.only(left: 9),
              child: ReadCheckbox(
                messageSent: widget.messageSent,
                read: widget.read,
                hasPackage: widget.hasPackage,
              ),
            ),
        ],
      )

Error

flutter: ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
flutter: The following assertion was thrown building SelectableText(dirty, state:
flutter: _SelectableTextState#5378f):
flutter: SelectableText only supports TextSpan; Other type of InlineSpan is not allowed
flutter: 'package:flutter/src/material/selectable_text.dart':
flutter: Failed assertion: line 546 pos 12: '() {
flutter:       return _controller._textSpan.visitChildren((InlineSpan span) => span.runtimeType == TextSpan);
flutter:     }()'
flutter:
flutter: Either the assertion indicates an error in the framework itself, or we should provide substantially
flutter: more information in this error message to help you determine and fix the underlying cause.
flutter: In either case, please report this assertion by filing a bug on GitHub:
flutter:   https://github.com/flutter/flutter/issues/new?template=BUG.md
DSPerson commented 3 years ago

similar question

ktw1318 commented 3 years ago

same issue , me too,.

raLaaaa commented 3 years ago

same since upgrading to flutter 2.0

RedyAu commented 3 years ago

All, check #79

Cretezy commented 3 years ago

This appears to be fixed with https://github.com/Cretezy/flutter_linkify/pull/80, which has a remaining requested change. Will merge ASAP

Duplicate of https://github.com/Cretezy/flutter_linkify/issues/79