-
Notifications
You must be signed in to change notification settings - Fork 346
[devtools_app] Integrate the file_selector plugin #2506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Fixes #2149 |
b9fa43c
to
451f60a
Compare
@kenzieschmoll I added support for web, linux and macOS. I manually tested web and it works. |
451f60a
to
b618a3f
Compare
} | ||
|
||
// Only show the import button in linux, macOS and web. | ||
bool get _shouldShowImportButton => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this just be true? what will happen if someone tries to build devtools and run on windows? defaultTargetPlatform == TargetPlatform.macOS
is false when I tested on my mac.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this just be true? what will happen if someone tries to build devtools and run on windows?
If someone presses the import button in a platform that is not supported by file_selector then an Unimplemented error will be thrown.
defaultTargetPlatform == TargetPlatform.macOS is false when I tested on my mac.
Oh then I should find another way to discover the platform the project is running on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there some reason you're not using file_selector_windows
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there some reason you're not using file_selector_windows?
That's a good point. Let me add it and remove the platform validation. @kenzieschmoll does that sounds good to you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
making it work on all platforms sgtm 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
end users won't be hit by this anyway - they use DevTools on web. We mostly develop on Mac and Linux and none of us to my knowledge develop on windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just added windows and removed the platform validation. Thanks to both :)!
@stuartmorgan do you know why this might be happening? I'm providing this XTypeGroup to the plugin. |
You want I'm surprised it worked on web. Maybe there's fixup happening there? Edit: Looks like there is: |
Oh you are right. Prepending a "." to the extensions is a web only thing. It should be fine to change ".json" to "json" as the "normalization" should be handled by this. |
I changed the extension, @kenzieschmoll PTAL :) |
cc @ditman |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested manually on Mac and it works great! I assume linux would work too - maybe @jacob314 or @terrylucas could do a quick check since you already have a linux dev environment set up?
color: Theme.of(context).textTheme.headline1.color, | ||
), | ||
textAlign: TextAlign.left, | ||
Widget _buildImportedFileDisplay() => Text( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add overflow: TextOverflow.ellipsis,
to this text widget? thanks.
final acceptedTypeGroups = [ | ||
XTypeGroup(extensions: ['json']), | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you make List<String> acceptedTypeGroups
an optional parameter in the FileImportContainer
constructor that defaults to ['json']
, and use that here instead?
packages/devtools_app/pubspec.yaml
Outdated
@@ -11,23 +11,27 @@ version: 0.9.6 | |||
homepage: https://github.com/flutter/devtools | |||
|
|||
environment: | |||
sdk: '>=2.10.0 <3.0.0' | |||
sdk: ">=2.10.0 <3.0.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason for changing from ' to " ? if not, can we leave as single quotes? here, and elsewhere in pubspec.yaml
packages/devtools_app/pubspec.yaml
Outdated
dependency_overrides: | ||
# The "#OVERRIDE_FOR_DEVELOPMENT" lines are stripped out when we publish. | ||
# All overriden dependencies are published together so there is no harm | ||
# in treating them like they are part of a mono-repo while developing. | ||
# The "#OVERRIDE_FOR_DEVELOPMENT" lines are stripped out when we publish. | ||
# All overriden dependencies are published together so there is no harm | ||
# in treating them like they are part of a mono-repo while developing. | ||
devtools_server: #OVERRIDE_FOR_DEVELOPMENT | ||
path: ../devtools_server #OVERRIDE_FOR_DEVELOPMENT | ||
devtools_shared: #OVERRIDE_FOR_DEVELOPMENT | ||
path: ../devtools_shared #OVERRIDE_FOR_DEVELOPMENT | ||
devtools_testing: #OVERRIDE_FOR_DEVELOPMENT | ||
path: ../devtools_testing #OVERRIDE_FOR_DEVELOPMENT | ||
path: ../devtools_server #OVERRIDE_FOR_DEVELOPMENT | ||
devtools_shared: #OVERRIDE_FOR_DEVELOPMENT | ||
path: ../devtools_shared #OVERRIDE_FOR_DEVELOPMENT | ||
devtools_testing: #OVERRIDE_FOR_DEVELOPMENT | ||
path: ../devtools_testing #OVERRIDE_FOR_DEVELOPMENT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please revert these white space changes as well. Thank you.
final acceptedTypeGroups = [ | ||
XTypeGroup(extensions: ['json']) | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Echoing kenz's earlier review:
can you make
List<String> acceptedTypeGroups
an optional parameter in theFileImportContainer
constructor that defaults to['json']
, and use that here instead?
acceptedTypeGroups
should be defined in line ~20 of this file, and be an optional named parameter to FileImportContainer, which defaults to the current XTypeGroup of json, so they can use the FileImportContainer in other places of the App (to select TXT files or PNG or whatever) :)
d0dcc51
to
6f1081f
Compare
packages/devtools_app/lib/src/app_size/file_import_container.dart
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit - then LGTM. Thanks for your work on this!
👏 bravo! |
Fix #2505