Skip to content

Commit

Permalink
## [0.5.5]
Browse files Browse the repository at this point in the history
* issue: fix textEditingValue and textSelectionControls are not update when didUpdateWidget
  • Loading branch information
zmtzawqlp committed Jun 12, 2019
1 parent 02ce9a5 commit 90a1430
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
## [0.5.5]

* issue: fix textEditingValue and textSelectionControls are not update when didUpdateWidget

## [0.5.4]

* support text selection
* fix issue about rect of overFlowTextSpan
* feature: support text selection
* issue: fix issue about rect of overFlowTextSpan

## [0.5.3]

Expand Down
26 changes: 25 additions & 1 deletion lib/src/selection/extended_text_selection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,34 @@ class ExtendedTextSelectionState extends State<ExtendedTextSelection>
_textSelectionControls = widget.textSelectionControls;
textEditingValue = TextEditingValue(
text: widget.data, selection: TextSelection.collapsed(offset: 0));

super.initState();
}

@override
void didUpdateWidget(ExtendedTextSelection oldWidget) {
if (oldWidget.textSelectionControls != this.widget.textSelectionControls) {
_textSelectionControls = widget.textSelectionControls;
final ThemeData themeData = Theme.of(context);
switch (themeData.platform) {
case TargetPlatform.iOS:
_textSelectionControls ??= extendedCupertinoTextSelectionControls;
break;

case TargetPlatform.android:
case TargetPlatform.fuchsia:
_textSelectionControls ??= extendedMaterialTextSelectionControls;
break;
}
}

if (oldWidget.data != this.widget.data) {
textEditingValue = TextEditingValue(
text: widget.data, selection: TextSelection.collapsed(offset: 0));
}

super.didUpdateWidget(oldWidget);
}

@override
void dispose() {
_pointerHandlerState?.selectionStates?.remove(this);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: extended_text
description: extended official text to quickly build special text like inline image or @somebody,it also provide custom background,custom over flow.
version: 0.5.4
version: 0.5.5
author: zmtzapxh <[email protected]>
homepage: https://github.com/fluttercandies/extended_text

Expand Down

0 comments on commit 90a1430

Please sign in to comment.