Skip to content

Commit

Permalink
more dart snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
theniceboy committed Aug 8, 2021
1 parent bc1854a commit 9d10594
Showing 1 changed file with 46 additions and 2 deletions.
48 changes: 46 additions & 2 deletions Ultisnips/dart.snippets
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,41 @@ import 'package:flutter/material.dart';

endsnippet

snippet fn "Async Function"
void ${1:func}() {
${0}
}

endsnippet
snippet afn "Async Function"
Future<void> ${1:func}() async {
${0}
}

endsnippet

snippet msa "MaterialStateProperty.all"
MaterialStateProperty.all(${0}),
endsnippet

snippet msr "MaterialStateProperty.resolveWith"
MaterialStateProperty.resolveWith<${1}>((states) => states.contains(MaterialState.pressed) ? null : null),
endsnippet

snippet wh "Width and height"
width: ${1},
height: ${0},
endsnippet

snippet iwh "Infinity Width and height"
width: double.infinity,
height: double.infinity,
endsnippet

snippet oprs "onPressed"
final void Function() onPressed;
endsnippet

snippet pa "Padding"
padding: EdgeInsets.only(${1:left: ${2:0}}${3:, right: ${4:0}}${5:, top: ${6:0}}${7:, bottom: ${8:0}}),
endsnippet
Expand Down Expand Up @@ -207,12 +237,22 @@ TextStyle(
);${0}
endsnippet


snippet nbuilder "NotifierBuilder"
return NotifierBuilder(
notifier: null,
builder: (context) {
return Container();
},
);
endsnippet

snippet sw "SizedBox with width"
SizedBox(width: ${1}),${0}
const SizedBox(width: ${1}),${0}
endsnippet

snippet sh "SizedBox with height"
SizedBox(height: ${1}),${0}
const SizedBox(height: ${1}),${0}
endsnippet

snippet swh "SizedBox with width and height"
Expand Down Expand Up @@ -396,6 +436,10 @@ snippet f "Function"
() =>
endsnippet

snippet adelay "await Future.delayed"
await Future.delayed(const Duration(milliseconds: ${1:300}));
endsnippet

snippet delay "Future.delayed"
Future.delayed(const Duration(milliseconds: ${1:300})).then((_) {
${2}
Expand Down

0 comments on commit 9d10594

Please sign in to comment.