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
612ef209
Unverified
Commit
612ef209
authored
Dec 21, 2020
by
J-P Nurmi
Committed by
GitHub
Dec 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] use 1-based index for device selection (#72189)
parent
e0462c6c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
14 deletions
+14
-14
device.dart
packages/flutter_tools/lib/src/device.dart
+3
-3
device_test.dart
packages/flutter_tools/test/general.shard/device_test.dart
+11
-11
No files found.
packages/flutter_tools/lib/src/device.dart
View file @
612ef209
...
...
@@ -305,11 +305,11 @@ abstract class DeviceManager {
if
(
userInput
.
toLowerCase
()
==
'q'
)
{
throwToolExit
(
''
);
}
return
devices
[
int
.
parse
(
userInput
)];
return
devices
[
int
.
parse
(
userInput
)
-
1
];
}
void
_displayDeviceOptions
(
List
<
Device
>
devices
)
{
int
count
=
0
;
int
count
=
1
;
for
(
final
Device
device
in
devices
)
{
_logger
.
printStatus
(
_userMessages
.
flutterChooseDevice
(
count
,
device
.
name
,
device
.
id
));
count
++;
...
...
@@ -319,7 +319,7 @@ abstract class DeviceManager {
Future
<
String
>
_readUserInput
(
int
deviceCount
)
async
{
_terminal
.
usesTerminalUi
=
true
;
final
String
result
=
await
_terminal
.
promptForCharInput
(
<
String
>[
for
(
int
i
=
0
;
i
<
deviceCount
;
i
++)
'
$
i
'
,
'q'
,
'Q'
],
<
String
>[
for
(
int
i
=
0
;
i
<
deviceCount
;
i
++)
'
$
{i + 1}
'
,
'q'
,
'Q'
],
displayAcceptedCharacters:
false
,
logger:
_logger
,
prompt:
_userMessages
.
flutterChooseOne
,
...
...
packages/flutter_tools/test/general.shard/device_test.dart
View file @
612ef209
...
...
@@ -183,11 +183,11 @@ void main() {
];
final
MockTerminal
mockTerminal
=
MockTerminal
();
when
(
mockTerminal
.
stdinHasTerminal
).
thenReturn
(
true
);
when
(
mockTerminal
.
promptForCharInput
(<
String
>[
'
0'
,
'1
'
,
'q'
,
'Q'
],
when
(
mockTerminal
.
promptForCharInput
(<
String
>[
'
1'
,
'2
'
,
'q'
,
'Q'
],
displayAcceptedCharacters:
false
,
logger:
anyNamed
(
'logger'
),
prompt:
anyNamed
(
'prompt'
),
)).
thenAnswer
((
Invocation
invocation
)
async
=>
'
0
'
);
)).
thenAnswer
((
Invocation
invocation
)
async
=>
'
1
'
);
final
DeviceManager
deviceManager
=
TestDeviceManager
(
devices
,
...
...
@@ -209,11 +209,11 @@ void main() {
final
MockTerminal
mockTerminal
=
MockTerminal
();
when
(
mockTerminal
.
stdinHasTerminal
).
thenReturn
(
true
);
when
(
mockTerminal
.
promptForCharInput
(<
String
>[
'
0'
,
'1
'
,
'q'
,
'Q'
],
when
(
mockTerminal
.
promptForCharInput
(<
String
>[
'
1'
,
'2
'
,
'q'
,
'Q'
],
displayAcceptedCharacters:
false
,
logger:
anyNamed
(
'logger'
),
prompt:
anyNamed
(
'prompt'
),
)).
thenAnswer
((
Invocation
invocation
)
async
=>
'
1
'
);
)).
thenAnswer
((
Invocation
invocation
)
async
=>
'
2
'
);
final
DeviceManager
deviceManager
=
TestDeviceManager
(
devices
,
...
...
@@ -236,11 +236,11 @@ void main() {
final
MockTerminal
mockTerminal
=
MockTerminal
();
when
(
mockTerminal
.
stdinHasTerminal
).
thenReturn
(
true
);
when
(
mockTerminal
.
promptForCharInput
(<
String
>[
'
0'
,
'1
'
,
'q'
,
'Q'
],
when
(
mockTerminal
.
promptForCharInput
(<
String
>[
'
1'
,
'2
'
,
'q'
,
'Q'
],
displayAcceptedCharacters:
false
,
logger:
anyNamed
(
'logger'
),
prompt:
anyNamed
(
'prompt'
),
)).
thenAnswer
((
Invocation
invocation
)
async
=>
'
0
'
);
)).
thenAnswer
((
Invocation
invocation
)
async
=>
'
1
'
);
final
DeviceManager
deviceManager
=
TestDeviceManager
(
devices
,
...
...
@@ -262,11 +262,11 @@ void main() {
final
MockTerminal
mockTerminal
=
MockTerminal
();
when
(
mockTerminal
.
stdinHasTerminal
).
thenReturn
(
true
);
when
(
mockTerminal
.
promptForCharInput
(<
String
>[
'
0'
,
'1
'
,
'q'
,
'Q'
],
when
(
mockTerminal
.
promptForCharInput
(<
String
>[
'
1'
,
'2
'
,
'q'
,
'Q'
],
displayAcceptedCharacters:
false
,
logger:
anyNamed
(
'logger'
),
prompt:
anyNamed
(
'prompt'
),
)).
thenAnswer
((
Invocation
invocation
)
async
=>
'
1
'
);
)).
thenAnswer
((
Invocation
invocation
)
async
=>
'
2
'
);
final
DeviceManager
deviceManager
=
TestDeviceManager
(
devices
,
...
...
@@ -291,11 +291,11 @@ void main() {
final
MockTerminal
mockTerminal
=
MockTerminal
();
when
(
mockTerminal
.
stdinHasTerminal
).
thenReturn
(
true
);
when
(
mockTerminal
.
promptForCharInput
(<
String
>[
'
0'
,
'1'
,
'2'
,
'3
'
,
'q'
,
'Q'
],
when
(
mockTerminal
.
promptForCharInput
(<
String
>[
'
1'
,
'2'
,
'3'
,
'4
'
,
'q'
,
'Q'
],
displayAcceptedCharacters:
false
,
logger:
anyNamed
(
'logger'
),
prompt:
anyNamed
(
'prompt'
),
)).
thenAnswer
((
Invocation
invocation
)
async
=>
'
2
'
);
)).
thenAnswer
((
Invocation
invocation
)
async
=>
'
3
'
);
final
DeviceManager
deviceManager
=
TestDeviceManager
(
devices
,
...
...
@@ -319,7 +319,7 @@ void main() {
final
MockTerminal
mockTerminal
=
MockTerminal
();
when
(
mockTerminal
.
stdinHasTerminal
).
thenReturn
(
true
);
when
(
mockTerminal
.
promptForCharInput
(<
String
>[
'
0'
,
'1
'
,
'q'
,
'Q'
],
when
(
mockTerminal
.
promptForCharInput
(<
String
>[
'
1'
,
'2
'
,
'q'
,
'Q'
],
displayAcceptedCharacters:
false
,
logger:
anyNamed
(
'logger'
),
prompt:
anyNamed
(
'prompt'
),
...
...
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