Complete migration to null safety in api documentation (#72939)
* Remove all usage of no_null_safety in API docs workflows
This commit is contained in:
parent
e8cf674082
commit
01d2325be1
@ -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}
|
||||
|
@ -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}
|
@ -16,31 +16,6 @@ void main() {
|
||||
final List<String> 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, <String>[
|
||||
'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, <String>[
|
||||
'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',
|
||||
<String>['analyze-sample-code.dart', 'test/analyze-sample-code-test-null-safe-input'],
|
||||
);
|
||||
final List<String> stdoutLines = process.stdout.toString().split('\n');
|
||||
final List<String> 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, <String>[
|
||||
'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)',
|
||||
|
@ -1,12 +0,0 @@
|
||||
/// Flutter code sample for {{element}}
|
||||
// @dart = 2.9
|
||||
|
||||
{{description}}
|
||||
|
||||
{{code-imports}}
|
||||
|
||||
{{code-main}}
|
||||
|
||||
{{code-preamble}}
|
||||
|
||||
{{code}}
|
@ -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<MyStatefulWidget> {
|
||||
{{code}}
|
||||
}
|
@ -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<MyStatefulWidget> {
|
||||
{{code}}
|
||||
}
|
@ -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<MyStatefulWidget> with TickerProviderStateMixin {
|
||||
{{code}}
|
||||
}
|
@ -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<MyStatefulWidget> {
|
||||
{{code}}
|
||||
}
|
@ -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<MyStatefulWidget> with TickerProviderStateMixin {
|
||||
{{code}}
|
||||
}
|
@ -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<MyStatefulWidget> {
|
||||
{{code}}
|
||||
}
|
@ -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<MyStatefulWidget> 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}}
|
||||
}
|
@ -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}}
|
@ -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<MyStatefulWidget> {
|
||||
{{code}}
|
||||
}
|
@ -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<MyStatefulWidget> {
|
||||
{{code}}
|
||||
}
|
@ -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<MyStatefulWidget> with TickerProviderStateMixin {
|
||||
{{code}}
|
||||
}
|
@ -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}}
|
||||
}
|
@ -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}}
|
||||
}
|
@ -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}}
|
||||
}
|
@ -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}}
|
||||
}
|
@ -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}}
|
||||
}
|
@ -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}}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user