74 lines
2.6 KiB
Plaintext
74 lines
2.6 KiB
Plaintext
{
|
|
// Place your snippets for dart here. Each snippet is defined under a snippet name and has a prefix, body and
|
|
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
|
|
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
|
|
// same ids are connected.
|
|
// Example:
|
|
// "Print to console": {
|
|
// "prefix": "log",
|
|
// "body": [
|
|
// "console.log('$1');",
|
|
// "$2"
|
|
// ],
|
|
// "description": "Log output to console"
|
|
// }
|
|
"Stateless Widget": {
|
|
"prefix": "stateless",
|
|
"body": [
|
|
"import 'package:flutter/material.dart';",
|
|
"\n",
|
|
"class ${1:MyClass} extends StatelessWidget {",
|
|
"@override",
|
|
"Widget build(BuildContext context) {",
|
|
"return Container($0);}}"
|
|
]
|
|
},
|
|
"Stateful Widget": {
|
|
"prefix": "stateful",
|
|
"body": [
|
|
"import 'package:flutter/material.dart';",
|
|
"\n",
|
|
"class ${1:MyClass} extends StatefulWidget {",
|
|
"const ${1:MyClass}({Key key, $2}) : super(key: key);",
|
|
"\n",
|
|
"@override",
|
|
"_${1:MyClass}State createState() => _${1:MyClass}State();",
|
|
"}",
|
|
"\n",
|
|
"class _${1:MyClass}State extends State<${1:MyClass}> {",
|
|
"\n",
|
|
"@override",
|
|
"void initState() {",
|
|
"super.initState();",
|
|
"}",
|
|
"\n",
|
|
"@override",
|
|
"void dispose() {",
|
|
"super.dispose();",
|
|
"}",
|
|
"\n",
|
|
"@override",
|
|
"Widget build(BuildContext context) {",
|
|
"return Container($0);}}"
|
|
]
|
|
},
|
|
"Widget Test": {
|
|
"prefix": "widgettest",
|
|
"body": [
|
|
"import 'package:flutter_test/flutter_test.dart';",
|
|
"import 'package:flutter/material.dart';",
|
|
"//import 'package:piota/${1:widgetfile}.dart';",
|
|
"\n",
|
|
"import 'ui_test_util.dart';",
|
|
"\n",
|
|
"void main() {",
|
|
"group('${2:groupname}', () {",
|
|
"final testableWidget = testWidget(${3:Container()},Size(375, 667));",
|
|
"testWidgets('${3:Container()} test', (WidgetTester tester) async {",
|
|
"final finder = find.byKey(Key('${5:keyname}'));",
|
|
"await tester.pumpWidget(testableWidget);",
|
|
"expect(finder, findsOneWidget);",
|
|
"});});}"
|
|
]
|
|
}
|
|
} |