flutter / flutter/flutter-intellij

How to implement functionality similar to "Wrap with Center" in a flutter IntelliJ plugin?

Open
#6,688 15 comments 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
2k
Forks
356
Avg merge
1d 11h
Merged PRs (30d)
27

Description

Flutter IntelliJ plugin's functionality "Wrap with a widget..." has improved my productivity and developer experience. Thanks, everyone! I would like to extend this "Wrap with.." functionality to other custom widgets (internal design system components) that I tend to use frequently. Hence I would like to implement this functionality as a separate plugin. Please direct me to any documentation on how I can implement this (as an intentional action maybe?).

I was able to find the source code of the implementation:https://github.com/flutter/flutter-intellij/blob/d89a28108349ece4501d4bcbfe269ac460c240ea/flutter-idea/src/io/flutter/preview/WidgetEditToolbar.java#L305-L323

But I am struggling to understand how I can replicate or reuse or extend it in the plugin I am developing.

## Steps to Reproduce

1. On an existing flutter project in Android Studio set the dart file editor cursor on any widget in the widget class
2. Android studio will suggest some quick actions in an indicator
3. On clicking a menu with various "Wrap with..", "Swap..", "Move..", "Remove" quick actions will be listed to refactor your widgets

_Screen-Grab_:

Screenshot 2023-03-21 at 10 57 43 PM

## Version info

```
[✓] Flutter (Channel stable, 3.7.7, on macOS 13.2.1 22D68 darwin-arm64, locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.3.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.3.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.3.2)
[✓] VS Code (version 1.75.1)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

• No issues found!
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.