Skip to content

Commit 50267a5

Browse files
first commit
0 parents  commit 50267a5

File tree

5,103 files changed

+1126554
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

5,103 files changed

+1126554
-0
lines changed

.vscode-test.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { defineConfig } from '@vscode/test-cli';
2+
3+
export default defineConfig({
4+
files: 'out/test/**/*.test.js',
5+
});

.vscode/extensions.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
// See http://go.microsoft.com/fwlink/?LinkId=827846
3+
// for the documentation about the extensions.json format
4+
"recommendations": [
5+
"dbaeumer.vscode-eslint",
6+
"ms-vscode.extension-test-runner"
7+
]
8+
}

.vscode/launch.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// A launch configuration that compiles the extension and then opens it 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": "Run Extension",
10+
"type": "extensionHost",
11+
"request": "launch",
12+
"args": [
13+
"--extensionDevelopmentPath=${workspaceFolder}"
14+
],
15+
"outFiles": [
16+
"${workspaceFolder}/out/**/*.js"
17+
],
18+
"preLaunchTask": "${defaultBuildTask}"
19+
}
20+
]
21+
}

.vscode/settings.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Place your settings in this file to overwrite default and user settings.
2+
{
3+
"files.exclude": {
4+
"out": false // set this to true to hide the "out" folder with the compiled JS files
5+
},
6+
"search.exclude": {
7+
"out": true // set this to false to include "out" folder in search results
8+
},
9+
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
10+
"typescript.tsc.autoDetect": "off"
11+
}

.vscode/tasks.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// See https://go.microsoft.com/fwlink/?LinkId=733558
2+
// for the documentation about the tasks.json format
3+
{
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"type": "npm",
8+
"script": "watch",
9+
"problemMatcher": "$tsc-watch",
10+
"isBackground": true,
11+
"presentation": {
12+
"reveal": "never"
13+
},
14+
"group": {
15+
"kind": "build",
16+
"isDefault": true
17+
}
18+
}
19+
]
20+
}

.vscodeignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.vscode/**
2+
.vscode-test/**
3+
src/**
4+
.gitignore
5+
.yarnrc
6+
vsc-extension-quickstart.md
7+
**/tsconfig.json
8+
**/eslint.config.mjs
9+
**/*.map
10+
**/*.ts
11+
**/.vscode-test.*
12+
node_modules/**
13+
!out/extension.js
14+
!out/**/*.js
15+
!images/**

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Change Log
2+
3+
All notable changes to the "flutter-snippets-helper" extension will be documented in this file.
4+
5+
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
6+
7+
## [Unreleased]
8+
9+
- Initial release

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Flutter Snippets Helper
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.

README.md

Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
# Flutter Snippets Helper
2+
3+
Essential Flutter widget snippets for rapid development. This extension provides commonly used Flutter widgets and patterns as snippets to speed up your development workflow.
4+
5+
## Features
6+
7+
This extension includes snippets for:
8+
9+
### Basic Widgets
10+
11+
- `stless` → Creates a StatelessWidget
12+
13+
```dart
14+
class WidgetName extends StatelessWidget {
15+
const WidgetName({super.key});
16+
17+
@override
18+
Widget build(BuildContext context) {
19+
return Container();
20+
}
21+
}
22+
```
23+
24+
- `stful` → Creates a StatefulWidget
25+
26+
```dart
27+
class WidgetName extends StatefulWidget {
28+
const WidgetName({super.key});
29+
30+
@override
31+
State<WidgetName> createState() => _WidgetNameState();
32+
}
33+
34+
class _WidgetNameState extends State<WidgetName> {
35+
@override
36+
Widget build(BuildContext context) {
37+
return Container();
38+
}
39+
}
40+
```
41+
42+
### Layout Widgets
43+
44+
- `col` → Column with alignment options
45+
- `row` → Row with alignment options
46+
- `stack` → Stack with Positioned child
47+
- `cont` → Container with decoration and shadow
48+
- `responsive` → Responsive layout builder
49+
50+
### List & Grid Widgets
51+
52+
- `lvb` → ListView.builder
53+
```dart
54+
ListView.builder(
55+
itemCount: items.length,
56+
itemBuilder: (context, index) {
57+
return ListTile(
58+
title: Text('Item $index'),
59+
);
60+
},
61+
)
62+
```
63+
- `gvb` → GridView.builder with customizable parameters
64+
65+
### Navigation & Structure
66+
67+
- `scaffold` → Scaffold with AppBar and FloatingActionButton
68+
- `appbar` → Custom AppBar with leading and actions
69+
- `drawer` → Navigation Drawer with header
70+
- `tabs` → TabBar with TabBarView
71+
- `matapp` → MaterialApp with theme setup
72+
73+
### Async Widgets
74+
75+
- `fb` → FutureBuilder with loading and error handling
76+
```dart
77+
FutureBuilder<dynamic>(
78+
future: myFuture,
79+
builder: (context, snapshot) {
80+
if (snapshot.connectionState == ConnectionState.waiting) {
81+
return const CircularProgressIndicator();
82+
}
83+
if (snapshot.hasError) {
84+
return Text('Error: ${snapshot.error}');
85+
}
86+
return Container();
87+
},
88+
)
89+
```
90+
- `sb` → StreamBuilder with loading and error handling
91+
92+
### State Management
93+
94+
- `providerclass` → Provider ChangeNotifier class
95+
96+
```dart
97+
class MyProvider extends ChangeNotifier {
98+
int _value = 0;
99+
int get value => _value;
100+
101+
void updateValue(int newValue) {
102+
_value = newValue;
103+
notifyListeners();
104+
}
105+
}
106+
```
107+
108+
- `getxc` → GetX Controller class
109+
- `bloc` → BLoC class with event handler
110+
111+
### UI Components
112+
113+
- `card` → Card with padding and content
114+
- `btn` → Styled ElevatedButton
115+
- `form` → Form with validation
116+
- `animcont` → AnimatedContainer with duration
117+
- `pageview` → PageView with controller
118+
119+
## Usage
120+
121+
1. Install the extension
122+
2. Open a `.dart` file
123+
3. Start typing the snippet prefix (e.g., `stless`)
124+
4. Press `Tab` to insert the snippet
125+
5. Use `Tab` to navigate through the placeholders
126+
127+
## Examples
128+
129+
### Creating a Form
130+
131+
```dart
132+
// Type 'form' and press Tab
133+
final _formKey = GlobalKey<FormState>();
134+
135+
Form(
136+
key: _formKey,
137+
child: Column(
138+
children: [
139+
TextFormField(
140+
decoration: const InputDecoration(
141+
labelText: 'Label',
142+
hintText: 'Enter text',
143+
),
144+
validator: (value) {
145+
if (value == null || value.isEmpty) {
146+
return 'Please enter some text';
147+
}
148+
return null;
149+
},
150+
),
151+
ElevatedButton(
152+
onPressed: () {
153+
if (_formKey.currentState!.validate()) {
154+
// Process data
155+
}
156+
},
157+
child: const Text('Submit'),
158+
),
159+
],
160+
),
161+
)
162+
```
163+
164+
### Creating a Responsive Layout
165+
166+
```dart
167+
// Type 'responsive' and press Tab
168+
LayoutBuilder(
169+
builder: (context, constraints) {
170+
if (constraints.maxWidth < 600) {
171+
return // Mobile layout
172+
} else if (constraints.maxWidth < 900) {
173+
return // Tablet layout
174+
} else {
175+
return // Desktop layout
176+
}
177+
},
178+
)
179+
```
180+
181+
## Requirements
182+
183+
- VS Code 1.93.0 or higher
184+
- Dart/Flutter extension installed
185+
186+
## Known Issues
187+
188+
None at the moment. Please report any issues on our GitHub repository.
189+
190+
## Release Notes
191+
192+
### 0.0.2
193+
194+
- Added comprehensive snippets documentation
195+
- Added icon and improved package metadata
196+
- Fixed snippet formatting issues
197+
198+
### 0.0.1
199+
200+
- Initial release with essential Flutter snippets
201+
- Basic widget templates
202+
- Layout widgets
203+
- Navigation patterns
204+
- State management templates
205+
- Form and validation snippets
206+
207+
## Contributing
208+
209+
Feel free to submit issues and enhancement requests on our GitHub repository.
210+
211+
## Working with the Extension
212+
213+
- Press `Ctrl+Space` (Windows, Linux, macOS) to see all available snippets
214+
- Type the snippet prefix (e.g., `stless`) and press `Tab`
215+
- Use `Tab` to navigate through the snippet placeholders
216+
217+
## For more information
218+
219+
- [Flutter Documentation](https://flutter.dev/docs)
220+
- [VS Code Extension Guidelines](https://code.visualstudio.com/api/references/extension-guidelines)
221+
- [Extension Repository](https://github.com/yourusername/flutter-snippets-helper)
222+
223+
**Enjoy coding Flutter faster!**

eslint.config.mjs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import typescriptEslint from "@typescript-eslint/eslint-plugin";
2+
import tsParser from "@typescript-eslint/parser";
3+
4+
export default [{
5+
files: ["**/*.ts"],
6+
}, {
7+
plugins: {
8+
"@typescript-eslint": typescriptEslint,
9+
},
10+
11+
languageOptions: {
12+
parser: tsParser,
13+
ecmaVersion: 2022,
14+
sourceType: "module",
15+
},
16+
17+
rules: {
18+
"@typescript-eslint/naming-convention": ["warn", {
19+
selector: "import",
20+
format: ["camelCase", "PascalCase"],
21+
}],
22+
23+
curly: "warn",
24+
eqeqeq: "warn",
25+
"no-throw-literal": "warn",
26+
semi: "warn",
27+
},
28+
}];

0 commit comments

Comments
 (0)