Created
December 28, 2020 20:32
-
-
Save drexel-ue/a262a3ac4bd65688a4de233f9b6805a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A valid snippet should starts with: | |
# | |
# snippet trigger_word [ "description" [ options ] ] | |
# | |
# and end with: | |
# | |
# endsnippet | |
# | |
# Snippet options: | |
# | |
# b - Beginning of line. | |
# i - In-word expansion. | |
# w - Word boundary. | |
# r - Regular expression | |
# e - Custom context snippet | |
# A - Snippet will be triggered automatically, when condition matches. | |
# | |
# Basic example: | |
# | |
# snippet emitter "emitter properties" b | |
# private readonly ${1} = new Emitter<$2>() | |
# public readonly ${1/^_(.*)/$1/}: Event<$2> = this.$1.event | |
# endsnippet | |
# | |
# Online reference: https://github.com/SirVer/ultisnips/blob/master/doc/UltiSnips.txt | |
snippet stless "Create a StatelessWidget" b | |
class ${1:widgetName} extends StatelessWidget { | |
const $1({Key key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
$0 | |
} | |
} | |
endsnippet | |
snippet stful "Create a StatefulWidget" b | |
class ${1:widgetName} extends StatefulWidget { | |
const $1({Key key}) : super(Key key); | |
@override | |
_$1State createState() => _$1State(); | |
} | |
class _$1State extends State<$1> { | |
@override | |
Widget build(BuildContext context) { | |
$0 | |
} | |
} | |
endsnippet | |
snippet inits "Write initState method" b | |
@override | |
void initState() { | |
super.initState(); | |
$0 | |
} | |
endsnippet | |
snippet dis "Write dispose method" b | |
@override | |
void dispose() { | |
$0 | |
super.dispose(); | |
} | |
endsnippet | |
snippet didchdep "Write didChangeDependencies method" b | |
@override | |
void didChangeDependencies() { | |
$0 | |
super.didChangeDependencies(); | |
} | |
endsnippet | |
snippet didupdate "Write didUpdateWidget method" b | |
@override | |
void didUpdateWidget(covariant ${1:T} oldWidget) { | |
$0 | |
} | |
endsnippet | |
snippet didchapp "Write didChangeAppLifecycleState method" b | |
@override | |
void didChangeAppLifecycleState(AppLifecycleState state) { | |
$0 | |
} | |
endsnippet | |
snippet wrap "Wrap with new widget" | |
$1( | |
child: ${0:${VISUAL: widget...}} | |
), | |
endsnippet | |
snippet wColumn "Wrap with new Column" | |
Column( | |
children: <Widget>[ | |
${0:${VISUAL: widgets...}} | |
], | |
), | |
endsnippet | |
snippet wRow "Wrap with new Row" | |
Row( | |
children: <Widget>[ | |
${0:${VISUAL: widgets...}} | |
], | |
), | |
endsnippet | |
snippet wPad "Add Padding" | |
Padding( | |
padding: const EdgeInsets.all(8), | |
child: ${0:${VISUAL: widgets...}} | |
), | |
endsnippet | |
snippet wCent "Center widget" | |
Center( | |
child: ${0:${VISUAL: widgets...}} | |
), | |
endsnippet | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment