stateful_widget_scaffold.tmpl 931 Bytes
Newer Older
1
/// Flutter code sample for {{element}}
2 3 4 5 6 7 8 9 10

{{description}}

import 'package:flutter/material.dart';

{{code-imports}}

void main() => runApp(new MyApp());

11
/// This is the main application widget.
12 13 14 15 16 17 18 19
class MyApp extends StatelessWidget {
  static const String _title = 'Flutter Code Sample';

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: _title,
      home: Scaffold(
20
        appBar: AppBar(title: const Text(_title)),
21 22 23 24 25 26 27 28
        body: MyStatefulWidget(),
      ),
    );
  }
}

{{code-preamble}}

29
/// This is the stateful widget that the main application instantiates.
30 31 32 33 34 35 36
class MyStatefulWidget extends StatefulWidget {
  MyStatefulWidget({Key key}) : super(key: key);

  @override
  _MyStatefulWidgetState createState() => _MyStatefulWidgetState();
}

37
/// This is the private State class that goes with MyStatefulWidget.
38 39 40
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
  {{code}}
}