mirror of
https://github.com/amix/vimrc
synced 2024-12-24 02:43:08 +00:00
59 lines
1.1 KiB
Text
59 lines
1.1 KiB
Text
# Snippets for dart in flutter project, to use add the following to your .vimrc
|
|
# `autocmd BufRead,BufNewFile,BufEnter *.dart UltiSnipsAddFiletypes dart-flutter`
|
|
# Flutter stateless widget
|
|
snippet stless
|
|
class $1 extends StatelessWidget {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
$2
|
|
);
|
|
}
|
|
}
|
|
|
|
# Flutter stateful widget
|
|
snippet stful
|
|
class $1 extends StatefulWidget {
|
|
@override
|
|
_$1State createState() => _$1State();
|
|
}
|
|
|
|
class _$1State extends State<$1> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
$2
|
|
);
|
|
}
|
|
}
|
|
|
|
# Flutter widget with AnimationController
|
|
snippet stanim
|
|
class $1 extends StatefulWidget {
|
|
@override
|
|
_$1State createState() => _$1State();
|
|
}
|
|
|
|
class _$1State extends State<$1>
|
|
with SingleTickerProviderStateMixin {
|
|
AnimationController _controller;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_controller = AnimationController(vsync: this);
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
super.dispose();
|
|
_controller.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
$2
|
|
);
|
|
}
|
|
}
|