Unverified Commit 8061894f authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

update template for gen_keycodes (#49884)

parent 8b600032
...@@ -45,7 +45,7 @@ abstract class KeyboardKey extends Diagnosticable { ...@@ -45,7 +45,7 @@ abstract class KeyboardKey extends Diagnosticable {
/// look at the physical key to make sure that regardless of the character the /// look at the physical key to make sure that regardless of the character the
/// key produces, you got the key that is in that location on the keyboard. /// key produces, you got the key that is in that location on the keyboard.
/// ///
/// {@tool snippet --template=stateful_widget_scaffold} /// {@tool sample --template=stateful_widget_scaffold}
/// This example shows how to detect if the user has selected the logical "Q" /// This example shows how to detect if the user has selected the logical "Q"
/// key. /// key.
/// ///
...@@ -127,7 +127,7 @@ class LogicalKeyboardKey extends KeyboardKey { ...@@ -127,7 +127,7 @@ class LogicalKeyboardKey extends KeyboardKey {
/// ///
/// [keyId] must not be null. /// [keyId] must not be null.
/// ///
/// {@tool sample} /// {@tool snippet}
/// To save executable size, it is recommended that the [debugName] be null in /// To save executable size, it is recommended that the [debugName] be null in
/// release mode. You can do this by using the [kReleaseMode] constant. /// release mode. You can do this by using the [kReleaseMode] constant.
/// ///
...@@ -167,12 +167,12 @@ class LogicalKeyboardKey extends KeyboardKey { ...@@ -167,12 +167,12 @@ class LogicalKeyboardKey extends KeyboardKey {
int get hashCode => keyId.hashCode; int get hashCode => keyId.hashCode;
@override @override
bool operator ==(dynamic other) { bool operator ==(Object other) {
if (other.runtimeType != runtimeType) { if (other.runtimeType != runtimeType) {
return false; return false;
} }
final LogicalKeyboardKey typedOther = other; return other is LogicalKeyboardKey
return keyId == typedOther.keyId; && other.keyId == keyId;
} }
/// Returns the [LogicalKeyboardKey] constant that matches the given ID, or /// Returns the [LogicalKeyboardKey] constant that matches the given ID, or
...@@ -246,7 +246,7 @@ class LogicalKeyboardKey extends KeyboardKey { ...@@ -246,7 +246,7 @@ class LogicalKeyboardKey extends KeyboardKey {
/// [control], so that the question "is any control key down?" can be asked. /// [control], so that the question "is any control key down?" can be asked.
static Set<LogicalKeyboardKey> collapseSynonyms(Set<LogicalKeyboardKey> input) { static Set<LogicalKeyboardKey> collapseSynonyms(Set<LogicalKeyboardKey> input) {
final Set<LogicalKeyboardKey> result = <LogicalKeyboardKey>{}; final Set<LogicalKeyboardKey> result = <LogicalKeyboardKey>{};
for (LogicalKeyboardKey key in input) { for (final LogicalKeyboardKey key in input) {
final LogicalKeyboardKey synonym = _synonyms[key]; final LogicalKeyboardKey synonym = _synonyms[key];
result.add(synonym ?? key); result.add(synonym ?? key);
} }
...@@ -331,7 +331,7 @@ class LogicalKeyboardKey extends KeyboardKey { ...@@ -331,7 +331,7 @@ class LogicalKeyboardKey extends KeyboardKey {
/// looking for "the key next next to the TAB key", since on a French keyboard, /// looking for "the key next next to the TAB key", since on a French keyboard,
/// the key next to the TAB key has an "A" on it. /// the key next to the TAB key has an "A" on it.
/// ///
/// {@tool snippet --template=stateful_widget_scaffold} /// {@tool sample --template=stateful_widget_scaffold}
/// This example shows how to detect if the user has selected the physical key /// This example shows how to detect if the user has selected the physical key
/// to the right of the CAPS LOCK key. /// to the right of the CAPS LOCK key.
/// ///
...@@ -407,7 +407,7 @@ class PhysicalKeyboardKey extends KeyboardKey { ...@@ -407,7 +407,7 @@ class PhysicalKeyboardKey extends KeyboardKey {
/// ///
/// The [usbHidUsage] must not be null. /// The [usbHidUsage] must not be null.
/// ///
/// {@tool sample} /// {@tool snippet}
/// To save executable size, it is recommended that the [debugName] be null in /// To save executable size, it is recommended that the [debugName] be null in
/// release mode. You can do this using the [kReleaseMode] constant. /// release mode. You can do this using the [kReleaseMode] constant.
/// ///
...@@ -440,12 +440,12 @@ class PhysicalKeyboardKey extends KeyboardKey { ...@@ -440,12 +440,12 @@ class PhysicalKeyboardKey extends KeyboardKey {
int get hashCode => usbHidUsage.hashCode; int get hashCode => usbHidUsage.hashCode;
@override @override
bool operator ==(dynamic other) { bool operator ==(Object other) {
if (other.runtimeType != runtimeType) { if (other.runtimeType != runtimeType) {
return false; return false;
} }
final PhysicalKeyboardKey typedOther = other; return other is PhysicalKeyboardKey
return usbHidUsage == typedOther.usbHidUsage; && other.usbHidUsage == usbHidUsage;
} }
@override @override
......
...@@ -92,4 +92,3 @@ const Map<String, PhysicalKeyboardKey> kWebToPhysicalKey = <String, PhysicalKeyb ...@@ -92,4 +92,3 @@ const Map<String, PhysicalKeyboardKey> kWebToPhysicalKey = <String, PhysicalKeyb
const Map<String, LogicalKeyboardKey> kWebNumPadMap = <String, LogicalKeyboardKey>{ const Map<String, LogicalKeyboardKey> kWebNumPadMap = <String, LogicalKeyboardKey>{
@@@WEB_NUMPAD_MAP@@@ @@@WEB_NUMPAD_MAP@@@
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment