stateless_widget.tmpl 774 Bytes
Newer Older
1 2
// Flutter code sample for {{element}}
//
3 4
{{description}}

5
{{code-dartImports}}
6

7
import 'package:flutter/widgets.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
  @override
  Widget build(BuildContext context) {
18 19
    return WidgetsApp(
      title: 'Flutter Code Sample',
20
      builder: (BuildContext context, Widget? navigator) => const MyStatelessWidget(),
21
      color: const Color(0xffffffff),
22 23 24 25 26 27
    );
  }
}

{{code-preamble}}

28
/// This is the stateless widget that the main application instantiates.
29
class MyStatelessWidget extends StatelessWidget {
30
  const MyStatelessWidget({Key? key}) : super(key: key);
31 32

  @override
33
{{code}}
34
}