Method 1
Shortcut keys:
- Windows/Linux: Put your cursor (光标) on the widget name and press Ctrl+Alt+M to extract it as a method or Ctrl+Alt+W to extract it as a widget.
- MacOS: Put your cursor (光标) on the widget name and press Option+Command+M to extract it as a method or Option+Command+W to extract it as a widget.
You can also accomplish the same thing by right clicking the widget name and choosing Refactor > Extract from the context menu.
Method 2
You can also extract a widget into a method or new widget from the Flutter Outline menu.
- Click Flutter Outline on the top left side
- Select the widget in the outline
- Right click and choose Extract method... or Extract widget...
- Give it a name