Add Sample code to SlideTransition (#41009)

This commit is contained in:
Michael Goderbauer
2019-09-24 12:38:45 -07:00
committed by GitHub
parent 43932aa2ca
commit 81e693a7fe
3 changed files with 88 additions and 0 deletions

View File

@@ -101,6 +101,11 @@ follows:
`stateful_widget_scaffold`, except that it wraps the stateful widget with a
`Scaffold` _and_ a `Center`.
- [`stateful_widget_scaffold_center_freeform_state`](stateful_widget_scaffold_center_freeform_state.tmpl) :
Similar to `stateful_widget_scaffold_center` except that the code block has
to contain the entire state class defined as:
`class _MyStatefulWidgetState extends State<MyStatefulWidget>`
- [`stateless_widget_scaffold`](stateless_widget_scaffold.tmpl) : Similar to
`stateless_widget_material`, except that it wraps the stateless widget with a
`Scaffold`.

View File

@@ -0,0 +1,38 @@
// Flutter code sample for {{id}}
{{description}}
import 'package:flutter/material.dart';
{{code-imports}}
void main() => runApp(new MyApp());
/// This Widget is the main application widget.
class MyApp extends StatelessWidget {
static const String _title = 'Flutter Code Sample';
@override
Widget build(BuildContext context) {
return MaterialApp(
title: _title,
home: Scaffold(
appBar: AppBar(title: const Text(_title)),
body: Center(
child: MyStatefulWidget(),
),
),
);
}
}
{{code-preamble}}
class MyStatefulWidget extends StatefulWidget {
MyStatefulWidget({Key key}) : super(key: key);
@override
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
}
{{code}}