fayeed / flutter_mentions

A simple flutter input widget to add @ mentions functionality to your app
MIT License
107 stars 122 forks source link

Support for flutter v2.2.0 #46

Closed chainchelliah closed 3 years ago

chainchelliah commented 3 years ago

Hi, After upgrading the flutter version to 2.2.0, I got the below error.

../../Software/FlutterSdk/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_mentions-2.0.0-nullsafety/lib/src/annotation_editing_controller.dart:58:12: Error: The method 'AnnotationEditingController.buildTextSpan' has fewer named arguments than those of overridden method 'TextEditingController.buildTextSpan'. TextSpan buildTextSpan({TextStyle? style, bool? withComposing}) {
^
../../Software/FlutterSdk/flutter/packages/flutter/lib/src/widgets/editable_text.dart:192:12: Context: This is the overridden method ('buildTextSpan'). TextSpan buildTextSpan({required BuildContext context, TextStyle? style , required bool withComposing}) { ^
../../Software/FlutterSdk/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_mentions-2.0.0-nullsafety/lib/src/annotation_editing_controller.dart:58:12: Error: The method 'AnnotationEditingController.buildTextSpan' doesn't have the named parameter 'context' of overridden method 'TextEditingController.buildTextSpan'. TextSpan buildTextSpan({TextStyle? style, bool? withComposing}) {
^
../../Software/FlutterSdk/flutter/packages/flutter/lib/src/widgets/editable_text.dart:192:12: Context: This is the overridden method ('buildTextSpan'). TextSpan buildTextSpan({required BuildContext context, TextStyle? style , required bool withComposing}) { ^

FAILURE: Build failed with an exception.

After checking the source code 'Context' param added additionaly.

`/// Builds [TextSpan] from current editing value.
  ///
  /// By default makes text in composing range appear as underlined. Descendants
  /// can override this method to customize appearance of text.
  TextSpan buildTextSpan({required BuildContext context, TextStyle? style , required bool withComposing}) {
    assert(!value.composing.isValid || !withComposing || value.isComposingRangeValid);
    // If the composing range is out of range for the current text, ignore it to
    // preserve the tree integrity, otherwise in release mode a RangeError will
    // be thrown and this EditableText will be built with a broken subtree.
    if (!value.isComposingRangeValid || !withComposing) {
      return TextSpan(style: style, text: text);
    }
    final TextStyle composingStyle = style!.merge(
      const TextStyle(decoration: TextDecoration.underline),
    );
    return TextSpan(
      style: style,
      children: <TextSpan>[
        TextSpan(text: value.composing.textBefore(value.text)),
        TextSpan(
          style: composingStyle,
          text: value.composing.textInside(value.text),
        ),
        TextSpan(text: value.composing.textAfter(value.text)),
      ],
    );
  }`
chainchelliah commented 3 years ago

@fayeed I have raised PR. Could you please verify & merge it?. Would be really helpful. Thanks.

fayeed commented 3 years ago

@chainchelliah Published the new version 2.0.1