Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

VS Code Extension for Flutter

License

NotificationsYou must be signed in to change notification settings

PlugFox/flutter-plus

Repository files navigation

Extension add some useful commands to Flutter development in Visual Studio Code.

Wrap with...

This package extends your Flutter development experience by providing convenient snippets and commands for wrapping widgets with other commonly used Flutter widgets, similar to the "Wrap with..." functionality in Flutter's built-in extension for VS Code. These additions streamline the process of encapsulating your widgets within other widgets that enhance functionality or control, such as state management, repaint isolation, and more.

Simply select the widget you want to wrap, and choose the appropriate "Wrap with..." command from the command palette, or use the provided snippets to quickly insert the desired wrapper code into your widget tree.

This extension includes the following standard "Wrap with..." commands:

  • Wrap with ListenableBuilder: Easily wrap any widget with aListenableBuilder to rebuild the widget based on changes in aListenable object.
  • Wrap with ValueListenableBuilder: Automatically wrap your widget with aValueListenableBuilder to react to changes in aValueListenable<T>.
  • Wrap with RepaintBoundary: Encapsulate your widget within aRepaintBoundary to isolate its repaint process, improving performance in complex UIs.
  • Wrap with SliverPadding: Wrap your widget with aSliverPadding to add padding around a sliver widget in aCustomScrollView.

In order to add custom "Wrap with" commands, you can change the configuration influtter-plus.wraps settings. The configuration is an array of objects with the following properties:

  • name: The name of the command that will appear in the command palette.
  • body: The snippet body that will be inserted into the editor when the command is executed. Use${0...N} to indicate the position of the selected text. In order to insert the selected text, use${widget}.

Example configuration:

{"wraps": [    {"name":"Wrap with CustomWidget","body": ["CustomWidget(","  child: ${widget},",")"      ]    }  ]}

Markdown snippets

ShortcutDescription
unreleasedCreate a new unreleased section. Used to list features that are not yet released.
versionCreate a new version section. Used to list features that are released in a specific version.

Dart snippets

ShortcutDescription
mainGenerates a main function with error handling and zone management for Dart applications.
tryCreates a try-catch-finally block, useful for managing exceptions and ensuring cleanup code runs.
timeoutCreates a timeout handler for setting execution limits on asynchronous operations.
stopwatchInitializes a Stopwatch to measure and log elapsed time for code execution.
conditionalGenerates platform-specific imports based on the environment (VM or JS), ensuring compatibility across different platforms.
dvdInserts a divider comment line, useful for visually separating sections of code.
reverseListGenerates a loop for traversing a list in reverse order.
partAdds a part directive to include the specified Dart file as part of the current library.
mocksImports a Dart file containing mock implementations for testing purposes.
toStrOverrides thetoString method for a custom object, providing a string representation of the object for debugging or logging.
equalsGenerates hash code and equals methods, overriding the== operator and thehashCode getter for custom object comparison.
nosmImplements thenoSuchMethod method, handling calls to non-existent methods or properties.
testCreates a test function, setting up a basic test case using thetest package.
pragmaInserts a pragma directive to optimize or modify Dart VM/compiler behavior based on the specified options.
doc-disabledAdds a comment annotation to disable documentation generation for the specified block of code.
doc-categoryCategorizes a block of documentation with the specified category or subcategory tags.
doc-imageEmbeds an image within a block of documentation, using the specified URL as the source.
doc-animationEmbeds an animation within a block of documentation, with options for specifying the size and source URL.
doc-htmlInjects custom HTML into a documentation comment, allowing for rich formatting or content inclusion.
newtmplCreates a new Dart documentation template with the current file's name as the prefix, useful for reusing content across multiple documentation blocks.
usetmplInserts an existing Dart documentation macro, using the current file's name as the prefix, to maintain consistency in documentation.
deprecatedMarks a class, method, or property as deprecated, indicating that it should no longer be used and may be removed in future versions.
metaApplies a meta annotation to a class, method, or property, providing additional metadata for tooling or code analysis purposes.
coverageAdds a coverage annotation to mark lines or blocks of code that should be ignored by test coverage tools.

Flutter snippets

