-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TW-724 Improve composer with enter shortcut and need support Vietnamese
- Loading branch information
1 parent
0496746
commit b052f2a
Showing
6 changed files
with
82 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import 'package:flutter/services.dart'; | ||
|
||
// Refer: https://github.com/flutter/flutter/issues/35435#issuecomment-540582796 | ||
extension RawKeyEventExtension on RawKeyEvent { | ||
bool get isEnter { | ||
if (this is! RawKeyUpEvent) { | ||
return false; | ||
} | ||
if (logicalKey == LogicalKeyboardKey.enter) { | ||
return true; | ||
} | ||
if (data is RawKeyEventDataWeb) { | ||
if ((data as RawKeyEventDataWeb).keyLabel == 'Enter') { | ||
return true; | ||
} | ||
} | ||
if (data is RawKeyEventDataAndroid) { | ||
if ((data as RawKeyEventDataAndroid).keyCode == 13) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
} |