Merge pull request #175 from pangeachat/usability

If the user highlights a word and they’re not actively defining, then…
pull/1116/head
ggurdin 2 years ago committed by GitHub
commit c8fc3dbca8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -301,8 +301,13 @@ class MessageToolbarState extends State<MessageToolbar> {
widget.textSelection.selectionStream.stream.listen((value) {
timer?.cancel();
timer = Timer(const Duration(milliseconds: 500), () {
if (currentMode != null || value != null && value.isNotEmpty) {
updateMode(currentMode ?? MessageMode.translation);
if (value != null && value.isNotEmpty) {
final MessageMode newMode = currentMode == MessageMode.definition
? MessageMode.definition
: MessageMode.translation;
updateMode(newMode);
} else if (currentMode != null) {
updateMode(currentMode!);
}
});
});

Loading…
Cancel
Save