ShortcutDescription
mateappCreates a newMaterialApp widget, an application that uses Material Design components and theming.
cupeappCreates a newCupertinoApp widget, an application that uses Cupertino (iOS-style) design components and theming.
scaffoldCreates a newScaffold widget, implementing the basic Material Design visual layout structure including app bar, drawer, and floating action button.
stlGenerates a newStatelessWidget class, a widget that does not require mutable state and is rebuilt only when the configuration changes.
stlChildGenerates a newStatelessWidget class with a child widget, for cases where a single child widget needs to be passed and rendered.
stfGenerates a newStatefulWidget class, a widget that has mutable state that can change over time, and its associatedState class.
stfChildGenerates a newStatefulWidget class with a child widget, allowing for a stateful widget to have a single child widget passed in and managed.
inhCreates a newInheritedWidget class, which efficiently propagates information down the widget tree to descendants.
ofGenerates a staticof method for anInheritedWidget, returning the nearest widget of the specified type and creating a dependency on it.
stateOfGenerates a staticstateOf method for aState object, returning theState object of the nearest ancestorStatefulWidget of the specified type.
widgetOfGenerates a staticwidgetOf method for aWidget object, returning the nearest ancestor widget of the specified type.
painterCreates a newCustomPainter class, which provides a canvas on which to draw during the paint phase, used for drawing custom shapes and graphics.
clipperCreates a newCustomClipper class, used for defining custom clipping shapes for widgets.
debugFillPropertiesGenerates adebugFillProperties method to add additional properties associated with the widget for debugging purposes.
initSCreates aninitState method, called when this object is inserted into the widget tree for the first time, typically used to initialize state.
disposeCreates adispose method, called when this object is permanently removed from the widget tree, used for cleanup of resources.
reassembleCreates areassemble method, called during debugging whenever the application is reassembled, for example, during a hot reload.
didChangeDCreates adidChangeDependencies method, called when a dependency of theState object changes.
didUpdateWCreates adidUpdateWidget method, called whenever the widget’s configuration changes.
buildGenerates abuild method, describing the part of the user interface represented by this widget.
listViewBuilderCreates aListView.builder, a scrollable list that lazily builds its children as they scroll into view, useful for large or infinite lists.
listViewSeparatedCreates aListView.separated, a scrollable list that displays a separator widget between each child widget, ideal for lists with visually distinct sections.
gridViewBuilderCreates aGridView.builder, a scrollable grid of widgets that are created on demand.
gridViewCountCreates aGridView.count, a scrollable grid of widgets with a fixed number of tiles in the cross axis.
gridViewECreates aGridView.extent, a scrollable grid of widgets with tiles that each have a maximum cross-axis extent.
customScrollVCreates aCustomScrollView, a scrollable area that creates custom scroll effects using slivers.
builderCreates aBuilder widget, which allows you to create a child widget in a way that depends on theBuildContext.
wrapWithBuilderWraps the selected widget with aBuilder widget, delegating the widget building process to a callback.
stfBuilderCreates aStatefulBuilder widget, which allows for state management and rebuilding a specific portion of the widget tree.
strBuilderCreates aStreamBuilder widget, which rebuilds itself based on the latest snapshot of interaction with aStream.
lisBuilderCreates aListenableBuilder widget, which rebuilds itself based on the latest value of aListenable it listens to.
valLisBuilderCreates aValueListenableBuilder widget, which rebuilds itself based on the latest value of aValueListenable.
animBuilderCreates anAnimatedBuilder widget, which rebuilds itself based on an animation.
switcherCreates anAnimatedSwitcher widget, which switches between two children and animates the transition between them.
orientBuilderCreates anOrientationBuilder widget, which rebuilds itself based on the latest orientation of the device (portrait or landscape).
layBuilderCreates aLayoutBuilder widget, which rebuilds itself based on the latest layout constraints, useful for responsive layouts.
repBoundCreates aRepaintBoundary widget, which isolates repaints so that a repaint of one child is separate from others, improving performance.
singleChildSVCreates aSingleChildScrollView widget, which allows a single child to be scrolled.
futBuilderCreates aFutureBuilder widget, which rebuilds itself based on the latest snapshot of interaction with aFuture.
tweenAnimBuilderCreates aTweenAnimationBuilder widget, which animates a property of a widget to a target value whenever the target value changes.
testWidgetCreates atestWidgets function for testing a widget, typically used in Flutter's unit testing framework.
rowCreates aRow widget, which displays its children in a horizontal array.
colCreates aColumn widget, which displays its children in a vertical array.
wrapCreates aWrap widget, which displays its children in multiple horizontal or vertical runs, wrapping to the next line when necessary.
stackCreates aStack widget, which allows you to place widgets on top of each other in a z-order.
fittedboxCreates aFittedBox widget, which scales and positions its child within itself according to the specified fit.

[8]ページ先頭

©2009-2025 Movatter.jp