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