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
/// The type of transition can be changed from a cross-fade to a custom
/// 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
/// whenever the value changes.
///
......
......@@ -84,7 +84,7 @@ const int _kObscureShowLatestCharCursorTicks = 3;
///
/// Remember to [dispose] of the [TextEditingController] when it is no longer
/// 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
/// change listener forces the entered text to be lower case and keeps the
/// cursor at the end of the input.
......@@ -926,18 +926,13 @@ class EditableText extends StatefulWidget {
/// and selection, one can add a listener to its [controller] with
/// [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
/// current value each time the user inserts or deletes a character.
///
/// ```dart
/// TextEditingController _controller;
///
/// void initState() {
/// super.initState();
/// _controller = TextEditingController();
/// }
/// final TextEditingController _controller = TextEditingController();
///
/// void dispose() {
/// _controller.dispose();
......@@ -961,7 +956,7 @@ class EditableText extends StatefulWidget {
/// context: context,
/// builder: (BuildContext context) {
/// return AlertDialog(
/// title: const Text('Thats correct!'),
/// title: const Text('That is correct!'),
/// content: Text ('13 is the right answer.'),
/// actions: <Widget>[
/// TextButton(
......
......@@ -303,10 +303,10 @@ enum UnfocusDisposition {
/// [DirectionalFocusTraversalPolicyMixin], but custom policies can be built
/// based upon these policies. See [FocusTraversalPolicy] for more information.
///
/// {@tool dartpad --template=stateless_widget_scaffold_no_null_safety} This example shows how
/// a FocusNode should be managed if not using the [Focus] or [FocusScope]
/// widgets. See the [Focus] widget for a similar example using [Focus] and
/// [FocusScope] widgets.
/// {@tool dartpad --template=stateless_widget_scaffold}
/// This example shows how a FocusNode should be managed if not using the
/// [Focus] or [FocusScope] widgets. See the [Focus] widget for a similar
/// example using [Focus] and [FocusScope] widgets.
///
/// ```dart imports
/// import 'package:flutter/services.dart';
......@@ -314,16 +314,16 @@ enum UnfocusDisposition {
///
/// ```dart preamble
/// class ColorfulButton extends StatefulWidget {
/// ColorfulButton({Key key}) : super(key: key);
/// ColorfulButton({Key? key}) : super(key: key);
///
/// @override
/// _ColorfulButtonState createState() => _ColorfulButtonState();
/// }
///
/// class _ColorfulButtonState extends State<ColorfulButton> {
/// FocusNode _node;
/// late FocusNode _node;
/// bool _focused = false;
/// FocusAttachment _nodeAttachment;
/// late FocusAttachment _nodeAttachment;
/// Color _color = Colors.white;
///
/// @override
......@@ -406,7 +406,7 @@ enum UnfocusDisposition {
/// Widget build(BuildContext context) {
/// final TextTheme textTheme = Theme.of(context).textTheme;
/// return DefaultTextStyle(
/// style: textTheme.headline4,
/// style: textTheme.headline4!,
/// child: ColorfulButton(),
/// );
/// }
......@@ -786,7 +786,7 @@ class FocusNode with DiagnosticableTreeMixin, ChangeNotifier {
/// previous node in the enclosing [FocusTraversalGroup], call [nextFocus] or
/// [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]
/// values for [unfocus].
///
......@@ -835,9 +835,11 @@ class FocusNode with DiagnosticableTreeMixin, ChangeNotifier {
/// children: <Widget>[
/// Radio<UnfocusDisposition>(
/// groupValue: disposition,
/// onChanged: (UnfocusDisposition value) {
/// onChanged: (UnfocusDisposition? value) {
/// setState(() {
/// disposition = value;
/// if (value != null) {
/// disposition = value;
/// }
/// });
/// },
/// value: UnfocusDisposition.values[index],
......@@ -850,7 +852,7 @@ class FocusNode with DiagnosticableTreeMixin, ChangeNotifier {
/// child: const Text('UNFOCUS'),
/// onPressed: () {
/// setState(() {
/// primaryFocus.unfocus(disposition: disposition);
/// primaryFocus!.unfocus(disposition: disposition);
/// });
/// },
/// ),
......
......@@ -1256,14 +1256,18 @@ class _OrderedFocusInfo {
///
/// {@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
/// example, the focus order goes from bottom right (the "One" button) to top
/// left (the "Six" button).
///
/// ```dart preamble
/// 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 bool autofocus;
......@@ -1466,7 +1470,7 @@ class FocusTraversalOrder extends InheritedWidget {
/// To prevent the members of the group from being focused, set the
/// [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
/// [FocusTraversalGroup], each with different traversal order policies. Use tab
/// traversal to see the order they are traversed in. The first row follows a
......@@ -1479,10 +1483,10 @@ class FocusTraversalOrder extends InheritedWidget {
/// /// the type of T.
/// class OrderedButton<T> extends StatefulWidget {
/// const OrderedButton({
/// this.name,
/// required this.name,
/// this.canRequestFocus = true,
/// this.autofocus = false,
/// this.order,
/// required this.order,
/// });
///
/// final String name;
......@@ -1495,7 +1499,7 @@ class FocusTraversalOrder extends InheritedWidget {
/// }
///
/// class _OrderedButtonState<T> extends State<OrderedButton<T>> {
/// FocusNode focusNode;
/// late FocusNode focusNode;
///
/// @override
/// void initState() {
......@@ -1508,12 +1512,12 @@ class FocusTraversalOrder extends InheritedWidget {
///
/// @override
/// void dispose() {
/// focusNode?.dispose();
/// focusNode.dispose();
/// super.dispose();
/// }
///
/// @override
/// void didUpdateWidget(OrderedButton oldWidget) {
/// void didUpdateWidget(OrderedButton<T> oldWidget) {
/// super.didUpdateWidget(oldWidget);
/// focusNode.canRequestFocus = widget.canRequestFocus;
/// }
......@@ -1533,7 +1537,7 @@ class FocusTraversalOrder extends InheritedWidget {
/// order = LexicalFocusOrder(widget.order.toString());
/// }
///
/// Color overlayColor(Set<MaterialState> states) {
/// Color? overlayColor(Set<MaterialState> states) {
/// if (states.contains(MaterialState.focused)) {
/// return Colors.red;
/// }
......@@ -1543,7 +1547,7 @@ class FocusTraversalOrder extends InheritedWidget {
/// 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)) {
/// return Colors.white;
/// }
......@@ -1558,8 +1562,8 @@ class FocusTraversalOrder extends InheritedWidget {
/// focusNode: focusNode,
/// autofocus: widget.autofocus,
/// style: ButtonStyle(
/// overlayColor: MaterialStateProperty.resolveWith<Color>(overlayColor),
/// foregroundColor: MaterialStateProperty.resolveWith<Color>(foregroundColor),
/// overlayColor: MaterialStateProperty.resolveWith<Color?>(overlayColor),
/// foregroundColor: MaterialStateProperty.resolveWith<Color?>(foregroundColor),
/// ),
/// onPressed: () => _handleOnPressed(),
/// child: Text(widget.name),
......
......@@ -17,7 +17,7 @@ import 'framework.dart';
/// 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.
///
/// {@tool dartpad --template=freeform_no_null_safety}
/// {@tool dartpad --template=freeform}
/// This example demonstrates how `InheritedTheme.capture()` can be used
/// 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
......
......@@ -243,7 +243,7 @@ mixin RenderConstrainedLayoutBuilder<ConstraintType extends Constraints, ChildTy
/// in an [Align] widget. If the child might want to be bigger, consider
/// 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
/// DartPad window to see [LayoutBuilder] in action!
......
......@@ -250,7 +250,7 @@ class MediaQueryData {
/// This property is currently only expected to be set to a non-default value
/// 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
/// 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