diff --git a/dev/bots/test/analyze-sample-code-test-input/known_broken_documentation.dart b/dev/bots/test/analyze-sample-code-test-input/known_broken_documentation.dart index e0c67f7b00..19291b30ef 100644 --- a/dev/bots/test/analyze-sample-code-test-input/known_broken_documentation.dart +++ b/dev/bots/test/analyze-sample-code-test-input/known_broken_documentation.dart @@ -6,7 +6,6 @@ // precise contents (including especially the comments) of this file. // Examples can assume: -// // @dart = 2.9 // bool _visible = true; // class _Text extends Text { // const _Text(String text) : super(text); @@ -35,7 +34,7 @@ /// ``` /// {@end-tool} /// -/// {@tool dartpad --template=stateless_widget_material_no_null_safety} +/// {@tool dartpad --template=stateless_widget_material} /// Bla blabla blabla some [Text] when the `_blabla` blabla blabla is true, and /// blabla it when it is blabla: /// @@ -104,3 +103,32 @@ /// const text1 = _Text('Poor wandering ones!'); /// ``` /// {@end-tool} +/// +/// {@tool snippet} +/// Snippet with null-safe syntax +/// +/// ```dart +/// final String? bar = 'Hello'; +/// final int foo = null; +/// ``` +/// {@end-tool} +/// +/// {@tool dartpad --template=stateless_widget_material} +/// Dartpad with null-safe syntax +/// +/// ```dart preamble +/// bool? _visible = true; +/// final GlobalKey globalKey = GlobalKey(); +/// ``` +/// +/// ```dart +/// Widget build(BuildContext context) { +/// final String title; +/// return Opacity( +/// key: globalKey, +/// opacity: _visible! ? 1.0 : 0.0, +/// child: Text(title), +/// ); +/// } +/// ``` +/// {@end-tool} diff --git a/dev/bots/test/analyze-sample-code-test-null-safe-input/known_broken_documentation.dart b/dev/bots/test/analyze-sample-code-test-null-safe-input/known_broken_documentation.dart deleted file mode 100644 index 19291b30ef..0000000000 --- a/dev/bots/test/analyze-sample-code-test-null-safe-input/known_broken_documentation.dart +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright 2014 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// This file is used by ../analyze-sample-code_test.dart, which depends on the -// precise contents (including especially the comments) of this file. - -// Examples can assume: -// bool _visible = true; -// class _Text extends Text { -// const _Text(String text) : super(text); -// const _Text.__(String text) : super(text); -// } - -/// A blabla that blabla its blabla blabla blabla. -/// -/// Bla blabla blabla its blabla into an blabla blabla and then blabla the -/// blabla back into the blabla blabla blabla. -/// -/// Bla blabla of blabla blabla than 0.0 and 1.0, this blabla is blabla blabla -/// blabla it blabla pirates blabla the blabla into of blabla blabla. Bla the -/// blabla 0.0, the penzance blabla is blabla not blabla at all. Bla the blabla -/// 1.0, the blabla is blabla blabla blabla an blabla blabla. -/// -/// {@tool snippet} -/// Bla blabla blabla some [Text] when the `_blabla` blabla blabla is true, and -/// blabla it when it is blabla: -/// -/// ```dart -/// new Opacity( -/// opacity: _visible ? 1.0 : 0.0, -/// child: const Text('Poor wandering ones!'), -/// ) -/// ``` -/// {@end-tool} -/// -/// {@tool dartpad --template=stateless_widget_material} -/// Bla blabla blabla some [Text] when the `_blabla` blabla blabla is true, and -/// blabla it when it is blabla: -/// -/// ```dart preamble -/// bool _visible = true; -/// final GlobalKey globalKey = GlobalKey(); -/// ``` -/// -/// ```dart -/// Widget build(BuildContext context) { -/// return Opacity( -/// key: globalKey, -/// opacity: _visible ? 1.0 : 0.0, -/// child: const Text('Poor wandering ones!'), -/// ); -/// } -/// ``` -/// {@end-tool} -/// -/// {@tool snippet} -/// Bla blabla blabla some [Text] when the `_blabla` blabla blabla is true, and -/// blabla finale blabla: -/// -/// ```dart -/// new Opacity( -/// opacity: _visible ? 1.0 : 0.0, -/// child: const Text('Poor wandering ones!'), -/// ) -/// ``` -/// {@end-tool} -/// -/// {@tool snippet} -/// regular const constructor -/// -/// ```dart -/// const Text('Poor wandering ones!') -/// ``` -/// {@end-tool} -/// -/// {@tool snippet} -/// const private constructor -/// ```dart -/// const _Text('Poor wandering ones!') -/// ``` -/// {@end-tool} -/// -/// {@tool snippet} -/// yet another const private constructor -/// ```dart -/// const _Text.__('Poor wandering ones!') -/// ``` -/// {@end-tool} -/// -/// {@tool snippet} -/// const variable -/// -/// ```dart -/// const text0 = Text('Poor wandering ones!'); -/// ``` -/// {@end-tool} -/// -/// {@tool snippet} -/// more const variables -/// -/// ```dart -/// const text1 = _Text('Poor wandering ones!'); -/// ``` -/// {@end-tool} -/// -/// {@tool snippet} -/// Snippet with null-safe syntax -/// -/// ```dart -/// final String? bar = 'Hello'; -/// final int foo = null; -/// ``` -/// {@end-tool} -/// -/// {@tool dartpad --template=stateless_widget_material} -/// Dartpad with null-safe syntax -/// -/// ```dart preamble -/// bool? _visible = true; -/// final GlobalKey globalKey = GlobalKey(); -/// ``` -/// -/// ```dart -/// Widget build(BuildContext context) { -/// final String title; -/// return Opacity( -/// key: globalKey, -/// opacity: _visible! ? 1.0 : 0.0, -/// child: Text(title), -/// ); -/// } -/// ``` -/// {@end-tool} diff --git a/dev/bots/test/analyze-sample-code_test.dart b/dev/bots/test/analyze-sample-code_test.dart index c0f1e28d9a..71c06f8fc6 100644 --- a/dev/bots/test/analyze-sample-code_test.dart +++ b/dev/bots/test/analyze-sample-code_test.dart @@ -16,31 +16,6 @@ void main() { final List stderrLines = process.stderr.toString().split('\n') ..removeWhere((String line) => line.startsWith('Analyzer output:') || line.startsWith('Building flutter tool...')); expect(process.exitCode, isNot(equals(0))); - expect(stderrLines, [ - 'known_broken_documentation.dart:31:9: new Opacity(', - '>>> Unnecessary new keyword (unnecessary_new)', - 'known_broken_documentation.dart:63:9: new Opacity(', - '>>> Unnecessary new keyword (unnecessary_new)', - '', - 'Found 1 sample code errors.', - '', - ]); - expect(stdoutLines, [ - 'Found 7 sample code sections.', - 'Starting analysis of code samples.', - '', - ]); - }, skip: Platform.isWindows); - - test('analyze-sample-code null-safe', () { - final ProcessResult process = Process.runSync( - '../../bin/cache/dart-sdk/bin/dart', - ['analyze-sample-code.dart', 'test/analyze-sample-code-test-null-safe-input'], - ); - final List stdoutLines = process.stdout.toString().split('\n'); - final List stderrLines = process.stderr.toString().split('\n') - ..removeWhere((String line) => line.startsWith('Analyzer output:') || line.startsWith('Building flutter tool...')); - expect(process.exitCode, isNot(equals(0))); expect(stderrLines, [ 'In sample starting at known_broken_documentation.dart:117: child: Text(title),', '>>> The final variable \'title\' can\'t be read because it is potentially unassigned at this point (read_potentially_unassigned_final)', diff --git a/dev/snippets/config/templates/freeform_no_null_safety.tmpl b/dev/snippets/config/templates/freeform_no_null_safety.tmpl deleted file mode 100644 index 739cc0a2ed..0000000000 --- a/dev/snippets/config/templates/freeform_no_null_safety.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -/// Flutter code sample for {{element}} -// @dart = 2.9 - -{{description}} - -{{code-imports}} - -{{code-main}} - -{{code-preamble}} - -{{code}} diff --git a/dev/snippets/config/templates/stateful_widget_cupertino_no_null_safety.tmpl b/dev/snippets/config/templates/stateful_widget_cupertino_no_null_safety.tmpl deleted file mode 100644 index 42d60618ab..0000000000 --- a/dev/snippets/config/templates/stateful_widget_cupertino_no_null_safety.tmpl +++ /dev/null @@ -1,38 +0,0 @@ -/// Flutter code sample for {{element}} -// @dart = 2.9 - -{{description}} - -import 'package:flutter/cupertino.dart'; - -{{code-imports}} - -void main() => runApp(new MyApp()); - -/// This is the main application widget. -class MyApp extends StatelessWidget { - static const String _title = 'Flutter Code Sample'; - - @override - Widget build(BuildContext context) { - return CupertinoApp( - title: _title, - home: MyStatefulWidget(), - ); - } -} - -{{code-preamble}} - -/// This is the stateful widget that the main application instantiates. -class MyStatefulWidget extends StatefulWidget { - MyStatefulWidget({Key key}) : super(key: key); - - @override - _MyStatefulWidgetState createState() => _MyStatefulWidgetState(); -} - -/// This is the private State class that goes with MyStatefulWidget. -class _MyStatefulWidgetState extends State { - {{code}} -} diff --git a/dev/snippets/config/templates/stateful_widget_cupertino_page_scaffold_no_null_safety.tmpl b/dev/snippets/config/templates/stateful_widget_cupertino_page_scaffold_no_null_safety.tmpl deleted file mode 100644 index 4c2324e80d..0000000000 --- a/dev/snippets/config/templates/stateful_widget_cupertino_page_scaffold_no_null_safety.tmpl +++ /dev/null @@ -1,41 +0,0 @@ -/// Flutter code sample for {{element}} -// @dart = 2.9 - -{{description}} - -import 'package:flutter/cupertino.dart'; - -{{code-imports}} - -void main() => runApp(new MyApp()); - -/// This is the main application widget. -class MyApp extends StatelessWidget { - static const String _title = 'Flutter Code Sample'; - - @override - Widget build(BuildContext context) { - return CupertinoApp( - title: _title, - home: CupertinoPageScaffold( - navigationBar: CupertinoNavigationBar(middle: const Text(_title)), - child: MyStatefulWidget(), - ), - ); - } -} - -{{code-preamble}} - -/// This is the stateful widget that the main application instantiates. -class MyStatefulWidget extends StatefulWidget { - MyStatefulWidget({Key key}) : super(key: key); - - @override - _MyStatefulWidgetState createState() => _MyStatefulWidgetState(); -} - -/// This is the private State class that goes with MyStatefulWidget. -class _MyStatefulWidgetState extends State { - {{code}} -} diff --git a/dev/snippets/config/templates/stateful_widget_cupertino_ticker_no_null_safety.tmpl b/dev/snippets/config/templates/stateful_widget_cupertino_ticker_no_null_safety.tmpl deleted file mode 100644 index c3172eed7b..0000000000 --- a/dev/snippets/config/templates/stateful_widget_cupertino_ticker_no_null_safety.tmpl +++ /dev/null @@ -1,39 +0,0 @@ -/// Flutter code sample for {{element}} -// @dart = 2.9 - -{{description}} - -import 'package:flutter/cupertino.dart'; - -{{code-imports}} - -void main() => runApp(new MyApp()); - -/// This is the main application widget. -class MyApp extends StatelessWidget { - static const String _title = 'Flutter Code Sample'; - - @override - Widget build(BuildContext context) { - return CupertinoApp( - title: _title, - home: MyStatefulWidget(), - ); - } -} - -{{code-preamble}} - -/// This is the stateful widget that the main application instantiates. -class MyStatefulWidget extends StatefulWidget { - MyStatefulWidget({Key key}) : super(key: key); - - @override - _MyStatefulWidgetState createState() => _MyStatefulWidgetState(); -} - -/// This is the private State class that goes with MyStatefulWidget. -/// AnimationControllers can be created with `vsync: this` because of TickerProviderStateMixin. -class _MyStatefulWidgetState extends State with TickerProviderStateMixin { - {{code}} -} diff --git a/dev/snippets/config/templates/stateful_widget_material_no_null_safety.tmpl b/dev/snippets/config/templates/stateful_widget_material_no_null_safety.tmpl deleted file mode 100644 index 8f98f3c43c..0000000000 --- a/dev/snippets/config/templates/stateful_widget_material_no_null_safety.tmpl +++ /dev/null @@ -1,38 +0,0 @@ -/// Flutter code sample for {{element}} -// @dart = 2.9 - -{{description}} - -import 'package:flutter/material.dart'; - -{{code-imports}} - -void main() => runApp(new MyApp()); - -/// This 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: MyStatefulWidget(), - ); - } -} - -{{code-preamble}} - -/// This is the stateful widget that the main application instantiates. -class MyStatefulWidget extends StatefulWidget { - MyStatefulWidget({Key key}) : super(key: key); - - @override - _MyStatefulWidgetState createState() => _MyStatefulWidgetState(); -} - -/// This is the private State class that goes with MyStatefulWidget. -class _MyStatefulWidgetState extends State { - {{code}} -} diff --git a/dev/snippets/config/templates/stateful_widget_material_ticker_no_null_safety.tmpl b/dev/snippets/config/templates/stateful_widget_material_ticker_no_null_safety.tmpl deleted file mode 100644 index e29f68d0cf..0000000000 --- a/dev/snippets/config/templates/stateful_widget_material_ticker_no_null_safety.tmpl +++ /dev/null @@ -1,39 +0,0 @@ -/// Flutter code sample for {{element}} -// @dart = 2.9 - -{{description}} - -import 'package:flutter/material.dart'; - -{{code-imports}} - -void main() => runApp(new MyApp()); - -/// This 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: MyStatefulWidget(), - ); - } -} - -{{code-preamble}} - -/// This is the stateful widget that the main application instantiates. -class MyStatefulWidget extends StatefulWidget { - MyStatefulWidget({Key key}) : super(key: key); - - @override - _MyStatefulWidgetState createState() => _MyStatefulWidgetState(); -} - -/// This is the private State class that goes with MyStatefulWidget. -/// AnimationControllers can be created with `vsync: this` because of TickerProviderStateMixin. -class _MyStatefulWidgetState extends State with TickerProviderStateMixin { - {{code}} -} diff --git a/dev/snippets/config/templates/stateful_widget_no_null_safety.tmpl b/dev/snippets/config/templates/stateful_widget_no_null_safety.tmpl deleted file mode 100644 index 3121b40057..0000000000 --- a/dev/snippets/config/templates/stateful_widget_no_null_safety.tmpl +++ /dev/null @@ -1,37 +0,0 @@ -/// Flutter code sample for {{element}} -// @dart = 2.9 - -{{description}} - -import 'package:flutter/widgets.dart'; - -{{code-imports}} - -void main() => runApp(new MyApp()); - -/// This is the main application widget. -class MyApp extends StatelessWidget { - @override - Widget build(BuildContext context) { - return WidgetsApp( - title: 'Flutter Code Sample', - home: MyStatefulWidget(), - color: const Color(0xffffffff), - ); - } -} - -{{code-preamble}} - -/// This is the stateful widget that the main application instantiates. -class MyStatefulWidget extends StatefulWidget { - MyStatefulWidget({Key key}) : super(key: key); - - @override - _MyStatefulWidgetState createState() => _MyStatefulWidgetState(); -} - -/// This is the private State class that goes with MyStatefulWidget. -class _MyStatefulWidgetState extends State { - {{code}} -} diff --git a/dev/snippets/config/templates/stateful_widget_restoration_no_null_safety.tmpl b/dev/snippets/config/templates/stateful_widget_restoration_no_null_safety.tmpl deleted file mode 100644 index 70a7a794d1..0000000000 --- a/dev/snippets/config/templates/stateful_widget_restoration_no_null_safety.tmpl +++ /dev/null @@ -1,47 +0,0 @@ -/// Flutter code sample for {{element}} -// @dart = 2.9 - -{{description}} - -import 'package:flutter/material.dart'; - -{{code-imports}} - -void main() => runApp(new MyApp()); - -/// This is the main application widget. -class MyApp extends StatelessWidget { - @override - Widget build(BuildContext context) { - return WidgetsApp( - title: 'Flutter Code Sample', - home: Center( - child: MyStatefulWidget(restorationId: 'main'), - ), - color: const Color(0xffffffff), - ); - } -} - -{{code-preamble}} - -/// This is the stateful widget that the main application instantiates. -class MyStatefulWidget extends StatefulWidget { - MyStatefulWidget({Key key, this.restorationId}) : super(key: key); - - final String restorationId; - - @override - _MyStatefulWidgetState createState() => _MyStatefulWidgetState(); -} - -/// This is the private State class that goes with MyStatefulWidget. -/// RestorationProperty objects can be used because of RestorationMixin. -class _MyStatefulWidgetState extends State with RestorationMixin { - // In this example, the restoration ID for the mixin is passed in through - // the [StatefulWidget]'s constructor. - @override - String get restorationId => widget.restorationId; - -{{code}} -} diff --git a/dev/snippets/config/templates/stateful_widget_scaffold_center_freeform_state_no_null_safety.tmpl b/dev/snippets/config/templates/stateful_widget_scaffold_center_freeform_state_no_null_safety.tmpl deleted file mode 100644 index d77cd9e02c..0000000000 --- a/dev/snippets/config/templates/stateful_widget_scaffold_center_freeform_state_no_null_safety.tmpl +++ /dev/null @@ -1,41 +0,0 @@ -/// Flutter code sample for {{element}} -// @dart = 2.9 - -{{description}} - -import 'package:flutter/material.dart'; - -{{code-imports}} - -void main() => runApp(new MyApp()); - -/// This 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}} - -/// This is the stateful widget that the main application instantiates. -class MyStatefulWidget extends StatefulWidget { - MyStatefulWidget({Key key}) : super(key: key); - - @override - _MyStatefulWidgetState createState() => _MyStatefulWidgetState(); -} - -/// This is the private State class that goes with MyStatefulWidget. -{{code}} diff --git a/dev/snippets/config/templates/stateful_widget_scaffold_center_no_null_safety.tmpl b/dev/snippets/config/templates/stateful_widget_scaffold_center_no_null_safety.tmpl deleted file mode 100644 index 3f2e24cf63..0000000000 --- a/dev/snippets/config/templates/stateful_widget_scaffold_center_no_null_safety.tmpl +++ /dev/null @@ -1,43 +0,0 @@ -/// Flutter code sample for {{element}} -// @dart = 2.9 - -{{description}} - -import 'package:flutter/material.dart'; - -{{code-imports}} - -void main() => runApp(new MyApp()); - -/// This 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}} - -/// This is the stateful widget that the main application instantiates. -class MyStatefulWidget extends StatefulWidget { - MyStatefulWidget({Key key}) : super(key: key); - - @override - _MyStatefulWidgetState createState() => _MyStatefulWidgetState(); -} - -/// This is the private State class that goes with MyStatefulWidget. -class _MyStatefulWidgetState extends State { - {{code}} -} diff --git a/dev/snippets/config/templates/stateful_widget_scaffold_no_null_safety.tmpl b/dev/snippets/config/templates/stateful_widget_scaffold_no_null_safety.tmpl deleted file mode 100644 index 3169885d73..0000000000 --- a/dev/snippets/config/templates/stateful_widget_scaffold_no_null_safety.tmpl +++ /dev/null @@ -1,41 +0,0 @@ -/// Flutter code sample for {{element}} -// @dart = 2.9 - -{{description}} - -import 'package:flutter/material.dart'; - -{{code-imports}} - -void main() => runApp(new MyApp()); - -/// This 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: MyStatefulWidget(), - ), - ); - } -} - -{{code-preamble}} - -/// This is the stateful widget that the main application instantiates. -class MyStatefulWidget extends StatefulWidget { - MyStatefulWidget({Key key}) : super(key: key); - - @override - _MyStatefulWidgetState createState() => _MyStatefulWidgetState(); -} - -/// This is the private State class that goes with MyStatefulWidget. -class _MyStatefulWidgetState extends State { - {{code}} -} diff --git a/dev/snippets/config/templates/stateful_widget_ticker_no_null_safety.tmpl b/dev/snippets/config/templates/stateful_widget_ticker_no_null_safety.tmpl deleted file mode 100644 index 0c86ccd8d0..0000000000 --- a/dev/snippets/config/templates/stateful_widget_ticker_no_null_safety.tmpl +++ /dev/null @@ -1,38 +0,0 @@ -/// Flutter code sample for {{element}} -// @dart = 2.9 - -{{description}} - -import 'package:flutter/widgets.dart'; - -{{code-imports}} - -void main() => runApp(new MyApp()); - -/// This is the main application widget. -class MyApp extends StatelessWidget { - @override - Widget build(BuildContext context) { - return WidgetsApp( - title: 'Flutter Code Sample', - home: MyStatefulWidget(), - color: const Color(0xffffffff), - ); - } -} - -{{code-preamble}} - -/// This is the stateful widget that the main application instantiates. -class MyStatefulWidget extends StatefulWidget { - MyStatefulWidget({Key key}) : super(key: key); - - @override - _MyStatefulWidgetState createState() => _MyStatefulWidgetState(); -} - -/// This is the private State class that goes with MyStatefulWidget. -/// AnimationControllers can be created with `vsync: this` because of TickerProviderStateMixin. -class _MyStatefulWidgetState extends State with TickerProviderStateMixin { - {{code}} -} diff --git a/dev/snippets/config/templates/stateless_widget_cupertino_no_null_safety.tmpl b/dev/snippets/config/templates/stateless_widget_cupertino_no_null_safety.tmpl deleted file mode 100644 index d4c2e9498e..0000000000 --- a/dev/snippets/config/templates/stateless_widget_cupertino_no_null_safety.tmpl +++ /dev/null @@ -1,34 +0,0 @@ -/// Flutter code sample for {{element}} -// @dart = 2.9 - -{{description}} - -import 'package:flutter/cupertino.dart'; - -{{code-imports}} - -void main() => runApp(new MyApp()); - -/// This is the main application widget. -class MyApp extends StatelessWidget { - static const String _title = 'Flutter Code Sample'; - - @override - Widget build(BuildContext context) { - return CupertinoApp( - title: _title, - home: MyStatelessWidget(), - ); - } -} - - -{{code-preamble}} - -/// This is the stateless widget that the main application instantiates. -class MyStatelessWidget extends StatelessWidget { - MyStatelessWidget({Key key}) : super(key: key); - - @override - {{code}} -} diff --git a/dev/snippets/config/templates/stateless_widget_cupertino_page_scaffold_no_null_safety.tmpl b/dev/snippets/config/templates/stateless_widget_cupertino_page_scaffold_no_null_safety.tmpl deleted file mode 100644 index 0e55f41fa8..0000000000 --- a/dev/snippets/config/templates/stateless_widget_cupertino_page_scaffold_no_null_safety.tmpl +++ /dev/null @@ -1,37 +0,0 @@ -/// Flutter code sample for {{element}} -// @dart = 2.9 - -{{description}} - -import 'package:flutter/cupertino.dart'; - -{{code-imports}} - -void main() => runApp(new MyApp()); - -/// This is the main application widget. -class MyApp extends StatelessWidget { - static const String _title = 'Flutter Code Sample'; - - @override - Widget build(BuildContext context) { - return CupertinoApp( - title: _title, - home: CupertinoPageScaffold( - navigationBar: CupertinoNavigationBar(middle: const Text(_title)), - body: MyStatelessWidget(), - ), - ); - } -} - - -{{code-preamble}} - -/// This is the stateless widget that the main application instantiates. -class MyStatelessWidget extends StatelessWidget { - MyStatelessWidget({Key key}) : super(key: key); - - @override - {{code}} -} diff --git a/dev/snippets/config/templates/stateless_widget_material_no_null_safety.tmpl b/dev/snippets/config/templates/stateless_widget_material_no_null_safety.tmpl deleted file mode 100644 index 57f087c506..0000000000 --- a/dev/snippets/config/templates/stateless_widget_material_no_null_safety.tmpl +++ /dev/null @@ -1,34 +0,0 @@ -/// Flutter code sample for {{element}} -// @dart = 2.9 - -{{description}} - -import 'package:flutter/material.dart'; - -{{code-imports}} - -void main() => runApp(new MyApp()); - -/// This 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: MyStatelessWidget(), - ); - } -} - - -{{code-preamble}} - -/// This is the stateless widget that the main application instantiates. -class MyStatelessWidget extends StatelessWidget { - MyStatelessWidget({Key key}) : super(key: key); - - @override - {{code}} -} diff --git a/dev/snippets/config/templates/stateless_widget_no_null_safety.tmpl b/dev/snippets/config/templates/stateless_widget_no_null_safety.tmpl deleted file mode 100644 index 57dd16770f..0000000000 --- a/dev/snippets/config/templates/stateless_widget_no_null_safety.tmpl +++ /dev/null @@ -1,34 +0,0 @@ -/// Flutter code sample for {{element}} -// @dart = 2.9 - -{{description}} - -import 'package:flutter/widgets.dart'; - -{{code-imports}} - -void main() => runApp(new MyApp()); - -/// This is the main application widget. -class MyApp extends StatelessWidget { - @override - Widget build(BuildContext context) { - return WidgetsApp( - title: 'Flutter Code Sample', - builder: (BuildContext context, Widget navigator) { - return MyStatelessWidget(); - }, - color: const Color(0xffffffff), - ); - } -} - -{{code-preamble}} - -/// This is the stateless widget that the main application instantiates. -class MyStatelessWidget extends StatelessWidget { - MyStatelessWidget({Key key}) : super(key: key); - - @override - {{code}} -} diff --git a/dev/snippets/config/templates/stateless_widget_scaffold_center_no_null_safety.tmpl b/dev/snippets/config/templates/stateless_widget_scaffold_center_no_null_safety.tmpl deleted file mode 100644 index a54014804b..0000000000 --- a/dev/snippets/config/templates/stateless_widget_scaffold_center_no_null_safety.tmpl +++ /dev/null @@ -1,39 +0,0 @@ -/// Flutter code sample for {{element}} -// @dart = 2.9 - -{{description}} - -import 'package:flutter/material.dart'; - -{{code-imports}} - -void main() => runApp(new MyApp()); - -/// This 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: MyStatelessWidget(), - ), - ), - ); - } -} - - -{{code-preamble}} - -/// This is the stateless widget that the main application instantiates. -class MyStatelessWidget extends StatelessWidget { - MyStatelessWidget({Key key}) : super(key: key); - - @override - {{code}} -} diff --git a/dev/snippets/config/templates/stateless_widget_scaffold_no_null_safety.tmpl b/dev/snippets/config/templates/stateless_widget_scaffold_no_null_safety.tmpl deleted file mode 100644 index 0945e21aa4..0000000000 --- a/dev/snippets/config/templates/stateless_widget_scaffold_no_null_safety.tmpl +++ /dev/null @@ -1,37 +0,0 @@ -/// Flutter code sample for {{element}} -// @dart = 2.9 - -{{description}} - -import 'package:flutter/material.dart'; - -{{code-imports}} - -void main() => runApp(new MyApp()); - -/// This 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: MyStatelessWidget(), - ), - ); - } -} - - -{{code-preamble}} - -/// This is the stateless widget that the main application instantiates. -class MyStatelessWidget extends StatelessWidget { - MyStatelessWidget({Key key}) : super(key: key); - - @override - {{code}} -}