-
Notifications
You must be signed in to change notification settings - Fork 320
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
Extract Widget: Update Constructor for Widget #2166
Comments
/cc @scheglov |
But in the case when the refactoring creates parameters, these parameters not just |
…h 'key'. R=devoncarew@google.com, paulberry@google.com Bug: flutter/flutter-intellij#2166 Change-Id: Ie698dc27a1328b7e18e92f46583f84c22c84de57 Reviewed-on: https://dart-review.googlesource.com/53060 Reviewed-by: Paul Berry <paulberry@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
@scheglov Fair point, might be best to mark em required since they are required in the initial extraction (not sure what ya did in that PR). As a heads up: You might need to ensure the document imports the foundation or meta packages in that case as well, since those modules define the Thanks so much for the quick response! |
More improvements for |
…required named parameters. R=brianwilkerson@google.com, pquitslund@google.com Bug: flutter/flutter-intellij#2166 Change-Id: I28f548c8e814ac5b9585dd46fbb9a8f84f70f418 Reviewed-on: https://dart-review.googlesource.com/54066 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Phil Quitslund <pquitslund@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
How can I extract a widget? In both vscode and Android Studio. |
/cc @DanTup |
Hey hey -- Another bit of feedback regarding extract widget! Thanks so much for your help and providing the functionality, really cool to use it :)
I'd love it if the new "Extract Widget" function created a constructor that follows the normal conventions for Widget constructors:
"By convention, widget constructors only use named arguments. Named arguments can be marked as required using
@required
. Also by convention, the first argument is key, and the last argument is child, children, or the equivalent."From https://docs.flutter.io/flutter/widgets/StatefulWidget-class.html
Steps to Reproduce
NewWidget(this.todo, this.taskKey, this.isEditing, this.noteKey);
NewWidget({Key key, this.todo, this.taskKey, this.isEditing, this.noteKey}) : super(key: key);
No need to add the
@required
fields, as that's more of a judgement call than an automatic refactoring.Version info
The text was updated successfully, but these errors were encountered: