Essential Flutter widget snippets for rapid development. This extension provides commonly used Flutter widgets and patterns as snippets to speed up your development workflow.
This extension includes snippets for:
-
stless
→ Creates a StatelessWidgetclass WidgetName extends StatelessWidget { const WidgetName({super.key}); @override Widget build(BuildContext context) { return Container(); } }
-
stful
→ Creates a StatefulWidgetclass WidgetName extends StatefulWidget { const WidgetName({super.key}); @override State<WidgetName> createState() => _WidgetNameState(); } class _WidgetNameState extends State<WidgetName> { @override Widget build(BuildContext context) { return Container(); } }
col
→ Column with alignment optionsrow
→ Row with alignment optionsstack
→ Stack with Positioned childcont
→ Container with decoration and shadowresponsive
→ Responsive layout builder
lvb
→ ListView.builderListView.builder( itemCount: items.length, itemBuilder: (context, index) { return ListTile( title: Text('Item $index'), ); }, )
gvb
→ GridView.builder with customizable parameters
scaffold
→ Scaffold with AppBar and FloatingActionButtonappbar
→ Custom AppBar with leading and actionsdrawer
→ Navigation Drawer with headertabs
→ TabBar with TabBarViewmatapp
→ MaterialApp with theme setup
fb
→ FutureBuilder with loading and error handlingFutureBuilder<dynamic>( future: myFuture, builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { return const CircularProgressIndicator(); } if (snapshot.hasError) { return Text('Error: ${snapshot.error}'); } return Container(); }, )
sb
→ StreamBuilder with loading and error handling
-
providerclass
→ Provider ChangeNotifier classclass MyProvider extends ChangeNotifier { int _value = 0; int get value => _value; void updateValue(int newValue) { _value = newValue; notifyListeners(); } }
-
getxc
→ GetX Controller class -
bloc
→ BLoC class with event handler
card
→ Card with padding and contentbtn
→ Styled ElevatedButtonform
→ Form with validationanimcont
→ AnimatedContainer with durationpageview
→ PageView with controller
- Install the extension
- Open a
.dart
file - Start typing the snippet prefix (e.g.,
stless
) - Press
Tab
to insert the snippet - Use
Tab
to navigate through the placeholders
// Type 'form' and press Tab
final _formKey = GlobalKey<FormState>();
Form(
key: _formKey,
child: Column(
children: [
TextFormField(
decoration: const InputDecoration(
labelText: 'Label',
hintText: 'Enter text',
),
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter some text';
}
return null;
},
),
ElevatedButton(
onPressed: () {
if (_formKey.currentState!.validate()) {
// Process data
}
},
child: const Text('Submit'),
),
],
),
)
// Type 'responsive' and press Tab
LayoutBuilder(
builder: (context, constraints) {
if (constraints.maxWidth < 600) {
return // Mobile layout
} else if (constraints.maxWidth < 900) {
return // Tablet layout
} else {
return // Desktop layout
}
},
)
- VS Code 1.93.0 or higher
- Dart/Flutter extension installed
None at the moment. Please report any issues on our GitHub repository.
- Added comprehensive snippets documentation
- Added icon and improved package metadata
- Fixed snippet formatting issues
- Initial release with essential Flutter snippets
- Basic widget templates
- Layout widgets
- Navigation patterns
- State management templates
- Form and validation snippets
Feel free to submit issues and enhancement requests on our GitHub repository.
- Press
Ctrl+Space
(Windows, Linux, macOS) to see all available snippets - Type the snippet prefix (e.g.,
stless
) and pressTab
- Use
Tab
to navigate through the snippet placeholders
Enjoy coding Flutter faster!