Prepare to migrate API doc samples and snippets to null safety (#72040)
This commit is contained in:
committed by
GitHub
parent
74298a76e7
commit
ff05ca2503
@@ -23,7 +23,7 @@
|
||||
<div class="snippet-container">
|
||||
<div class="snippet" id="longSnippet{{serial}}">
|
||||
{{description}}
|
||||
<iframe class="snippet-dartpad" src="https://dartpad.dev/embed-flutter.html?split=60&run=true&sample_id={{id}}&sample_channel={{channel}}"></iframe>
|
||||
<iframe class="snippet-dartpad" src="https://dartpad.dev/embed-flutter.html?split=60&run=true&null_safety=true&sample_id={{id}}&sample_channel={{channel}}"></iframe>
|
||||
<div class="snippet-description">To create a local project with this code sample, run:<br/>
|
||||
<span class="snippet-create-command">flutter create --sample={{id}} mysample</span>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/// Flutter code sample for {{element}}
|
||||
// @dart = 2.9
|
||||
|
||||
{{description}}
|
||||
|
||||
|
||||
12
dev/snippets/config/templates/freeform_no_null_safety.tmpl
Normal file
12
dev/snippets/config/templates/freeform_no_null_safety.tmpl
Normal file
@@ -0,0 +1,12 @@
|
||||
/// Flutter code sample for {{element}}
|
||||
// @dart = 2.9
|
||||
|
||||
{{description}}
|
||||
|
||||
{{code-imports}}
|
||||
|
||||
{{code-main}}
|
||||
|
||||
{{code-preamble}}
|
||||
|
||||
{{code}}
|
||||
@@ -1,5 +1,4 @@
|
||||
/// Flutter code sample for {{element}}
|
||||
// @dart = 2.9
|
||||
|
||||
{{description}}
|
||||
|
||||
@@ -25,7 +24,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateful widget that the main application instantiates.
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
MyStatefulWidget({Key key}) : super(key: key);
|
||||
MyStatefulWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/// Flutter code sample for {{element}}
|
||||
// @dart = 2.9
|
||||
|
||||
{{description}}
|
||||
|
||||
@@ -26,7 +25,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateful widget that the main application instantiates.
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
MyStatefulWidget({Key key}) : super(key: key);
|
||||
MyStatefulWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/// 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,5 +1,4 @@
|
||||
/// Flutter code sample for {{element}}
|
||||
// @dart = 2.9
|
||||
|
||||
{{description}}
|
||||
|
||||
@@ -29,7 +28,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateful widget that the main application instantiates.
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
MyStatefulWidget({Key key}) : super(key: key);
|
||||
MyStatefulWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/// 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,5 +1,4 @@
|
||||
/// Flutter code sample for {{element}}
|
||||
// @dart = 2.9
|
||||
|
||||
{{description}}
|
||||
|
||||
@@ -26,7 +25,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateful widget that the main application instantiates.
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
MyStatefulWidget({Key key}) : super(key: key);
|
||||
MyStatefulWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/// 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,5 +1,4 @@
|
||||
/// Flutter code sample for {{element}}
|
||||
// @dart = 2.9
|
||||
|
||||
{{description}}
|
||||
|
||||
@@ -26,7 +25,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateful widget that the main application instantiates.
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
MyStatefulWidget({Key key}) : super(key: key);
|
||||
MyStatefulWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/// 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,5 +1,4 @@
|
||||
/// Flutter code sample for {{element}}
|
||||
// @dart = 2.9
|
||||
|
||||
{{description}}
|
||||
|
||||
@@ -26,7 +25,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateful widget that the main application instantiates.
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
MyStatefulWidget({Key key}) : super(key: key);
|
||||
MyStatefulWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/// 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}}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/// 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,5 +1,4 @@
|
||||
/// Flutter code sample for {{element}}
|
||||
// @dart = 2.9
|
||||
|
||||
{{description}}
|
||||
|
||||
@@ -27,9 +26,9 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateful widget that the main application instantiates.
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
MyStatefulWidget({Key key, this.restorationId}) : super(key: key);
|
||||
MyStatefulWidget({Key? key, this.restorationId}) : super(key: key);
|
||||
|
||||
final String restorationId;
|
||||
final String? restorationId;
|
||||
|
||||
@override
|
||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||
@@ -41,7 +40,7 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> with RestorationMix
|
||||
// In this example, the restoration ID for the mixin is passed in through
|
||||
// the [StatefulWidget]'s constructor.
|
||||
@override
|
||||
String get restorationId => widget.restorationId;
|
||||
String? get restorationId => widget.restorationId;
|
||||
|
||||
{{code}}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/// 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,5 +1,4 @@
|
||||
/// Flutter code sample for {{element}}
|
||||
// @dart = 2.9
|
||||
|
||||
{{description}}
|
||||
|
||||
@@ -29,7 +28,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateful widget that the main application instantiates.
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
MyStatefulWidget({Key key}) : super(key: key);
|
||||
MyStatefulWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/// Flutter code sample for {{element}}
|
||||
// @dart = 2.9
|
||||
|
||||
{{description}}
|
||||
|
||||
@@ -31,7 +30,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateful widget that the main application instantiates.
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
MyStatefulWidget({Key key}) : super(key: key);
|
||||
MyStatefulWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/// Flutter code sample for {{element}}
|
||||
// @dart = 2.9
|
||||
|
||||
{{description}}
|
||||
|
||||
@@ -31,7 +30,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateful widget that the main application instantiates.
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
MyStatefulWidget({Key key}) : super(key: key);
|
||||
MyStatefulWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/// 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}}
|
||||
@@ -0,0 +1,43 @@
|
||||
/// 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}}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/// 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,5 +1,4 @@
|
||||
/// Flutter code sample for {{element}}
|
||||
// @dart = 2.9
|
||||
|
||||
{{description}}
|
||||
|
||||
@@ -25,7 +24,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateful widget that the main application instantiates.
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
MyStatefulWidget({Key key}) : super(key: key);
|
||||
MyStatefulWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/// 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,5 +1,4 @@
|
||||
/// Flutter code sample for {{element}}
|
||||
// @dart = 2.9
|
||||
|
||||
{{description}}
|
||||
|
||||
@@ -27,7 +26,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateless widget that the main application instantiates.
|
||||
class MyStatelessWidget extends StatelessWidget {
|
||||
MyStatelessWidget({Key key}) : super(key: key);
|
||||
MyStatelessWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
{{code}}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/// Flutter code sample for {{element}}
|
||||
// @dart = 2.9
|
||||
|
||||
{{description}}
|
||||
|
||||
@@ -27,7 +26,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateless widget that the main application instantiates.
|
||||
class MyStatelessWidget extends StatelessWidget {
|
||||
MyStatelessWidget({Key key}) : super(key: key);
|
||||
MyStatelessWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
{{code}}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/// 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,5 +1,4 @@
|
||||
/// Flutter code sample for {{element}}
|
||||
// @dart = 2.9
|
||||
|
||||
{{description}}
|
||||
|
||||
@@ -30,7 +29,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateless widget that the main application instantiates.
|
||||
class MyStatelessWidget extends StatelessWidget {
|
||||
MyStatelessWidget({Key key}) : super(key: key);
|
||||
MyStatelessWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
{{code}}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/// 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,5 +1,4 @@
|
||||
/// Flutter code sample for {{element}}
|
||||
// @dart = 2.9
|
||||
|
||||
{{description}}
|
||||
|
||||
@@ -27,7 +26,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateless widget that the main application instantiates.
|
||||
class MyStatelessWidget extends StatelessWidget {
|
||||
MyStatelessWidget({Key key}) : super(key: key);
|
||||
MyStatelessWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
{{code}}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/// 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}}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/// 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,5 +1,4 @@
|
||||
/// Flutter code sample for {{element}}
|
||||
// @dart = 2.9
|
||||
|
||||
{{description}}
|
||||
|
||||
@@ -30,7 +29,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateless widget that the main application instantiates.
|
||||
class MyStatelessWidget extends StatelessWidget {
|
||||
MyStatelessWidget({Key key}) : super(key: key);
|
||||
MyStatelessWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
{{code}}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/// Flutter code sample for {{element}}
|
||||
// @dart = 2.9
|
||||
|
||||
{{description}}
|
||||
|
||||
@@ -32,7 +31,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateless widget that the main application instantiates.
|
||||
class MyStatelessWidget extends StatelessWidget {
|
||||
MyStatelessWidget({Key key}) : super(key: key);
|
||||
MyStatelessWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
{{code}}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/// 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}}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/// 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}}
|
||||
}
|
||||
Reference in New Issue
Block a user