mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Migrated some services and widgets doc comments to null safety. (#72792)
This commit is contained in:
parent
6118eaa0de
commit
a6117269c6
@ -58,7 +58,7 @@ abstract class KeyboardKey with Diagnosticable {
|
||||
/// // The node used to request the keyboard focus.
|
||||
/// final FocusNode _focusNode = FocusNode();
|
||||
/// // The message to display.
|
||||
/// String _message;
|
||||
/// String? _message;
|
||||
///
|
||||
/// // Focus nodes need to be disposed.
|
||||
/// @override
|
||||
@ -75,7 +75,7 @@ abstract class KeyboardKey with Diagnosticable {
|
||||
/// _message = 'Pressed the "Q" key!';
|
||||
/// } else {
|
||||
/// if (kReleaseMode) {
|
||||
/// _message = 'Not a Q: Key label is "${event.logicalKey.keyLabel ?? '<none>'}"';
|
||||
/// _message = 'Not a Q: Key label is "${event.logicalKey.keyLabel}"';
|
||||
/// } else {
|
||||
/// // This will only print useful information in debug mode.
|
||||
/// _message = 'Not a Q: Pressed ${event.logicalKey.debugName}';
|
||||
@ -91,13 +91,13 @@ abstract class KeyboardKey with Diagnosticable {
|
||||
/// color: Colors.white,
|
||||
/// alignment: Alignment.center,
|
||||
/// child: DefaultTextStyle(
|
||||
/// style: textTheme.headline4,
|
||||
/// style: textTheme.headline4!,
|
||||
/// child: RawKeyboardListener(
|
||||
/// focusNode: _focusNode,
|
||||
/// onKey: _handleKeyEvent,
|
||||
/// child: AnimatedBuilder(
|
||||
/// animation: _focusNode,
|
||||
/// builder: (BuildContext context, Widget child) {
|
||||
/// builder: (BuildContext context, Widget? child) {
|
||||
/// if (!_focusNode.hasFocus) {
|
||||
/// return GestureDetector(
|
||||
/// onTap: () {
|
||||
@ -346,7 +346,7 @@ class LogicalKeyboardKey extends KeyboardKey {
|
||||
/// // The node used to request the keyboard focus.
|
||||
/// final FocusNode _focusNode = FocusNode();
|
||||
/// // The message to display.
|
||||
/// String _message;
|
||||
/// String? _message;
|
||||
///
|
||||
/// // Focus nodes need to be disposed.
|
||||
/// @override
|
||||
@ -374,13 +374,13 @@ class LogicalKeyboardKey extends KeyboardKey {
|
||||
/// color: Colors.white,
|
||||
/// alignment: Alignment.center,
|
||||
/// child: DefaultTextStyle(
|
||||
/// style: textTheme.headline4,
|
||||
/// style: textTheme.headline4!,
|
||||
/// child: RawKeyboardListener(
|
||||
/// focusNode: _focusNode,
|
||||
/// onKey: _handleKeyEvent,
|
||||
/// child: AnimatedBuilder(
|
||||
/// animation: _focusNode,
|
||||
/// builder: (BuildContext context, Widget child) {
|
||||
/// builder: (BuildContext context, Widget? child) {
|
||||
/// if (!_focusNode.hasFocus) {
|
||||
/// return GestureDetector(
|
||||
/// onTap: () {
|
||||
|
@ -45,7 +45,7 @@ abstract class KeyboardKey with Diagnosticable {
|
||||
/// look at the physical key to make sure that regardless of the character the
|
||||
/// key produces, you got the key that is in that location on the keyboard.
|
||||
///
|
||||
/// {@tool dartpad --template=stateful_widget_scaffold_no_null_safety}
|
||||
/// {@tool dartpad --template=stateful_widget_scaffold}
|
||||
/// This example shows how to detect if the user has selected the logical "Q"
|
||||
/// key.
|
||||
///
|
||||
@ -58,7 +58,7 @@ abstract class KeyboardKey with Diagnosticable {
|
||||
/// // The node used to request the keyboard focus.
|
||||
/// final FocusNode _focusNode = FocusNode();
|
||||
/// // The message to display.
|
||||
/// String _message;
|
||||
/// String? _message;
|
||||
///
|
||||
/// // Focus nodes need to be disposed.
|
||||
/// @override
|
||||
@ -75,7 +75,7 @@ abstract class KeyboardKey with Diagnosticable {
|
||||
/// _message = 'Pressed the "Q" key!';
|
||||
/// } else {
|
||||
/// if (kReleaseMode) {
|
||||
/// _message = 'Not a Q: Key label is "${event.logicalKey.keyLabel ?? '<none>'}"';
|
||||
/// _message = 'Not a Q: Key label is "${event.logicalKey.keyLabel}"';
|
||||
/// } else {
|
||||
/// // This will only print useful information in debug mode.
|
||||
/// _message = 'Not a Q: Pressed ${event.logicalKey.debugName}';
|
||||
@ -91,13 +91,13 @@ abstract class KeyboardKey with Diagnosticable {
|
||||
/// color: Colors.white,
|
||||
/// alignment: Alignment.center,
|
||||
/// child: DefaultTextStyle(
|
||||
/// style: textTheme.headline4,
|
||||
/// style: textTheme.headline4!,
|
||||
/// child: RawKeyboardListener(
|
||||
/// focusNode: _focusNode,
|
||||
/// onKey: _handleKeyEvent,
|
||||
/// child: AnimatedBuilder(
|
||||
/// animation: _focusNode,
|
||||
/// builder: (BuildContext context, Widget child) {
|
||||
/// builder: (BuildContext context, Widget? child) {
|
||||
/// if (!_focusNode.hasFocus) {
|
||||
/// return GestureDetector(
|
||||
/// onTap: () {
|
||||
@ -1987,7 +1987,7 @@ class LogicalKeyboardKey extends KeyboardKey {
|
||||
/// looking for "the key next next to the TAB key", since on a French keyboard,
|
||||
/// the key next to the TAB key has an "A" on it.
|
||||
///
|
||||
/// {@tool dartpad --template=stateful_widget_scaffold_no_null_safety}
|
||||
/// {@tool dartpad --template=stateful_widget_scaffold}
|
||||
/// This example shows how to detect if the user has selected the physical key
|
||||
/// to the right of the CAPS LOCK key.
|
||||
///
|
||||
@ -1999,7 +1999,7 @@ class LogicalKeyboardKey extends KeyboardKey {
|
||||
/// // The node used to request the keyboard focus.
|
||||
/// final FocusNode _focusNode = FocusNode();
|
||||
/// // The message to display.
|
||||
/// String _message;
|
||||
/// String? _message;
|
||||
///
|
||||
/// // Focus nodes need to be disposed.
|
||||
/// @override
|
||||
@ -2027,13 +2027,13 @@ class LogicalKeyboardKey extends KeyboardKey {
|
||||
/// color: Colors.white,
|
||||
/// alignment: Alignment.center,
|
||||
/// child: DefaultTextStyle(
|
||||
/// style: textTheme.headline4,
|
||||
/// style: textTheme.headline4!,
|
||||
/// child: RawKeyboardListener(
|
||||
/// focusNode: _focusNode,
|
||||
/// onKey: _handleKeyEvent,
|
||||
/// child: AnimatedBuilder(
|
||||
/// animation: _focusNode,
|
||||
/// builder: (BuildContext context, Widget child) {
|
||||
/// builder: (BuildContext context, Widget? child) {
|
||||
/// if (!_focusNode.hasFocus) {
|
||||
/// return GestureDetector(
|
||||
/// onTap: () {
|
||||
|
@ -12,9 +12,6 @@ import 'binding.dart';
|
||||
import 'message_codec.dart';
|
||||
import 'message_codecs.dart';
|
||||
|
||||
// Examples can assume:
|
||||
// // @dart = 2.9
|
||||
|
||||
/// A named channel for communicating with platform plugins using asynchronous
|
||||
/// message passing.
|
||||
///
|
||||
@ -196,9 +193,9 @@ class MethodChannel {
|
||||
/// static const MethodChannel _channel = MethodChannel('music');
|
||||
///
|
||||
/// static Future<bool> isLicensed() async {
|
||||
/// // invokeMethod returns a Future<T> which can be inferred as bool
|
||||
/// // in this context.
|
||||
/// return _channel.invokeMethod('isLicensed');
|
||||
/// // invokeMethod returns a Future<T?>, so we handle the case where
|
||||
/// // the return value is null by treating null as false.
|
||||
/// return _channel.invokeMethod<bool>('isLicensed').then<bool>((bool? value) => value ?? false);
|
||||
/// }
|
||||
///
|
||||
/// static Future<List<Song>> songs() async {
|
||||
|
@ -344,7 +344,7 @@ class SystemChrome {
|
||||
/// navigation bar and synthesize them into a single style. This can be used
|
||||
/// to configure the system styles when an app bar is not used.
|
||||
///
|
||||
/// {@tool sample --template=stateful_widget_material_no_null_safety}
|
||||
/// {@tool sample --template=stateful_widget_material}
|
||||
/// The following example creates a widget that changes the status bar color
|
||||
/// to a random value on Android.
|
||||
///
|
||||
|
@ -11,8 +11,7 @@ import 'ticker_provider.dart';
|
||||
import 'transitions.dart';
|
||||
|
||||
// Examples can assume:
|
||||
// // @dart = 2.9
|
||||
// bool _first;
|
||||
// bool _first = false;
|
||||
|
||||
/// Specifies which of two children to show. See [AnimatedCrossFade].
|
||||
///
|
||||
|
@ -66,12 +66,11 @@ export 'package:flutter/rendering.dart' show
|
||||
WrapCrossAlignment;
|
||||
|
||||
// Examples can assume:
|
||||
// // @dart = 2.9
|
||||
// class TestWidget extends StatelessWidget { @override Widget build(BuildContext context) => const Placeholder(); }
|
||||
// WidgetTester tester;
|
||||
// bool _visible;
|
||||
// late WidgetTester tester;
|
||||
// late bool _visible;
|
||||
// class Sky extends CustomPainter { @override void paint(Canvas c, Size s) => null; @override bool shouldRepaint(Sky s) => false; }
|
||||
// BuildContext context;
|
||||
// late BuildContext context;
|
||||
// dynamic userAvatarUrl;
|
||||
|
||||
// BIDIRECTIONAL TEXT SUPPORT
|
||||
@ -1475,7 +1474,7 @@ class CompositedTransformFollower extends SingleChildRenderObjectWidget {
|
||||
///
|
||||
/// {@youtube 560 315 https://www.youtube.com/watch?v=T4Uehk3_wlY}
|
||||
///
|
||||
/// {@tool dartpad --template=stateless_widget_scaffold_center_no_null_safety}
|
||||
/// {@tool dartpad --template=stateless_widget_scaffold_center}
|
||||
///
|
||||
/// In this example, the image is stretched to fill the entire [Container], which would
|
||||
/// not happen normally without using FittedBox.
|
||||
@ -2759,7 +2758,7 @@ class SizedOverflowBox extends SingleChildRenderObjectWidget {
|
||||
/// needed, prefer removing the widget from the tree entirely rather than
|
||||
/// keeping it alive in an [Offstage] subtree.
|
||||
///
|
||||
/// {@tool dartpad --template=stateful_widget_scaffold_center_no_null_safety}
|
||||
/// {@tool dartpad --template=stateful_widget_scaffold_center}
|
||||
///
|
||||
/// This example shows a [FlutterLogo] widget when the `_offstage` member field
|
||||
/// is false, and hides it without any room in the parent when it is true. When
|
||||
@ -2771,7 +2770,7 @@ class SizedOverflowBox extends SingleChildRenderObjectWidget {
|
||||
/// bool _offstage = true;
|
||||
///
|
||||
/// Size _getFlutterLogoSize() {
|
||||
/// final RenderBox renderLogo = _key.currentContext.findRenderObject();
|
||||
/// final RenderBox renderLogo = _key.currentContext!.findRenderObject()! as RenderBox;
|
||||
/// return renderLogo.size;
|
||||
/// }
|
||||
///
|
||||
@ -2883,7 +2882,7 @@ class _OffstageElement extends SingleChildRenderObjectElement {
|
||||
/// 16.0/9.0. If the maximum width is infinite, the initial width is determined
|
||||
/// by applying the aspect ratio to the maximum height.
|
||||
///
|
||||
/// {@tool dartpad --template=stateless_widget_scaffold_no_null_safety}
|
||||
/// {@tool dartpad --template=stateless_widget_scaffold}
|
||||
///
|
||||
/// This examples shows how AspectRatio sets width when its parent's width
|
||||
/// constraint is infinite. Since its parent's allowed height is a fixed value,
|
||||
@ -2915,7 +2914,7 @@ class _OffstageElement extends SingleChildRenderObjectElement {
|
||||
/// the height to be between 0.0 and 100.0. We'll select a width of 100.0 (the
|
||||
/// biggest allowed) and a height of 50.0 (to match the aspect ratio).
|
||||
///
|
||||
/// {@tool dartpad --template=stateless_widget_scaffold_no_null_safety}
|
||||
/// {@tool dartpad --template=stateless_widget_scaffold}
|
||||
///
|
||||
/// ```dart
|
||||
/// Widget build(BuildContext context) {
|
||||
@ -2949,7 +2948,7 @@ class _OffstageElement extends SingleChildRenderObjectElement {
|
||||
/// will eventually select a size for the child that meets the layout
|
||||
/// constraints but fails to meet the aspect ratio constraints.
|
||||
///
|
||||
/// {@tool dartpad --template=stateless_widget_scaffold_no_null_safety}
|
||||
/// {@tool dartpad --template=stateless_widget_scaffold}
|
||||
///
|
||||
/// ```dart
|
||||
/// Widget build(BuildContext context) {
|
||||
@ -4810,7 +4809,7 @@ class Flexible extends ParentDataWidget<FlexParentData> {
|
||||
///
|
||||
/// {@youtube 560 315 https://www.youtube.com/watch?v=_rnZaagadyo}
|
||||
///
|
||||
/// {@tool dartpad --template=stateless_widget_material_no_null_safety}
|
||||
/// {@tool dartpad --template=stateless_widget_material}
|
||||
/// This example shows how to use an [Expanded] widget in a [Column] so that
|
||||
/// its middle child, a [Container] here, expands to fill the space.
|
||||
///
|
||||
@ -4849,7 +4848,7 @@ class Flexible extends ParentDataWidget<FlexParentData> {
|
||||
/// ```
|
||||
/// {@end-tool}
|
||||
///
|
||||
/// {@tool dartpad --template=stateless_widget_material_no_null_safety}
|
||||
/// {@tool dartpad --template=stateless_widget_material}
|
||||
/// This example shows how to use an [Expanded] widget in a [Row] with multiple
|
||||
/// children expanded, utilizing the [flex] factor to prioritize available space.
|
||||
///
|
||||
@ -5200,7 +5199,7 @@ class Wrap extends MultiChildRenderObjectWidget {
|
||||
/// * The [catalog of layout widgets](https://flutter.dev/widgets/layout/).
|
||||
///
|
||||
///
|
||||
/// {@tool dartpad --template=freeform_no_null_safety}
|
||||
/// {@tool dartpad --template=freeform}
|
||||
///
|
||||
/// This example uses the [Flow] widget to create a menu that opens and closes
|
||||
/// as it is interacted with, shown above. The color of the button in the menu
|
||||
@ -5231,7 +5230,7 @@ class Wrap extends MultiChildRenderObjectWidget {
|
||||
/// }
|
||||
///
|
||||
/// class _FlowMenuState extends State<FlowMenu> with SingleTickerProviderStateMixin {
|
||||
/// AnimationController menuAnimation;
|
||||
/// late AnimationController menuAnimation;
|
||||
/// IconData lastTapped = Icons.notifications;
|
||||
/// final List<IconData> menuItems = <IconData>[
|
||||
/// Icons.home,
|
||||
@ -5291,7 +5290,7 @@ class Wrap extends MultiChildRenderObjectWidget {
|
||||
/// }
|
||||
///
|
||||
/// class FlowMenuDelegate extends FlowDelegate {
|
||||
/// FlowMenuDelegate({this.menuAnimation}) : super(repaint: menuAnimation);
|
||||
/// FlowMenuDelegate({required this.menuAnimation}) : super(repaint: menuAnimation);
|
||||
///
|
||||
/// final Animation<double> menuAnimation;
|
||||
///
|
||||
@ -5304,7 +5303,7 @@ class Wrap extends MultiChildRenderObjectWidget {
|
||||
/// void paintChildren(FlowPaintingContext context) {
|
||||
/// double dx = 0.0;
|
||||
/// for (int i = 0; i < context.childCount; ++i) {
|
||||
/// dx = context.getChildSize(i).width * i;
|
||||
/// dx = context.getChildSize(i)!.width * i;
|
||||
/// context.paintChild(
|
||||
/// i,
|
||||
/// transform: Matrix4.translationValues(
|
||||
@ -5843,7 +5842,7 @@ class RawImage extends LeafRenderObjectWidget {
|
||||
/// Future<ByteData> load(String key) async {
|
||||
/// if (key == 'resources/test')
|
||||
/// return ByteData.view(Uint8List.fromList(utf8.encode('Hello World!')).buffer);
|
||||
/// return null;
|
||||
/// return ByteData(0);
|
||||
/// }
|
||||
/// }
|
||||
/// ```
|
||||
@ -5968,7 +5967,7 @@ class WidgetToRenderBoxAdapter extends LeafRenderObjectWidget {
|
||||
/// If it has a child, this widget defers to the child for sizing behavior. If
|
||||
/// it does not have a child, it grows to fit the parent instead.
|
||||
///
|
||||
/// {@tool dartpad --template=stateful_widget_scaffold_center_no_null_safety}
|
||||
/// {@tool dartpad --template=stateful_widget_scaffold_center}
|
||||
/// This example makes a [Container] react to being touched, showing a count of
|
||||
/// the number of pointer downs and ups.
|
||||
///
|
||||
@ -6138,7 +6137,7 @@ class Listener extends SingleChildRenderObjectWidget {
|
||||
/// If it has a child, this widget defers to the child for sizing behavior. If
|
||||
/// it does not have a child, it grows to fit the parent instead.
|
||||
///
|
||||
/// {@tool dartpad --template=stateful_widget_scaffold_center_no_null_safety}
|
||||
/// {@tool dartpad --template=stateful_widget_scaffold_center}
|
||||
/// This example makes a [Container] react to being entered by a mouse
|
||||
/// pointer, showing a count of the number of entries and exits.
|
||||
///
|
||||
@ -6307,7 +6306,7 @@ class MouseRegion extends StatefulWidget {
|
||||
/// override [State.dispose] and call [onExit], or create your own widget
|
||||
/// using [RenderMouseRegion].
|
||||
///
|
||||
/// {@tool dartpad --template=stateful_widget_scaffold_center_no_null_safety}
|
||||
/// {@tool dartpad --template=stateful_widget_scaffold_center}
|
||||
/// The following example shows a blue rectangular that turns yellow when
|
||||
/// hovered. Since the hover state is completely contained within a widget
|
||||
/// that unconditionally creates the `MouseRegion`, you can ignore the
|
||||
@ -6335,7 +6334,7 @@ class MouseRegion extends StatefulWidget {
|
||||
/// ```
|
||||
/// {@end-tool}
|
||||
///
|
||||
/// {@tool dartpad --template=stateful_widget_scaffold_center_no_null_safety}
|
||||
/// {@tool dartpad --template=stateful_widget_scaffold_center}
|
||||
/// The following example shows a widget that hides its content one second
|
||||
/// after being hovered, and also exposes the enter and exit callbacks.
|
||||
/// Because the widget conditionally creates the `MouseRegion`, and leaks the
|
||||
@ -6347,7 +6346,7 @@ class MouseRegion extends StatefulWidget {
|
||||
/// ```dart preamble
|
||||
/// // A region that hides its content one second after being hovered.
|
||||
/// class MyTimedButton extends StatefulWidget {
|
||||
/// MyTimedButton({ Key key, this.onEnterButton, this.onExitButton })
|
||||
/// MyTimedButton({ Key? key, required this.onEnterButton, required this.onExitButton })
|
||||
/// : super(key: key);
|
||||
///
|
||||
/// final VoidCallback onEnterButton;
|
||||
@ -6624,7 +6623,7 @@ class RepaintBoundary extends SingleChildRenderObjectWidget {
|
||||
///
|
||||
/// {@youtube 560 315 https://www.youtube.com/watch?v=qV9pqHWxYgI}
|
||||
///
|
||||
/// {@tool dartpad --template=stateful_widget_material_no_null_safety}
|
||||
/// {@tool dartpad --template=stateful_widget_material}
|
||||
/// The following sample has an [IgnorePointer] widget wrapping the `Column`
|
||||
/// which contains a button.
|
||||
/// When [ignoring] is set to `true` anything inside the `Column` can
|
||||
@ -6740,7 +6739,7 @@ class IgnorePointer extends SingleChildRenderObjectWidget {
|
||||
///
|
||||
/// {@youtube 560 315 https://www.youtube.com/watch?v=65HoWqBboI8}
|
||||
///
|
||||
/// {@tool dartpad --template=stateless_widget_scaffold_center_no_null_safety}
|
||||
/// {@tool dartpad --template=stateless_widget_scaffold_center}
|
||||
/// The following sample has an [AbsorbPointer] widget wrapping the button on
|
||||
/// top of the stack, which absorbs pointer events, preventing its child button
|
||||
/// __and__ the button below it in the stack from receiving the pointer events.
|
||||
@ -7248,7 +7247,7 @@ class Semantics extends SingleChildRenderObjectWidget {
|
||||
/// children: <Widget>[
|
||||
/// Checkbox(
|
||||
/// value: true,
|
||||
/// onChanged: (bool value) => null,
|
||||
/// onChanged: (bool? value) {},
|
||||
/// ),
|
||||
/// const Text("Settings"),
|
||||
/// ],
|
||||
@ -7578,7 +7577,7 @@ typedef StatefulWidgetBuilder = Widget Function(BuildContext context, StateSette
|
||||
/// await showDialog<void>(
|
||||
/// context: context,
|
||||
/// builder: (BuildContext context) {
|
||||
/// int selectedRadio = 0;
|
||||
/// int? selectedRadio = 0;
|
||||
/// return AlertDialog(
|
||||
/// content: StatefulBuilder(
|
||||
/// builder: (BuildContext context, StateSetter setState) {
|
||||
@ -7588,7 +7587,7 @@ typedef StatefulWidgetBuilder = Widget Function(BuildContext context, StateSette
|
||||
/// return Radio<int>(
|
||||
/// value: index,
|
||||
/// groupValue: selectedRadio,
|
||||
/// onChanged: (int value) {
|
||||
/// onChanged: (int? value) {
|
||||
/// setState(() => selectedRadio = value);
|
||||
/// },
|
||||
/// );
|
||||
|
@ -48,11 +48,10 @@ export 'package:flutter/gestures.dart' show
|
||||
export 'package:flutter/rendering.dart' show RenderSemanticsGestureHandler;
|
||||
|
||||
// Examples can assume:
|
||||
// // @dart = 2.9
|
||||
// bool _lights;
|
||||
// late bool _lights;
|
||||
// void setState(VoidCallback fn) { }
|
||||
// String _last;
|
||||
// Color _color;
|
||||
// late String _last;
|
||||
// late Color _color;
|
||||
|
||||
/// Factory for creating gesture recognizers.
|
||||
///
|
||||
@ -1045,8 +1044,8 @@ class RawGestureDetector extends StatefulWidget {
|
||||
/// ```dart
|
||||
/// class ForcePressGestureDetectorWithSemantics extends StatelessWidget {
|
||||
/// const ForcePressGestureDetectorWithSemantics({
|
||||
/// this.child,
|
||||
/// this.onForcePress,
|
||||
/// required this.child,
|
||||
/// required this.onForcePress,
|
||||
/// });
|
||||
///
|
||||
/// final Widget child;
|
||||
|
@ -762,7 +762,7 @@ class Image extends StatefulWidget {
|
||||
/// ```
|
||||
/// {@endtemplate}
|
||||
///
|
||||
/// {@tool dartpad --template=stateless_widget_material_no_null_safety}
|
||||
/// {@tool dartpad --template=stateless_widget_material}
|
||||
///
|
||||
/// The following sample demonstrates how to use this builder to implement an
|
||||
/// image that fades in once it's been loaded.
|
||||
@ -781,8 +781,8 @@ class Image extends StatefulWidget {
|
||||
/// ),
|
||||
/// child: Image.network(
|
||||
/// 'https://flutter.github.io/assets-for-api-docs/assets/widgets/puffin.jpg',
|
||||
/// frameBuilder: (BuildContext context, Widget child, int frame, bool wasSynchronouslyLoaded) {
|
||||
/// if (wasSynchronouslyLoaded) {
|
||||
/// frameBuilder: (BuildContext context, Widget child, int? frame, bool? wasSynchronouslyLoaded) {
|
||||
/// if (wasSynchronouslyLoaded ?? false) {
|
||||
/// return child;
|
||||
/// }
|
||||
/// return AnimatedOpacity(
|
||||
@ -828,7 +828,7 @@ class Image extends StatefulWidget {
|
||||
///
|
||||
/// {@macro flutter.widgets.Image.frameBuilder.chainedBuildersExample}
|
||||
///
|
||||
/// {@tool dartpad --template=stateless_widget_material_no_null_safety}
|
||||
/// {@tool dartpad --template=stateless_widget_material}
|
||||
///
|
||||
/// The following sample uses [loadingBuilder] to show a
|
||||
/// [CircularProgressIndicator] while an image loads over the network.
|
||||
@ -843,13 +843,13 @@ class Image extends StatefulWidget {
|
||||
/// ),
|
||||
/// child: Image.network(
|
||||
/// 'https://example.com/image.jpg',
|
||||
/// loadingBuilder: (BuildContext context, Widget child, ImageChunkEvent loadingProgress) {
|
||||
/// loadingBuilder: (BuildContext context, Widget child, ImageChunkEvent? loadingProgress) {
|
||||
/// if (loadingProgress == null)
|
||||
/// return child;
|
||||
/// return Center(
|
||||
/// child: CircularProgressIndicator(
|
||||
/// value: loadingProgress.expectedTotalBytes != null
|
||||
/// ? loadingProgress.cumulativeBytesLoaded / loadingProgress.expectedTotalBytes
|
||||
/// ? loadingProgress.cumulativeBytesLoaded / loadingProgress.expectedTotalBytes!
|
||||
/// : null,
|
||||
/// ),
|
||||
/// );
|
||||
@ -873,7 +873,7 @@ class Image extends StatefulWidget {
|
||||
/// [FlutterError.onError]. If it is provided, the caller should either handle
|
||||
/// the exception by providing a replacement widget, or rethrow the exception.
|
||||
///
|
||||
/// {@tool dartpad --template=stateless_widget_material_no_null_safety}
|
||||
/// {@tool dartpad --template=stateless_widget_material}
|
||||
///
|
||||
/// The following sample uses [errorBuilder] to show a '😢' in place of the
|
||||
/// image that fails to load, and prints the error to the console.
|
||||
@ -888,7 +888,7 @@ class Image extends StatefulWidget {
|
||||
/// ),
|
||||
/// child: Image.network(
|
||||
/// 'https://example.does.not.exist/image.jpg',
|
||||
/// errorBuilder: (BuildContext context, Object exception, StackTrace stackTrace) {
|
||||
/// errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||
/// // Appropriate logging or analytics, e.g.
|
||||
/// // myAnalytics.recordError(
|
||||
/// // 'An error occurred loading "https://example.does.not.exist/image.jpg"',
|
||||
|
@ -19,7 +19,6 @@ import 'ticker_provider.dart';
|
||||
import 'transitions.dart';
|
||||
|
||||
// Examples can assume:
|
||||
// // @dart = 2.9
|
||||
// class MyWidget extends ImplicitlyAnimatedWidget {
|
||||
// MyWidget() : super(duration: const Duration(seconds: 1));
|
||||
// final Color targetColor = Colors.black;
|
||||
@ -480,14 +479,14 @@ abstract class ImplicitlyAnimatedWidgetState<T extends ImplicitlyAnimatedWidget>
|
||||
///
|
||||
/// ```dart
|
||||
/// class MyWidgetState extends AnimatedWidgetBaseState<MyWidget> {
|
||||
/// ColorTween _colorTween;
|
||||
/// ColorTween? _colorTween;
|
||||
///
|
||||
/// @override
|
||||
/// Widget build(BuildContext context) {
|
||||
/// return Text(
|
||||
/// 'Hello World',
|
||||
/// // Computes the value of the text color at any given time.
|
||||
/// style: TextStyle(color: _colorTween.evaluate(animation)),
|
||||
/// style: TextStyle(color: _colorTween?.evaluate(animation)),
|
||||
/// );
|
||||
/// }
|
||||
///
|
||||
@ -502,7 +501,7 @@ abstract class ImplicitlyAnimatedWidgetState<T extends ImplicitlyAnimatedWidget>
|
||||
/// // A function that takes a color value and returns a tween
|
||||
/// // beginning at that value.
|
||||
/// (value) => ColorTween(begin: value),
|
||||
/// );
|
||||
/// ) as ColorTween?;
|
||||
///
|
||||
/// // We could have more tweens than one by using the visitor
|
||||
/// // multiple times.
|
||||
@ -573,7 +572,7 @@ abstract class AnimatedWidgetBaseState<T extends ImplicitlyAnimatedWidget> exten
|
||||
///
|
||||
/// {@youtube 560 315 https://www.youtube.com/watch?v=yI-8QHpGIP4}
|
||||
///
|
||||
/// {@tool dartpad --template=stateful_widget_scaffold_no_null_safety}
|
||||
/// {@tool dartpad --template=stateful_widget_scaffold}
|
||||
///
|
||||
/// The following example (depicted above) transitions an AnimatedContainer
|
||||
/// between two states. It adjusts the `height`, `width`, `color`, and
|
||||
@ -812,7 +811,7 @@ class _AnimatedContainerState extends AnimatedWidgetBaseState<AnimatedContainer>
|
||||
/// of [Curves.fastOutSlowIn].
|
||||
/// {@animation 250 266 https://flutter.github.io/assets-for-api-docs/assets/widgets/animated_padding.mp4}
|
||||
///
|
||||
/// {@tool dartpad --template=stateful_widget_scaffold_no_null_safety}
|
||||
/// {@tool dartpad --template=stateful_widget_scaffold}
|
||||
///
|
||||
/// The following code implements the [AnimatedPadding] widget, using a [curve] of
|
||||
/// [Curves.easeInOut].
|
||||
@ -933,7 +932,7 @@ class _AnimatedPaddingState extends AnimatedWidgetBaseState<AnimatedPadding> {
|
||||
/// it also requires more development overhead as you have to manually manage
|
||||
/// the lifecycle of the underlying [AnimationController].
|
||||
///
|
||||
/// {@tool dartpad --template=stateful_widget_scaffold_no_null_safety}
|
||||
/// {@tool dartpad --template=stateful_widget_scaffold}
|
||||
///
|
||||
/// The following code implements the [AnimatedAlign] widget, using a [curve] of
|
||||
/// [Curves.fastOutSlowIn].
|
||||
@ -1098,7 +1097,7 @@ class _AnimatedAlignState extends AnimatedWidgetBaseState<AnimatedAlign> {
|
||||
/// it also requires more development overhead as you have to manually manage
|
||||
/// the lifecycle of the underlying [AnimationController].
|
||||
///
|
||||
/// {@tool dartpad --template=stateful_widget_scaffold_center_no_null_safety}
|
||||
/// {@tool dartpad --template=stateful_widget_scaffold_center}
|
||||
///
|
||||
/// The following example transitions an AnimatedPositioned
|
||||
/// between two states. It adjusts the `height`, `width`, and
|
||||
@ -1550,7 +1549,7 @@ class _AnimatedOpacityState extends ImplicitlyAnimatedWidgetState<AnimatedOpacit
|
||||
/// Here's an illustration of what using this widget looks like, using a [curve]
|
||||
/// of [Curves.fastOutSlowIn].
|
||||
///
|
||||
/// {@tool dartpad --template=stateful_widget_scaffold_center_freeform_state_no_null_safety}
|
||||
/// {@tool dartpad --template=stateful_widget_scaffold_center_freeform_state}
|
||||
/// Creates a [CustomScrollView] with a [SliverFixedExtentList] and a
|
||||
/// [FloatingActionButton]. Pressing the button animates the lists' opacity.
|
||||
///
|
||||
|
@ -26,11 +26,10 @@ import 'routes.dart';
|
||||
import 'ticker_provider.dart';
|
||||
|
||||
// Examples can assume:
|
||||
// // @dart = 2.9
|
||||
// class MyPage extends Placeholder { MyPage({String title}); }
|
||||
// class MyPage extends Placeholder { MyPage({String? title}); }
|
||||
// class MyHomePage extends Placeholder { }
|
||||
// NavigatorState navigator;
|
||||
// BuildContext context;
|
||||
// late NavigatorState navigator;
|
||||
// late BuildContext context;
|
||||
|
||||
/// Creates a route for the given route settings.
|
||||
///
|
||||
@ -734,7 +733,7 @@ abstract class RouteTransitionRecord {
|
||||
///
|
||||
/// To make route transition decisions, subclass must implement [resolve].
|
||||
///
|
||||
/// {@tool sample --template=freeform_no_null_safety}
|
||||
/// {@tool sample --template=freeform}
|
||||
/// The following example demonstrates how to implement a subclass that always
|
||||
/// removes or adds routes without animated transitions and puts the removed
|
||||
/// routes at the top of the list.
|
||||
@ -747,9 +746,9 @@ abstract class RouteTransitionRecord {
|
||||
/// class NoAnimationTransitionDelegate extends TransitionDelegate<void> {
|
||||
/// @override
|
||||
/// Iterable<RouteTransitionRecord> resolve({
|
||||
/// List<RouteTransitionRecord> newPageRouteHistory,
|
||||
/// Map<RouteTransitionRecord, RouteTransitionRecord> locationToExitingPageRoute,
|
||||
/// Map<RouteTransitionRecord, List<RouteTransitionRecord>> pageRouteToPagelessRoutes,
|
||||
/// required List<RouteTransitionRecord> newPageRouteHistory,
|
||||
/// required Map<RouteTransitionRecord?, RouteTransitionRecord> locationToExitingPageRoute,
|
||||
/// required Map<RouteTransitionRecord?, List<RouteTransitionRecord>> pageRouteToPagelessRoutes,
|
||||
/// }) {
|
||||
/// final List<RouteTransitionRecord> results = <RouteTransitionRecord>[];
|
||||
///
|
||||
@ -763,7 +762,7 @@ abstract class RouteTransitionRecord {
|
||||
/// for (final RouteTransitionRecord exitingPageRoute in locationToExitingPageRoute.values) {
|
||||
/// if (exitingPageRoute.isWaitingForExitingDecision) {
|
||||
/// exitingPageRoute.markForRemove();
|
||||
/// final List<RouteTransitionRecord> pagelessRoutes = pageRouteToPagelessRoutes[exitingPageRoute];
|
||||
/// final List<RouteTransitionRecord>? pagelessRoutes = pageRouteToPagelessRoutes[exitingPageRoute];
|
||||
/// if (pagelessRoutes != null) {
|
||||
/// for (final RouteTransitionRecord pagelessRoute in pagelessRoutes) {
|
||||
/// pagelessRoute.markForRemove();
|
||||
@ -1267,7 +1266,7 @@ class DefaultTransitionDelegate<T> extends TransitionDelegate<T> {
|
||||
/// [WidgetsApp] and [CupertinoTabView] widgets and do not need to be explicitly
|
||||
/// created or managed.
|
||||
///
|
||||
/// {@tool sample --template=freeform_no_null_safety}
|
||||
/// {@tool sample --template=freeform}
|
||||
/// The following example demonstrates how a nested [Navigator] can be used to
|
||||
/// present a standalone user registration journey.
|
||||
///
|
||||
@ -1305,7 +1304,7 @@ class DefaultTransitionDelegate<T> extends TransitionDelegate<T> {
|
||||
/// @override
|
||||
/// Widget build(BuildContext context) {
|
||||
/// return DefaultTextStyle(
|
||||
/// style: Theme.of(context).textTheme.headline4,
|
||||
/// style: Theme.of(context).textTheme.headline4!,
|
||||
/// child: Container(
|
||||
/// color: Colors.white,
|
||||
/// alignment: Alignment.center,
|
||||
@ -1319,7 +1318,7 @@ class DefaultTransitionDelegate<T> extends TransitionDelegate<T> {
|
||||
/// @override
|
||||
/// Widget build(BuildContext context) {
|
||||
/// return DefaultTextStyle(
|
||||
/// style: Theme.of(context).textTheme.headline4,
|
||||
/// style: Theme.of(context).textTheme.headline4!,
|
||||
/// child: GestureDetector(
|
||||
/// onTap: () {
|
||||
/// // This moves from the personal info page to the credentials page,
|
||||
@ -1339,7 +1338,7 @@ class DefaultTransitionDelegate<T> extends TransitionDelegate<T> {
|
||||
///
|
||||
/// class ChooseCredentialsPage extends StatelessWidget {
|
||||
/// const ChooseCredentialsPage({
|
||||
/// this.onSignupComplete,
|
||||
/// required this.onSignupComplete,
|
||||
/// });
|
||||
///
|
||||
/// final VoidCallback onSignupComplete;
|
||||
@ -1349,7 +1348,7 @@ class DefaultTransitionDelegate<T> extends TransitionDelegate<T> {
|
||||
/// return GestureDetector(
|
||||
/// onTap: onSignupComplete,
|
||||
/// child: DefaultTextStyle(
|
||||
/// style: Theme.of(context).textTheme.headline4,
|
||||
/// style: Theme.of(context).textTheme.headline4!,
|
||||
/// child: Container(
|
||||
/// color: Colors.pinkAccent,
|
||||
/// alignment: Alignment.center,
|
||||
@ -1674,7 +1673,7 @@ class Navigator extends StatefulWidget {
|
||||
///
|
||||
/// ```dart
|
||||
/// class WeatherRouteArguments {
|
||||
/// WeatherRouteArguments({ this.city, this.country });
|
||||
/// WeatherRouteArguments({ required this.city, required this.country });
|
||||
/// final String city;
|
||||
/// final String country;
|
||||
///
|
||||
@ -2120,12 +2119,12 @@ class Navigator extends StatefulWidget {
|
||||
///
|
||||
/// {@macro flutter.widgets.Navigator.restorablePushNamed.returnValue}
|
||||
///
|
||||
/// {@tool dartpad --template=stateful_widget_material_no_null_safety}
|
||||
/// {@tool dartpad --template=stateful_widget_material}
|
||||
///
|
||||
/// Typical usage is as follows:
|
||||
///
|
||||
/// ```dart
|
||||
/// static Route _myRouteBuilder(BuildContext context, Object arguments) {
|
||||
/// static Route _myRouteBuilder(BuildContext context, Object? arguments) {
|
||||
/// return MaterialPageRoute(
|
||||
/// builder: (BuildContext context) => MyStatefulWidget(),
|
||||
/// );
|
||||
@ -2215,12 +2214,12 @@ class Navigator extends StatefulWidget {
|
||||
///
|
||||
/// {@macro flutter.widgets.Navigator.restorablePushNamed.returnValue}
|
||||
///
|
||||
/// {@tool dartpad --template=stateful_widget_material_no_null_safety}
|
||||
/// {@tool dartpad --template=stateful_widget_material}
|
||||
///
|
||||
/// Typical usage is as follows:
|
||||
///
|
||||
/// ```dart
|
||||
/// static Route _myRouteBuilder(BuildContext context, Object arguments) {
|
||||
/// static Route _myRouteBuilder(BuildContext context, Object? arguments) {
|
||||
/// return MaterialPageRoute(
|
||||
/// builder: (BuildContext context) => MyStatefulWidget(),
|
||||
/// );
|
||||
@ -2320,12 +2319,12 @@ class Navigator extends StatefulWidget {
|
||||
///
|
||||
/// {@macro flutter.widgets.Navigator.restorablePushNamed.returnValue}
|
||||
///
|
||||
/// {@tool dartpad --template=stateful_widget_material_no_null_safety}
|
||||
/// {@tool dartpad --template=stateful_widget_material}
|
||||
///
|
||||
/// Typical usage is as follows:
|
||||
///
|
||||
/// ```dart
|
||||
/// static Route _myRouteBuilder(BuildContext context, Object arguments) {
|
||||
/// static Route _myRouteBuilder(BuildContext context, Object? arguments) {
|
||||
/// return MaterialPageRoute(
|
||||
/// builder: (BuildContext context) => MyStatefulWidget(),
|
||||
/// );
|
||||
@ -4364,12 +4363,12 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
|
||||
///
|
||||
/// {@macro flutter.widgets.Navigator.restorablePushNamed.returnValue}
|
||||
///
|
||||
/// {@tool dartpad --template=stateful_widget_material_no_null_safety}
|
||||
/// {@tool dartpad --template=stateful_widget_material}
|
||||
///
|
||||
/// Typical usage is as follows:
|
||||
///
|
||||
/// ```dart
|
||||
/// static Route _myRouteBuilder(BuildContext context, Object arguments) {
|
||||
/// static Route _myRouteBuilder(BuildContext context, Object? arguments) {
|
||||
/// return MaterialPageRoute(
|
||||
/// builder: (BuildContext context) => MyStatefulWidget(),
|
||||
/// );
|
||||
@ -4502,12 +4501,12 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
|
||||
///
|
||||
/// {@macro flutter.widgets.Navigator.restorablePushNamed.returnValue}
|
||||
///
|
||||
/// {@tool dartpad --template=stateful_widget_material_no_null_safety}
|
||||
/// {@tool dartpad --template=stateful_widget_material}
|
||||
///
|
||||
/// Typical usage is as follows:
|
||||
///
|
||||
/// ```dart
|
||||
/// static Route _myRouteBuilder(BuildContext context, Object arguments) {
|
||||
/// static Route _myRouteBuilder(BuildContext context, Object? arguments) {
|
||||
/// return MaterialPageRoute(
|
||||
/// builder: (BuildContext context) => MyStatefulWidget(),
|
||||
/// );
|
||||
@ -4608,12 +4607,12 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
|
||||
///
|
||||
/// {@macro flutter.widgets.Navigator.restorablePushNamed.returnValue}
|
||||
///
|
||||
/// {@tool dartpad --template=stateful_widget_material_no_null_safety}
|
||||
/// {@tool dartpad --template=stateful_widget_material}
|
||||
///
|
||||
/// Typical usage is as follows:
|
||||
///
|
||||
/// ```dart
|
||||
/// static Route _myRouteBuilder(BuildContext context, Object arguments) {
|
||||
/// static Route _myRouteBuilder(BuildContext context, Object? arguments) {
|
||||
/// return MaterialPageRoute(
|
||||
/// builder: (BuildContext context) => MyStatefulWidget(),
|
||||
/// );
|
||||
@ -5528,7 +5527,7 @@ typedef RouteCompletionCallback<T> = void Function(T result);
|
||||
/// When [present] has been called to add a route, it may only be called again
|
||||
/// after the previously added route has completed.
|
||||
///
|
||||
/// {@tool dartpad --template=freeform_no_null_safety}
|
||||
/// {@tool dartpad --template=freeform}
|
||||
/// This example uses a [RestorableRouteFuture] in the `_MyHomeState` to push a
|
||||
/// new `MyCounter` route and to retrieve its return value.
|
||||
///
|
||||
@ -5557,7 +5556,7 @@ typedef RouteCompletionCallback<T> = void Function(T result);
|
||||
///
|
||||
/// ```dart
|
||||
/// class MyHome extends StatefulWidget {
|
||||
/// const MyHome({Key key}) : super(key: key);
|
||||
/// const MyHome({Key? key}) : super(key: key);
|
||||
///
|
||||
/// @override
|
||||
/// State<MyHome> createState() => _MyHomeState();
|
||||
@ -5565,7 +5564,7 @@ typedef RouteCompletionCallback<T> = void Function(T result);
|
||||
///
|
||||
/// class _MyHomeState extends State<MyHome> with RestorationMixin {
|
||||
/// final RestorableInt _lastCount = RestorableInt(0);
|
||||
/// RestorableRouteFuture<int> _counterRoute;
|
||||
/// late RestorableRouteFuture<int> _counterRoute;
|
||||
///
|
||||
/// @override
|
||||
/// String get restorationId => 'home';
|
||||
@ -5573,7 +5572,7 @@ typedef RouteCompletionCallback<T> = void Function(T result);
|
||||
/// void initState() {
|
||||
/// super.initState();
|
||||
/// _counterRoute = RestorableRouteFuture<int>(
|
||||
/// onPresent: (NavigatorState navigator, Object arguments) {
|
||||
/// onPresent: (NavigatorState navigator, Object? arguments) {
|
||||
/// // Defines what route should be shown (and how it should be added
|
||||
/// // to the navigator) when `RestorableRouteFuture.present` is called.
|
||||
/// return navigator.restorablePush(
|
||||
@ -5592,7 +5591,7 @@ typedef RouteCompletionCallback<T> = void Function(T result);
|
||||
/// }
|
||||
///
|
||||
/// @override
|
||||
/// void restoreState(RestorationBucket oldBucket, bool initialRestore) {
|
||||
/// void restoreState(RestorationBucket? oldBucket, bool initialRestore) {
|
||||
/// // Register the `RestorableRouteFuture` with the state restoration framework.
|
||||
/// registerForRestoration(_counterRoute, 'route');
|
||||
/// registerForRestoration(_lastCount, 'count');
|
||||
@ -5602,12 +5601,12 @@ typedef RouteCompletionCallback<T> = void Function(T result);
|
||||
/// void dispose() {
|
||||
/// super.dispose();
|
||||
/// _lastCount.dispose();
|
||||
/// _counterRoute?.dispose();
|
||||
/// _counterRoute.dispose();
|
||||
/// }
|
||||
///
|
||||
/// // A static `RestorableRouteBuilder` that can re-create the route during
|
||||
/// // state restoration.
|
||||
/// static Route<int> _counterRouteBuilder(BuildContext context, Object arguments) {
|
||||
/// static Route<int> _counterRouteBuilder(BuildContext context, Object? arguments) {
|
||||
/// return MaterialPageRoute(
|
||||
/// builder: (BuildContext context) => MyCounter(
|
||||
/// title: arguments as String,
|
||||
@ -5637,7 +5636,7 @@ typedef RouteCompletionCallback<T> = void Function(T result);
|
||||
///
|
||||
/// // Widget for the route pushed by the `RestorableRouteFuture`.
|
||||
/// class MyCounter extends StatefulWidget {
|
||||
/// const MyCounter({Key key, this.title}) : super(key: key);
|
||||
/// const MyCounter({Key? key, required this.title}) : super(key: key);
|
||||
///
|
||||
/// final String title;
|
||||
///
|
||||
@ -5652,7 +5651,7 @@ typedef RouteCompletionCallback<T> = void Function(T result);
|
||||
/// String get restorationId => 'counter';
|
||||
///
|
||||
/// @override
|
||||
/// void restoreState(RestorationBucket oldBucket, bool initialRestore) {
|
||||
/// void restoreState(RestorationBucket? oldBucket, bool initialRestore) {
|
||||
/// registerForRestoration(_count, 'count');
|
||||
/// }
|
||||
///
|
||||
|
@ -10,9 +10,6 @@ import 'package:flutter/services.dart';
|
||||
import 'editable_text.dart';
|
||||
import 'restoration.dart';
|
||||
|
||||
// Examples can assume:
|
||||
// // @dart = 2.9
|
||||
|
||||
/// A [RestorableProperty] that makes the wrapped value accessible to the owning
|
||||
/// [State] object via the [value] getter and setter.
|
||||
///
|
||||
@ -22,7 +19,7 @@ import 'restoration.dart';
|
||||
///
|
||||
/// ## Using a RestorableValue
|
||||
///
|
||||
/// {@tool dartpad --template=stateful_widget_restoration_no_null_safety}
|
||||
/// {@tool dartpad --template=stateful_widget_restoration}
|
||||
/// A [StatefulWidget] that has a restorable [int] property.
|
||||
///
|
||||
/// ```dart
|
||||
@ -33,7 +30,7 @@ import 'restoration.dart';
|
||||
/// RestorableInt _answer = RestorableInt(42);
|
||||
///
|
||||
/// @override
|
||||
/// void restoreState(RestorationBucket oldBucket, bool initialRestore) {
|
||||
/// void restoreState(RestorationBucket? oldBucket, bool initialRestore) {
|
||||
/// // All restorable properties must be registered with the mixin. After
|
||||
/// // registration, the answer either has its old value restored or is
|
||||
/// // initialized to its default value.
|
||||
@ -77,14 +74,17 @@ import 'restoration.dart';
|
||||
/// Duration createDefaultValue() => const Duration();
|
||||
///
|
||||
/// @override
|
||||
/// void didUpdateValue(Duration oldValue) {
|
||||
/// if (oldValue.inMicroseconds != value.inMicroseconds)
|
||||
/// void didUpdateValue(Duration? oldValue) {
|
||||
/// if (oldValue == null || oldValue.inMicroseconds != value.inMicroseconds)
|
||||
/// notifyListeners();
|
||||
/// }
|
||||
///
|
||||
/// @override
|
||||
/// Duration fromPrimitives(Object data) {
|
||||
/// return Duration(microseconds: data as int);
|
||||
/// Duration fromPrimitives(Object? data) {
|
||||
/// if (data != null) {
|
||||
/// return Duration(microseconds: data as int);
|
||||
/// }
|
||||
/// return const Duration();
|
||||
/// }
|
||||
///
|
||||
/// @override
|
||||
|
@ -24,9 +24,8 @@ import 'scroll_controller.dart';
|
||||
import 'transitions.dart';
|
||||
|
||||
// Examples can assume:
|
||||
// // @dart = 2.9
|
||||
// dynamic routeObserver;
|
||||
// NavigatorState navigator;
|
||||
// late NavigatorState navigator;
|
||||
|
||||
/// A route that displays widgets in the [Navigator]'s [Overlay].
|
||||
abstract class OverlayRoute<T> extends Route<T> {
|
||||
@ -541,7 +540,7 @@ mixin LocalHistoryRoute<T> on Route<T> {
|
||||
/// // rectangle. When this local history entry is removed, we hide the red
|
||||
/// // rectangle.
|
||||
/// setState(() => _showRectangle = true);
|
||||
/// ModalRoute.of(context).addLocalHistoryEntry(
|
||||
/// ModalRoute.of(context)?.addLocalHistoryEntry(
|
||||
/// LocalHistoryEntry(
|
||||
/// onRemove: () {
|
||||
/// // Hide the red rectangle.
|
||||
|
@ -13,8 +13,7 @@ import 'inherited_theme.dart';
|
||||
import 'media_query.dart';
|
||||
|
||||
// Examples can assume:
|
||||
// // @dart = 2.9
|
||||
// String _name;
|
||||
// late String _name;
|
||||
|
||||
/// The text style to apply to descendant [Text] widgets which don't have an
|
||||
/// explicit style.
|
||||
|
Loading…
Reference in New Issue
Block a user