Skip to content

Latest commit

 

History

History
57 lines (47 loc) · 1.02 KB

CONTRIBUTING.md

File metadata and controls

57 lines (47 loc) · 1.02 KB

How to

How to add widget wrappper

  1. Add command to package.json
{
  "contributes": {
    "commands": [
      {
        "command": "flutter-plus.wrap-listenablebuilder",
        "title": "Wrap with ListenableBuilder"
      }
    ]
  }
}
  1. Add snippet to src/commands/wrap-with.command.ts
const snippetListenableBuilder = (widget: string) => {
  return `ListenableBuilder(
  listenable: \${1:listenable},
  builder: (context, _) =>
    ${widget},
)`;
};

export const wrapWithListenableBuilder = async () =>
  wrapWith(snippetListenableBuilder);
  1. Add action to src/code-actions/code-action-wrap.ts
  return [
      {
          command: "flutter-plus.wrap-listenablebuilder",
          title: "Wrap with ListenableBuilder",
      }
  ]
  1. Add command to src/extension.ts
export function activate(context: vscode.ExtensionContext) {
  context.subscriptions.push(
    commands.registerCommand(
      "flutter-plus.wrap-listenablebuilder",
      wrapWithListenableBuilder
    )
  );
}