mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Fix StatefulWidget and StatelessWidget Sample Documentation (#30814)
This commit is contained in:
parent
eb30745faf
commit
b3bb5cd6b0
@ -490,7 +490,10 @@ abstract class Widget extends DiagnosticableTree {
|
|||||||
///
|
///
|
||||||
/// {@tool sample}
|
/// {@tool sample}
|
||||||
///
|
///
|
||||||
/// The following is a skeleton of a stateless widget subclass called `GreenFrog`:
|
/// The following is a skeleton of a stateless widget subclass called `GreenFrog`.
|
||||||
|
///
|
||||||
|
/// Normally, widgets have more constructor arguments, each of which corresponds
|
||||||
|
/// to a `final` property.
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class GreenFrog extends StatelessWidget {
|
/// class GreenFrog extends StatelessWidget {
|
||||||
@ -503,22 +506,21 @@ abstract class Widget extends DiagnosticableTree {
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
/// {@end-tool}
|
/// {@end-tool}
|
||||||
|
///
|
||||||
/// {@tool sample}
|
/// {@tool sample}
|
||||||
///
|
///
|
||||||
/// Normally widgets have more constructor arguments, each of which corresponds
|
/// This next example shows the more generic widget `Frog` which can be given
|
||||||
/// to a `final` property. The next example shows the more generic widget `Frog`
|
/// a color and a child:
|
||||||
/// which can be given a color and a child:
|
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class Frog extends StatelessWidget {
|
/// class Frog extends StatelessWidget {
|
||||||
/// const Frog({
|
/// const Frog({
|
||||||
/// Key key,
|
/// Key key,
|
||||||
/// this.color: const Color(0xFF2DBD3A),
|
/// this.color = const Color(0xFF2DBD3A),
|
||||||
/// this.child,
|
/// this.child,
|
||||||
/// }) : super(key: key);
|
/// }) : super(key: key);
|
||||||
///
|
///
|
||||||
/// final Color color;
|
/// final Color color;
|
||||||
///
|
|
||||||
/// final Widget child;
|
/// final Widget child;
|
||||||
///
|
///
|
||||||
/// @override
|
/// @override
|
||||||
@ -702,7 +704,11 @@ abstract class StatelessWidget extends Widget {
|
|||||||
///
|
///
|
||||||
/// {@tool sample}
|
/// {@tool sample}
|
||||||
///
|
///
|
||||||
/// The following is a skeleton of a stateful widget subclass called `YellowBird`:
|
/// This is a skeleton of a stateful widget subclass called `YellowBird`.
|
||||||
|
///
|
||||||
|
/// In this example. the [State] has no actual state. State is normally
|
||||||
|
/// represented as private member fields. Also, normally widgets have more
|
||||||
|
/// constructor arguments, each of which corresponds to a `final` property.
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class YellowBird extends StatefulWidget {
|
/// class YellowBird extends StatefulWidget {
|
||||||
@ -722,11 +728,7 @@ abstract class StatelessWidget extends Widget {
|
|||||||
/// {@end-tool}
|
/// {@end-tool}
|
||||||
/// {@tool sample}
|
/// {@tool sample}
|
||||||
///
|
///
|
||||||
/// In this example. the [State] has no actual state. State is normally
|
/// This example shows the more generic widget `Bird` which can be given a
|
||||||
/// represented as private member fields. Also, normally widgets have more
|
|
||||||
/// constructor arguments, each of which corresponds to a `final` property.
|
|
||||||
///
|
|
||||||
/// The next example shows the more generic widget `Bird` which can be given a
|
|
||||||
/// color and a child, and which has some internal state with a method that
|
/// color and a child, and which has some internal state with a method that
|
||||||
/// can be called to mutate it:
|
/// can be called to mutate it:
|
||||||
///
|
///
|
||||||
@ -734,12 +736,11 @@ abstract class StatelessWidget extends Widget {
|
|||||||
/// class Bird extends StatefulWidget {
|
/// class Bird extends StatefulWidget {
|
||||||
/// const Bird({
|
/// const Bird({
|
||||||
/// Key key,
|
/// Key key,
|
||||||
/// this.color: const Color(0xFFFFE306),
|
/// this.color = const Color(0xFFFFE306),
|
||||||
/// this.child,
|
/// this.child,
|
||||||
/// }) : super(key: key);
|
/// }) : super(key: key);
|
||||||
///
|
///
|
||||||
/// final Color color;
|
/// final Color color;
|
||||||
///
|
|
||||||
/// final Widget child;
|
/// final Widget child;
|
||||||
///
|
///
|
||||||
/// _BirdState createState() => _BirdState();
|
/// _BirdState createState() => _BirdState();
|
||||||
|
Loading…
Reference in New Issue
Block a user