Merge pull request #175 from pangeachat/usability
If the user highlights a word and they’re not actively defining, then…
This commit is contained in:
commit
c8fc3dbca8
1 changed files with 7 additions and 2 deletions
|
|
@ -301,8 +301,13 @@ class MessageToolbarState extends State<MessageToolbar> {
|
||||||
widget.textSelection.selectionStream.stream.listen((value) {
|
widget.textSelection.selectionStream.stream.listen((value) {
|
||||||
timer?.cancel();
|
timer?.cancel();
|
||||||
timer = Timer(const Duration(milliseconds: 500), () {
|
timer = Timer(const Duration(milliseconds: 500), () {
|
||||||
if (currentMode != null || value != null && value.isNotEmpty) {
|
if (value != null && value.isNotEmpty) {
|
||||||
updateMode(currentMode ?? MessageMode.translation);
|
final MessageMode newMode = currentMode == MessageMode.definition
|
||||||
|
? MessageMode.definition
|
||||||
|
: MessageMode.translation;
|
||||||
|
updateMode(newMode);
|
||||||
|
} else if (currentMode != null) {
|
||||||
|
updateMode(currentMode!);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue