santa112358 / hashtagable

Widgets and functions to implement hashTag decorated text.
https://pub.dev/packages/hashtagable
MIT License
30 stars 50 forks source link

Trim whitespace of hashtags in HashTagTextField onDetectionTyped #82

Open buraktabn opened 3 years ago

buraktabn commented 3 years ago

This issue similar to #35.

hashtagable: 2.0.1
HashTagTextField(
  controller: state.controller,
  focusNode: state.focusNode,
  keyboardType: TextInputType.multiline,
  maxLines: null,
  decoration: InputDecoration(
    hintText: 'Add a comment',
    isCollapsed: true,
    contentPadding: EdgeInsets.symmetric(horizontal: 8, vertical: 9),
  ),
  decoratedStyle: Theme.of(context).textTheme.bodyText1.apply(color: Theme.of(context).primaryColor),
  basicStyle: Theme.of(context).textTheme.bodyText1.apply(color: Colors.black),
  decorateAtSign: true,
  onDetectionTyped: (str) {
    print(str);
  },
),

it prints:

I/flutter (19414): @ja
I/flutter (19414): @jan
I/flutter (19414): @jane
I/flutter (19414):  @j
I/flutter (19414):  @jo
I/flutter (19414):  @joh
I/flutter (19414):  @john
I/flutter (19414):  #h
I/flutter (19414):  #hi
I/flutter (19414):  #hik
I/flutter (19414):  #hiki
I/flutter (19414):  #hikin
I/flutter (19414):  #hiking