flutter/dev/snippets/config/templates/stateless_widget.tmpl
Greg Spencer a6e901130e
Convert existing '## Sample code' samples to '{@tool sample}...{@end-tool}' form. (#24077)
This converts existing ## Sample code samples to {@tool sample}...{@end-tool} form.

Also:
1. Fixed a minor bug in analyze-sample-code.dart
2. Made the snippet tool only insert descriptions if the description is non-empty.
3. Moved the Card diagram to before the code sample.
2018-11-07 20:35:10 -08:00

31 lines
631 B
Cheetah

{{description}}
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter Code Sample for {{id}}',
theme: new ThemeData(
primarySwatch: Colors.blue,
),
home: new MyStatelessWidget(),
);
}
}
{{code-preamble}}
class MyStatelessWidget extends StatelessWidget {
MyStatelessWidget({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return {{code}};
}
}