├── .gitignore ├── .vscode └── launch.json ├── .vscodeignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── media ├── icon.png └── lref.gif ├── package.json └── snippets └── binder.code-snippets /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.vsix 3 | vsc-extension-quickstart.md -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that launches the extension inside a new window 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | { 6 | "version": "0.2.0", 7 | "configurations": [ 8 | { 9 | "name": "Extension", 10 | "type": "extensionHost", 11 | "request": "launch", 12 | "args": [ 13 | "--extensionDevelopmentPath=${workspaceFolder}" 14 | ] 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | .gitignore 4 | vsc-extension-quickstart.md 5 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 | 8 | ## [Unreleased] 9 | 10 | ## [1.2.0] 11 | ### Added 12 | - Consumer & StateListener snippets. 13 | 14 | ## [1.0.0] 15 | ### Added 16 | - Initial release 17 | 18 | [Unreleased]: https://github.com/letsar/flutter-binder-snippets/compare/v1.2.0...HEAD 19 | [1.2.0]: https://github.com/letsar/flutter-binder-snippets/releases/tag/v1.2.0 20 | [1.0.0]: https://github.com/letsar/flutter-binder-snippets/releases/tag/v1.0.0 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Romain Rastel 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Flutter Binder Snippets 2 | 3 | Flutter Binder Snippets is a way to enhance the way you use Binder. It contains a collection of different 4 | snippets such as `lref`. 5 | 6 | ![lref][lref] 7 | 8 | ## Snippets 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
ShortcutDescription
lrefCreates a new LogicRef with its Logic class.
srefCreates a new StateRef with its initial state.
crefCreates a new Computed with its state builder.
bdr_consumerCreates a Consumer widget.
bdr_state_listenerCreates a StateListener widget.
38 | 39 | ## Requirements 40 | 41 | vscode: ^1.50.0 42 | 43 | ## Release Notes 44 | 45 | ### 1.2.0 46 | 47 | Added Consumer and StateListener snippets. 48 | 49 | ### 1.0.0 50 | 51 | Initial release of Flutter Binder Snippets 52 | 53 | 54 | [lref]: https://raw.githubusercontent.com/letsar/flutter-binder-snippets/main/media/lref.gif -------------------------------------------------------------------------------- /media/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letsar/flutter-binder-snippets/e245b1161f17a4f3b6a6f7d09ed47f63639f3033/media/icon.png -------------------------------------------------------------------------------- /media/lref.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letsar/flutter-binder-snippets/e245b1161f17a4f3b6a6f7d09ed47f63639f3033/media/lref.gif -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "flutter-binder-snippets", 3 | "displayName": "Flutter Binder Snippets", 4 | "description": "Quick and easy Binder snippets", 5 | "publisher": "romain-rastel", 6 | "icon": "media/icon.png", 7 | "homepage": "https://github.com/letsar/flutter-binder-snippets", 8 | "license": "SEE LICENSE IN LICENSE", 9 | "bugs": { 10 | "url": "https://github.com/letsar/flutter-binder-snippets/issues" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "https://github.com/letsar/flutter-binder-snippets" 15 | }, 16 | "keywords": [ 17 | "flutter", 18 | "dart", 19 | "binder" 20 | ], 21 | "version": "1.2.0", 22 | "engines": { 23 | "vscode": "^1.50.0" 24 | }, 25 | "categories": [ 26 | "Snippets" 27 | ], 28 | "contributes": { 29 | "snippets": [ 30 | { 31 | "language": "dart", 32 | "path": "./snippets/binder.code-snippets" 33 | } 34 | ] 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /snippets/binder.code-snippets: -------------------------------------------------------------------------------- 1 | { 2 | "create LogicRef": { 3 | "scope": "dart", 4 | "prefix": "lref", 5 | "description": "Creates a new LogicRef with its Logic class", 6 | "body": [ 7 | "final ${1}Ref = LogicRef((scope) => ${1/(.*)/${1:/capitalize}/}(scope));", 8 | "", 9 | "class ${1/(.*)/${1:/capitalize}/} with Logic {", 10 | " const ${1/(.*)/${1:/capitalize}/}(this.scope);", 11 | "", 12 | " @override", 13 | " final Scope scope;", 14 | "", 15 | " $2", 16 | "}", 17 | "" 18 | ] 19 | }, 20 | "create StateRef": { 21 | "scope": "dart", 22 | "prefix": "sref", 23 | "description": "Creates a new StateRef with its initial state", 24 | "body": [ 25 | "final ${1}Ref = StateRef($2);", 26 | ] 27 | }, 28 | "create Computed": { 29 | "scope": "dart", 30 | "prefix": "cref", 31 | "description": "Creates a new Computed with its state builder", 32 | "body": [ 33 | "final ${1}Ref = Computed((watch){", 34 | " $2", 35 | "});", 36 | ] 37 | }, 38 | "create StateListener": { 39 | "scope": "dart", 40 | "prefix": "bdr_state_listener", 41 | "description": "Creates a StateListener widget", 42 | "body": [ 43 | "StateListener<$1>(", 44 | " watchable: $2,", 45 | " onStateChanged: (context, state) {", 46 | " $3", 47 | " },", 48 | ")", 49 | ] 50 | }, 51 | "create Consumer": { 52 | "scope": "dart", 53 | "prefix": "bdr_consumer", 54 | "description": "Creates a Consumer widget", 55 | "body": [ 56 | "Consumer<$1>(", 57 | " watchable: $2,", 58 | " builder: (context, state, child) {", 59 | " return $3;", 60 | " },", 61 | ")", 62 | ] 63 | }, 64 | } --------------------------------------------------------------------------------