Unverified Commit 4219dea6 authored by Darren Austin's avatar Darren Austin Committed by GitHub

Migrated some more widgets doc comments to null safety. (#72838)

parent 0b024108
...@@ -90,7 +90,7 @@ typedef AnimatedSwitcherLayoutBuilder = Widget Function(Widget? currentChild, Li ...@@ -90,7 +90,7 @@ typedef AnimatedSwitcherLayoutBuilder = Widget Function(Widget? currentChild, Li
/// The type of transition can be changed from a cross-fade to a custom /// The type of transition can be changed from a cross-fade to a custom
/// transition by setting the [transitionBuilder]. /// transition by setting the [transitionBuilder].
/// ///
/// {@tool dartpad --template=stateful_widget_material_no_null_safety} /// {@tool dartpad --template=stateful_widget_material}
/// This sample shows a counter that animates the scale of a text widget /// This sample shows a counter that animates the scale of a text widget
/// whenever the value changes. /// whenever the value changes.
/// ///
......
...@@ -84,7 +84,7 @@ const int _kObscureShowLatestCharCursorTicks = 3; ...@@ -84,7 +84,7 @@ const int _kObscureShowLatestCharCursorTicks = 3;
/// ///
/// Remember to [dispose] of the [TextEditingController] when it is no longer /// Remember to [dispose] of the [TextEditingController] when it is no longer
/// needed. This will ensure we discard any resources used by the object. /// needed. This will ensure we discard any resources used by the object.
/// {@tool dartpad --template=stateful_widget_material_no_null_safety} /// {@tool dartpad --template=stateful_widget_material}
/// This example creates a [TextField] with a [TextEditingController] whose /// This example creates a [TextField] with a [TextEditingController] whose
/// change listener forces the entered text to be lower case and keeps the /// change listener forces the entered text to be lower case and keeps the
/// cursor at the end of the input. /// cursor at the end of the input.
...@@ -926,18 +926,13 @@ class EditableText extends StatefulWidget { ...@@ -926,18 +926,13 @@ class EditableText extends StatefulWidget {
/// and selection, one can add a listener to its [controller] with /// and selection, one can add a listener to its [controller] with
/// [TextEditingController.addListener]. /// [TextEditingController.addListener].
/// ///
/// {@tool dartpad --template=stateful_widget_material_no_null_safety} /// {@tool dartpad --template=stateful_widget_material}
/// ///
/// This example shows how onChanged could be used to check the TextField's /// This example shows how onChanged could be used to check the TextField's
/// current value each time the user inserts or deletes a character. /// current value each time the user inserts or deletes a character.
/// ///
/// ```dart /// ```dart
/// TextEditingController _controller; /// final TextEditingController _controller = TextEditingController();
///
/// void initState() {
/// super.initState();
/// _controller = TextEditingController();
/// }
/// ///
/// void dispose() { /// void dispose() {
/// _controller.dispose(); /// _controller.dispose();
...@@ -961,7 +956,7 @@ class EditableText extends StatefulWidget { ...@@ -961,7 +956,7 @@ class EditableText extends StatefulWidget {
/// context: context, /// context: context,
/// builder: (BuildContext context) { /// builder: (BuildContext context) {
/// return AlertDialog( /// return AlertDialog(
/// title: const Text('Thats correct!'), /// title: const Text('That is correct!'),
/// content: Text ('13 is the right answer.'), /// content: Text ('13 is the right answer.'),
/// actions: <Widget>[ /// actions: <Widget>[
/// TextButton( /// TextButton(
......
...@@ -303,10 +303,10 @@ enum UnfocusDisposition { ...@@ -303,10 +303,10 @@ enum UnfocusDisposition {
/// [DirectionalFocusTraversalPolicyMixin], but custom policies can be built /// [DirectionalFocusTraversalPolicyMixin], but custom policies can be built
/// based upon these policies. See [FocusTraversalPolicy] for more information. /// based upon these policies. See [FocusTraversalPolicy] for more information.
/// ///
/// {@tool dartpad --template=stateless_widget_scaffold_no_null_safety} This example shows how /// {@tool dartpad --template=stateless_widget_scaffold}
/// a FocusNode should be managed if not using the [Focus] or [FocusScope] /// This example shows how a FocusNode should be managed if not using the
/// widgets. See the [Focus] widget for a similar example using [Focus] and /// [Focus] or [FocusScope] widgets. See the [Focus] widget for a similar
/// [FocusScope] widgets. /// example using [Focus] and [FocusScope] widgets.
/// ///
/// ```dart imports /// ```dart imports
/// import 'package:flutter/services.dart'; /// import 'package:flutter/services.dart';
...@@ -314,16 +314,16 @@ enum UnfocusDisposition { ...@@ -314,16 +314,16 @@ enum UnfocusDisposition {
/// ///
/// ```dart preamble /// ```dart preamble
/// class ColorfulButton extends StatefulWidget { /// class ColorfulButton extends StatefulWidget {
/// ColorfulButton({Key key}) : super(key: key); /// ColorfulButton({Key? key}) : super(key: key);
/// ///
/// @override /// @override
/// _ColorfulButtonState createState() => _ColorfulButtonState(); /// _ColorfulButtonState createState() => _ColorfulButtonState();
/// } /// }
/// ///
/// class _ColorfulButtonState extends State<ColorfulButton> { /// class _ColorfulButtonState extends State<ColorfulButton> {
/// FocusNode _node; /// late FocusNode _node;
/// bool _focused = false; /// bool _focused = false;
/// FocusAttachment _nodeAttachment; /// late FocusAttachment _nodeAttachment;
/// Color _color = Colors.white; /// Color _color = Colors.white;
/// ///
/// @override /// @override
...@@ -406,7 +406,7 @@ enum UnfocusDisposition { ...@@ -406,7 +406,7 @@ enum UnfocusDisposition {
/// Widget build(BuildContext context) { /// Widget build(BuildContext context) {
/// final TextTheme textTheme = Theme.of(context).textTheme; /// final TextTheme textTheme = Theme.of(context).textTheme;
/// return DefaultTextStyle( /// return DefaultTextStyle(
/// style: textTheme.headline4, /// style: textTheme.headline4!,
/// child: ColorfulButton(), /// child: ColorfulButton(),
/// ); /// );
/// } /// }
...@@ -786,7 +786,7 @@ class FocusNode with DiagnosticableTreeMixin, ChangeNotifier { ...@@ -786,7 +786,7 @@ class FocusNode with DiagnosticableTreeMixin, ChangeNotifier {
/// previous node in the enclosing [FocusTraversalGroup], call [nextFocus] or /// previous node in the enclosing [FocusTraversalGroup], call [nextFocus] or
/// [previousFocus] instead of calling `unfocus`. /// [previousFocus] instead of calling `unfocus`.
/// ///
/// {@tool dartpad --template=stateful_widget_material_no_null_safety} /// {@tool dartpad --template=stateful_widget_material}
/// This example shows the difference between the different [UnfocusDisposition] /// This example shows the difference between the different [UnfocusDisposition]
/// values for [unfocus]. /// values for [unfocus].
/// ///
...@@ -835,9 +835,11 @@ class FocusNode with DiagnosticableTreeMixin, ChangeNotifier { ...@@ -835,9 +835,11 @@ class FocusNode with DiagnosticableTreeMixin, ChangeNotifier {
/// children: <Widget>[ /// children: <Widget>[
/// Radio<UnfocusDisposition>( /// Radio<UnfocusDisposition>(
/// groupValue: disposition, /// groupValue: disposition,
/// onChanged: (UnfocusDisposition value) { /// onChanged: (UnfocusDisposition? value) {
/// setState(() { /// setState(() {
/// if (value != null) {
/// disposition = value; /// disposition = value;
/// }
/// }); /// });
/// }, /// },
/// value: UnfocusDisposition.values[index], /// value: UnfocusDisposition.values[index],
...@@ -850,7 +852,7 @@ class FocusNode with DiagnosticableTreeMixin, ChangeNotifier { ...@@ -850,7 +852,7 @@ class FocusNode with DiagnosticableTreeMixin, ChangeNotifier {
/// child: const Text('UNFOCUS'), /// child: const Text('UNFOCUS'),
/// onPressed: () { /// onPressed: () {
/// setState(() { /// setState(() {
/// primaryFocus.unfocus(disposition: disposition); /// primaryFocus!.unfocus(disposition: disposition);
/// }); /// });
/// }, /// },
/// ), /// ),
......
...@@ -1256,14 +1256,18 @@ class _OrderedFocusInfo { ...@@ -1256,14 +1256,18 @@ class _OrderedFocusInfo {
/// ///
/// {@macro flutter.widgets.FocusOrder.comparable} /// {@macro flutter.widgets.FocusOrder.comparable}
/// ///
/// {@tool dartpad --template=stateless_widget_scaffold_center_no_null_safety} /// {@tool dartpad --template=stateless_widget_scaffold_center}
/// This sample shows how to assign a traversal order to a widget. In the /// This sample shows how to assign a traversal order to a widget. In the
/// example, the focus order goes from bottom right (the "One" button) to top /// example, the focus order goes from bottom right (the "One" button) to top
/// left (the "Six" button). /// left (the "Six" button).
/// ///
/// ```dart preamble /// ```dart preamble
/// class DemoButton extends StatelessWidget { /// class DemoButton extends StatelessWidget {
/// const DemoButton({this.name, this.autofocus = false, this.order}); /// const DemoButton({
/// required this.name,
/// this.autofocus = false,
/// required this.order,
/// });
/// ///
/// final String name; /// final String name;
/// final bool autofocus; /// final bool autofocus;
...@@ -1466,7 +1470,7 @@ class FocusTraversalOrder extends InheritedWidget { ...@@ -1466,7 +1470,7 @@ class FocusTraversalOrder extends InheritedWidget {
/// To prevent the members of the group from being focused, set the /// To prevent the members of the group from being focused, set the
/// [descendantsAreFocusable] attribute to false. /// [descendantsAreFocusable] attribute to false.
/// ///
/// {@tool dartpad --template=stateless_widget_material_no_null_safety} /// {@tool dartpad --template=stateless_widget_material}
/// This sample shows three rows of buttons, each grouped by a /// This sample shows three rows of buttons, each grouped by a
/// [FocusTraversalGroup], each with different traversal order policies. Use tab /// [FocusTraversalGroup], each with different traversal order policies. Use tab
/// traversal to see the order they are traversed in. The first row follows a /// traversal to see the order they are traversed in. The first row follows a
...@@ -1479,10 +1483,10 @@ class FocusTraversalOrder extends InheritedWidget { ...@@ -1479,10 +1483,10 @@ class FocusTraversalOrder extends InheritedWidget {
/// /// the type of T. /// /// the type of T.
/// class OrderedButton<T> extends StatefulWidget { /// class OrderedButton<T> extends StatefulWidget {
/// const OrderedButton({ /// const OrderedButton({
/// this.name, /// required this.name,
/// this.canRequestFocus = true, /// this.canRequestFocus = true,
/// this.autofocus = false, /// this.autofocus = false,
/// this.order, /// required this.order,
/// }); /// });
/// ///
/// final String name; /// final String name;
...@@ -1495,7 +1499,7 @@ class FocusTraversalOrder extends InheritedWidget { ...@@ -1495,7 +1499,7 @@ class FocusTraversalOrder extends InheritedWidget {
/// } /// }
/// ///
/// class _OrderedButtonState<T> extends State<OrderedButton<T>> { /// class _OrderedButtonState<T> extends State<OrderedButton<T>> {
/// FocusNode focusNode; /// late FocusNode focusNode;
/// ///
/// @override /// @override
/// void initState() { /// void initState() {
...@@ -1508,12 +1512,12 @@ class FocusTraversalOrder extends InheritedWidget { ...@@ -1508,12 +1512,12 @@ class FocusTraversalOrder extends InheritedWidget {
/// ///
/// @override /// @override
/// void dispose() { /// void dispose() {
/// focusNode?.dispose(); /// focusNode.dispose();
/// super.dispose(); /// super.dispose();
/// } /// }
/// ///
/// @override /// @override
/// void didUpdateWidget(OrderedButton oldWidget) { /// void didUpdateWidget(OrderedButton<T> oldWidget) {
/// super.didUpdateWidget(oldWidget); /// super.didUpdateWidget(oldWidget);
/// focusNode.canRequestFocus = widget.canRequestFocus; /// focusNode.canRequestFocus = widget.canRequestFocus;
/// } /// }
...@@ -1533,7 +1537,7 @@ class FocusTraversalOrder extends InheritedWidget { ...@@ -1533,7 +1537,7 @@ class FocusTraversalOrder extends InheritedWidget {
/// order = LexicalFocusOrder(widget.order.toString()); /// order = LexicalFocusOrder(widget.order.toString());
/// } /// }
/// ///
/// Color overlayColor(Set<MaterialState> states) { /// Color? overlayColor(Set<MaterialState> states) {
/// if (states.contains(MaterialState.focused)) { /// if (states.contains(MaterialState.focused)) {
/// return Colors.red; /// return Colors.red;
/// } /// }
...@@ -1543,7 +1547,7 @@ class FocusTraversalOrder extends InheritedWidget { ...@@ -1543,7 +1547,7 @@ class FocusTraversalOrder extends InheritedWidget {
/// return null; // defer to the default overlayColor /// return null; // defer to the default overlayColor
/// } /// }
/// ///
/// Color foregroundColor(Set<MaterialState> states) { /// Color? foregroundColor(Set<MaterialState> states) {
/// if (states.contains(MaterialState.focused) || states.contains(MaterialState.hovered)) { /// if (states.contains(MaterialState.focused) || states.contains(MaterialState.hovered)) {
/// return Colors.white; /// return Colors.white;
/// } /// }
...@@ -1558,8 +1562,8 @@ class FocusTraversalOrder extends InheritedWidget { ...@@ -1558,8 +1562,8 @@ class FocusTraversalOrder extends InheritedWidget {
/// focusNode: focusNode, /// focusNode: focusNode,
/// autofocus: widget.autofocus, /// autofocus: widget.autofocus,
/// style: ButtonStyle( /// style: ButtonStyle(
/// overlayColor: MaterialStateProperty.resolveWith<Color>(overlayColor), /// overlayColor: MaterialStateProperty.resolveWith<Color?>(overlayColor),
/// foregroundColor: MaterialStateProperty.resolveWith<Color>(foregroundColor), /// foregroundColor: MaterialStateProperty.resolveWith<Color?>(foregroundColor),
/// ), /// ),
/// onPressed: () => _handleOnPressed(), /// onPressed: () => _handleOnPressed(),
/// child: Text(widget.name), /// child: Text(widget.name),
......
...@@ -17,7 +17,7 @@ import 'framework.dart'; ...@@ -17,7 +17,7 @@ import 'framework.dart';
/// like the contents of a new route or an overlay, will be able to see the /// like the contents of a new route or an overlay, will be able to see the
/// ancestor inherited themes of the context it was built in. /// ancestor inherited themes of the context it was built in.
/// ///
/// {@tool dartpad --template=freeform_no_null_safety} /// {@tool dartpad --template=freeform}
/// This example demonstrates how `InheritedTheme.capture()` can be used /// This example demonstrates how `InheritedTheme.capture()` can be used
/// to wrap the contents of a new route with the inherited themes that /// to wrap the contents of a new route with the inherited themes that
/// are present when the route was built - but are not present when route /// are present when the route was built - but are not present when route
......
...@@ -243,7 +243,7 @@ mixin RenderConstrainedLayoutBuilder<ConstraintType extends Constraints, ChildTy ...@@ -243,7 +243,7 @@ mixin RenderConstrainedLayoutBuilder<ConstraintType extends Constraints, ChildTy
/// in an [Align] widget. If the child might want to be bigger, consider /// in an [Align] widget. If the child might want to be bigger, consider
/// wrapping it in a [SingleChildScrollView] or [OverflowBox]. /// wrapping it in a [SingleChildScrollView] or [OverflowBox].
/// ///
/// {@tool dartpad --template=stateless_widget_material_no_null_safety} /// {@tool dartpad --template=stateless_widget_material}
/// ///
/// This example uses a [LayoutBuilder] to build a different widget depending on the available width. Resize the /// This example uses a [LayoutBuilder] to build a different widget depending on the available width. Resize the
/// DartPad window to see [LayoutBuilder] in action! /// DartPad window to see [LayoutBuilder] in action!
......
...@@ -250,7 +250,7 @@ class MediaQueryData { ...@@ -250,7 +250,7 @@ class MediaQueryData {
/// This property is currently only expected to be set to a non-default value /// This property is currently only expected to be set to a non-default value
/// on Android starting with version Q. /// on Android starting with version Q.
/// ///
/// {@tool dartpad --template=stateful_widget_material_no_null_safety} /// {@tool dartpad --template=stateful_widget_material}
/// ///
/// For apps that might be deployed on Android Q devices with full gesture /// For apps that might be deployed on Android Q devices with full gesture
/// navigation enabled, use [systemGestureInsets] with [Padding] /// navigation enabled, use [systemGestureInsets] with [Padding]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment