stateful_widget_material_ticker.tmpl 1.03 KB
Newer Older
1 2
// Flutter code sample for {{element}}
//
3 4
{{description}}

5
{{code-dartImports}}
6

7
import 'package:flutter/material.dart';
8 9
{{code-imports}}

10
void main() => runApp(const MyApp());
11

12
/// This is the main application widget.
13
class MyApp extends StatelessWidget {
14 15
  const MyApp({Key? key}) : super(key: key);

16 17 18 19
  static const String _title = 'Flutter Code Sample';

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

{{code-preamble}}

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

  @override
34
  State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
35 36
}

37 38
/// This is the private State class that goes with MyStatefulWidget.
/// AnimationControllers can be created with `vsync: this` because of TickerProviderStateMixin.
39
class _MyStatefulWidgetState extends State<MyStatefulWidget> with TickerProviderStateMixin {
40
{{code}}
41
}