Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
0220afdd
Unverified
Commit
0220afdd
authored
Dec 20, 2022
by
Michael Goderbauer
Committed by
GitHub
Dec 20, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enable use_enums (#117376)
parent
e0742ebb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
37 deletions
+33
-37
analysis_options.yaml
analysis_options.yaml
+1
-1
hardware_keyboard.dart
packages/flutter/lib/src/services/hardware_keyboard.dart
+11
-12
daemon.dart
packages/flutter_tools/lib/src/commands/daemon.dart
+4
-7
device.dart
packages/flutter_tools/lib/src/device.dart
+17
-17
No files found.
analysis_options.yaml
View file @
0220afdd
...
...
@@ -223,7 +223,7 @@ linter:
-
use_build_context_synchronously
# - use_colored_box # not yet tested
# - use_decorated_box # leads to bugs: DecoratedBox and Container are not equivalent (Container inserts extra padding)
# - use_enums # not yet tested
-
use_enums
-
use_full_hex_values_for_flutter_colors
-
use_function_type_syntax_for_parameters
-
use_if_null_to_convert_nulls_to_bools
...
...
packages/flutter/lib/src/services/hardware_keyboard.dart
View file @
0220afdd
...
...
@@ -26,34 +26,33 @@ export 'raw_keyboard.dart' show RawKeyEvent, RawKeyboard;
/// Only a limited number of modes are supported, which are enumerated as
/// static members of this class. Manual constructing of this class is
/// prohibited.
@immutable
class
KeyboardLockMode
{
// KeyboardLockMode has a fixed pool of supported keys, enumerated as static
// members of this class, therefore constructing is prohibited.
const
KeyboardLockMode
.
_
(
this
.
logicalKey
);
/// The logical key that triggers this lock mode.
final
LogicalKeyboardKey
logicalKey
;
enum
KeyboardLockMode
{
/// Represents the number lock mode on the keyboard.
///
/// On supporting systems, enabling number lock mode usually allows key
/// presses of the number pad to input numbers, instead of acting as up, down,
/// left, right, page up, end, etc.
static
const
KeyboardLockMode
numLock
=
KeyboardLockMode
.
_
(
LogicalKeyboardKey
.
numLock
);
numLock
.
_
(
LogicalKeyboardKey
.
numLock
),
/// Represents the scrolling lock mode on the keyboard.
///
/// On supporting systems and applications (such as a spreadsheet), enabling
/// scrolling lock mode usually allows key presses of the cursor keys to
/// scroll the document instead of the cursor.
s
tatic
const
KeyboardLockMode
scrollLock
=
KeyboardLockMode
.
_
(
LogicalKeyboardKey
.
scrollLock
);
s
crollLock
.
_
(
LogicalKeyboardKey
.
scrollLock
),
/// Represents the capital letters lock mode on the keyboard.
///
/// On supporting systems, enabling capital lock mode allows key presses of
/// the letter keys to input uppercase letters instead of lowercase.
static
const
KeyboardLockMode
capsLock
=
KeyboardLockMode
.
_
(
LogicalKeyboardKey
.
capsLock
);
capsLock
.
_
(
LogicalKeyboardKey
.
capsLock
);
// KeyboardLockMode has a fixed pool of supported keys, enumerated as static
// members of this class, therefore constructing is prohibited.
const
KeyboardLockMode
.
_
(
this
.
logicalKey
);
/// The logical key that triggers this lock mode.
final
LogicalKeyboardKey
logicalKey
;
static
final
Map
<
int
,
KeyboardLockMode
>
_knownLockModes
=
<
int
,
KeyboardLockMode
>{
numLock
.
logicalKey
.
keyId
:
numLock
,
...
...
packages/flutter_tools/lib/src/commands/daemon.dart
View file @
0220afdd
...
...
@@ -1565,14 +1565,11 @@ class LogMessage {
}
/// The method by which the Flutter app was launched.
class
LaunchMode
{
const
LaunchMode
.
_
(
this
.
_value
);
/// The app was launched via `flutter run`.
static
const
LaunchMode
run
=
LaunchMode
.
_
(
'run'
);
enum
LaunchMode
{
run
.
_
(
'run'
),
attach
.
_
(
'attach'
);
/// The app was launched via `flutter attach`.
static
const
LaunchMode
attach
=
LaunchMode
.
_
(
'attach'
);
const
LaunchMode
.
_
(
this
.
_value
);
final
String
_value
;
...
...
packages/flutter_tools/lib/src/device.dart
View file @
0220afdd
...
...
@@ -23,12 +23,12 @@ import 'vmservice.dart';
DeviceManager
?
get
deviceManager
=>
context
.
get
<
DeviceManager
>();
/// A description of the kind of workflow the device supports.
class
Category
{
const
Category
.
_
(
this
.
value
);
enum
Category
{
web
.
_
(
'web'
),
desktop
.
_
(
'desktop'
),
mobile
.
_
(
'mobile'
);
static
const
Category
web
=
Category
.
_
(
'web'
);
static
const
Category
desktop
=
Category
.
_
(
'desktop'
);
static
const
Category
mobile
=
Category
.
_
(
'mobile'
);
const
Category
.
_
(
this
.
value
);
final
String
value
;
...
...
@@ -36,7 +36,7 @@ class Category {
String
toString
()
=>
value
;
static
Category
?
fromString
(
String
category
)
{
return
<
String
,
Category
>{
return
const
<
String
,
Category
>{
'web'
:
web
,
'desktop'
:
desktop
,
'mobile'
:
mobile
,
...
...
@@ -45,17 +45,17 @@ class Category {
}
/// The platform sub-folder that a device type supports.
class
PlatformType
{
const
PlatformType
.
_
(
this
.
value
);
enum
PlatformType
{
web
.
_
(
'web'
),
android
.
_
(
'android'
),
ios
.
_
(
'ios'
),
linux
.
_
(
'linux'
),
macos
.
_
(
'macos'
),
windows
.
_
(
'windows'
),
fuchsia
.
_
(
'fuchsia'
),
custom
.
_
(
'custom'
);
static
const
PlatformType
web
=
PlatformType
.
_
(
'web'
);
static
const
PlatformType
android
=
PlatformType
.
_
(
'android'
);
static
const
PlatformType
ios
=
PlatformType
.
_
(
'ios'
);
static
const
PlatformType
linux
=
PlatformType
.
_
(
'linux'
);
static
const
PlatformType
macos
=
PlatformType
.
_
(
'macos'
);
static
const
PlatformType
windows
=
PlatformType
.
_
(
'windows'
);
static
const
PlatformType
fuchsia
=
PlatformType
.
_
(
'fuchsia'
);
static
const
PlatformType
custom
=
PlatformType
.
_
(
'custom'
);
const
PlatformType
.
_
(
this
.
value
);
final
String
value
;
...
...
@@ -63,7 +63,7 @@ class PlatformType {
String
toString
()
=>
value
;
static
PlatformType
?
fromString
(
String
platformType
)
{
return
<
String
,
PlatformType
>{
return
const
<
String
,
PlatformType
>{
'web'
:
web
,
'android'
:
android
,
'ios'
:
ios
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment