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
b21e08c8
Unverified
Commit
b21e08c8
authored
Dec 24, 2020
by
Shi-Hao Hong
Committed by
GitHub
Dec 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NNBD] Migrate sample code pt 4 (#72842)
parent
691d05da
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
117 additions
and
179 deletions
+117
-179
actions.dart
packages/flutter/lib/src/widgets/actions.dart
+8
-4
async.dart
packages/flutter/lib/src/widgets/async.dart
+4
-9
form.dart
packages/flutter/lib/src/widgets/form.dart
+3
-3
page_storage.dart
packages/flutter/lib/src/widgets/page_storage.dart
+2
-2
single_child_scroll_view.dart
...ges/flutter/lib/src/widgets/single_child_scroll_view.dart
+4
-4
transitions.dart
packages/flutter/lib/src/widgets/transitions.dart
+93
-154
tween_animation_builder.dart
...ages/flutter/lib/src/widgets/tween_animation_builder.dart
+3
-3
No files found.
packages/flutter/lib/src/widgets/actions.dart
View file @
b21e08c8
...
...
@@ -795,7 +795,7 @@ class _ActionsMarker extends InheritedWidget {
/// widget, and the new control should be enabled for keyboard traversal and
/// activation.
///
/// {@tool dartpad --template=stateful_widget_material
_no_null_safety
}
/// {@tool dartpad --template=stateful_widget_material}
/// This example shows how keyboard interaction can be added to a custom control
/// that changes color when hovered and focused, and can toggle a light when
/// activated, either by touch or by hitting the `X` key on the keyboard when
...
...
@@ -813,7 +813,11 @@ class _ActionsMarker extends InheritedWidget {
///
/// ```dart preamble
/// class FadButton extends StatefulWidget {
/// const FadButton({Key key, this.onPressed, this.child}) : super(key: key);
/// const FadButton({
/// Key? key,
/// required this.onPressed,
/// required this.child,
/// }) : super(key: key);
///
/// final VoidCallback onPressed;
/// final Widget child;
...
...
@@ -826,8 +830,8 @@ class _ActionsMarker extends InheritedWidget {
/// bool _focused = false;
/// bool _hovering = false;
/// bool _on = false;
/// Map<Type, Action<Intent>> _actionMap;
/// Map<LogicalKeySet, Intent> _shortcutMap;
///
late
Map<Type, Action<Intent>> _actionMap;
///
late
Map<LogicalKeySet, Intent> _shortcutMap;
///
/// @override
/// void initState() {
...
...
packages/flutter/lib/src/widgets/async.dart
View file @
b21e08c8
...
...
@@ -12,11 +12,6 @@ import 'package:flutter/foundation.dart';
import
'framework.dart'
;
// Examples can assume:
// // @dart = 2.9
// dynamic _lot;
// Future<String> _calculation;
/// Base class for widgets that build themselves based on interaction with
/// a specified [Stream].
///
...
...
@@ -371,7 +366,7 @@ typedef AsyncWidgetBuilder<T> = Widget Function(BuildContext context, AsyncSnaps
/// as the builder will always be called before the stream listener has a chance
/// to be processed.
///
/// {@tool dartpad --template=stateful_widget_material
_no_null_safety
}
/// {@tool dartpad --template=stateful_widget_material}
///
/// This sample shows a [StreamBuilder] that listens to a Stream that emits bids
/// for an auction. Every time the StreamBuilder receives a bid from the Stream,
...
...
@@ -388,7 +383,7 @@ typedef AsyncWidgetBuilder<T> = Widget Function(BuildContext context, AsyncSnaps
///
/// Widget build(BuildContext context) {
/// return DefaultTextStyle(
/// style: Theme.of(context).textTheme.headline2,
/// style: Theme.of(context).textTheme.headline2
!
,
/// textAlign: TextAlign.center,
/// child: Container(
/// alignment: FractionalOffset.center,
...
...
@@ -614,7 +609,7 @@ class StreamBuilder<T> extends StreamBuilderBase<T, AsyncSnapshot<T>> {
/// `future?.asStream()`, except that snapshots with `ConnectionState.active`
/// may appear for the latter, depending on how the stream is implemented.
///
/// {@tool dartpad --template=stateful_widget_material
_no_null_safety
}
/// {@tool dartpad --template=stateful_widget_material}
///
/// This sample shows a [FutureBuilder] that displays a loading spinner while it
/// loads data. It displays a success icon and text if the [Future] completes
...
...
@@ -630,7 +625,7 @@ class StreamBuilder<T> extends StreamBuilderBase<T, AsyncSnapshot<T>> {
///
/// Widget build(BuildContext context) {
/// return DefaultTextStyle(
/// style: Theme.of(context).textTheme.headline2,
/// style: Theme.of(context).textTheme.headline2
!
,
/// textAlign: TextAlign.center,
/// child: FutureBuilder<String>(
/// future: _calculation, // a previously-obtained Future<String> or null
...
...
packages/flutter/lib/src/widgets/form.dart
View file @
b21e08c8
...
...
@@ -16,7 +16,7 @@ import 'will_pop_scope.dart';
/// with a context whose ancestor is the [Form], or pass a [GlobalKey] to the
/// [Form] constructor and call [GlobalKey.currentState].
///
/// {@tool dartpad --template=stateful_widget_scaffold
_no_null_safety
}
/// {@tool dartpad --template=stateful_widget_scaffold}
/// This example shows a [Form] with one [TextFormField] to enter an email
/// address and an [ElevatedButton] to submit the form. A [GlobalKey] is used here
/// to identify the [Form] and validate input.
...
...
@@ -38,7 +38,7 @@ import 'will_pop_scope.dart';
/// hintText: 'Enter your email',
/// ),
/// validator: (value) {
/// if (value.isEmpty) {
/// if (value
!
.isEmpty) {
/// return 'Please enter some text';
/// }
/// return null;
...
...
@@ -50,7 +50,7 @@ import 'will_pop_scope.dart';
/// onPressed: () {
/// // Validate will return true if the form is valid, or false if
/// // the form is invalid.
/// if (_formKey.currentState.validate()) {
/// if (_formKey.currentState
!
.validate()) {
/// // Process data.
/// }
/// },
...
...
packages/flutter/lib/src/widgets/page_storage.dart
View file @
b21e08c8
...
...
@@ -136,7 +136,7 @@ class PageStorageBucket {
/// you should give each of them unique [PageStorageKey]s, or set some of their
/// `keepScrollOffset` false to prevent saving.
///
/// {@tool dartpad --template=freeform
_no_null_safety
}
/// {@tool dartpad --template=freeform}
///
/// This sample shows how to explicitly use a [PageStorage] to
/// store the states of its children pages. Each page includes a scrollable
...
...
@@ -212,7 +212,7 @@ class PageStorageBucket {
///
/// class ColorBoxPage extends StatelessWidget {
/// ColorBoxPage({
/// Key key,
/// Key
?
key,
/// }) : super(key: key);
///
/// @override
...
...
packages/flutter/lib/src/widgets/single_child_scroll_view.dart
View file @
b21e08c8
...
...
@@ -80,7 +80,7 @@ import 'scrollable.dart';
/// with some remaining space to allocate as specified by its
/// [Column.mainAxisAlignment] argument.
///
/// {@tool dartpad --template=stateless_widget_material
_no_null_safety
}
/// {@tool dartpad --template=stateless_widget_material}
/// In this example, the children are spaced out equally, unless there's no more
/// room, in which case they stack vertically and scroll.
///
...
...
@@ -91,7 +91,7 @@ import 'scrollable.dart';
/// ```dart
/// Widget build(BuildContext context) {
/// return DefaultTextStyle(
/// style: Theme.of(context).textTheme.bodyText2,
/// style: Theme.of(context).textTheme.bodyText2
!
,
/// child: LayoutBuilder(
/// builder: (BuildContext context, BoxConstraints viewportConstraints) {
/// return SingleChildScrollView(
...
...
@@ -154,14 +154,14 @@ import 'scrollable.dart';
/// so that the intrinsic sizing algorithm can short-circuit the computation when it
/// reaches those parts of the subtree.
///
/// {@tool dartpad --template=stateless_widget_material
_no_null_safety
}
/// {@tool dartpad --template=stateless_widget_material}
/// In this example, the column becomes either as big as viewport, or as big as
/// the contents, whichever is biggest.
///
/// ```dart
/// Widget build(BuildContext context) {
/// return DefaultTextStyle(
/// style: Theme.of(context).textTheme.bodyText2,
/// style: Theme.of(context).textTheme.bodyText2
!
,
/// child: LayoutBuilder(
/// builder: (BuildContext context, BoxConstraints viewportConstraints) {
/// return SingleChildScrollView(
...
...
packages/flutter/lib/src/widgets/transitions.dart
View file @
b21e08c8
This diff is collapsed.
Click to expand it.
packages/flutter/lib/src/widgets/tween_animation_builder.dart
View file @
b21e08c8
...
...
@@ -61,7 +61,7 @@ import 'value_listenable_builder.dart';
///
/// ## Example Code
///
/// {@tool dartpad --template=stateful_widget_scaffold_center
_no_null_safety
}
/// {@tool dartpad --template=stateful_widget_scaffold_center}
/// This example shows an [IconButton] that "zooms" in when the widget first
/// builds (its size smoothly increases from 0 to 24) and whenever the button
/// is pressed, it smoothly changes its size to the new target value of either
...
...
@@ -75,11 +75,11 @@ import 'value_listenable_builder.dart';
/// return TweenAnimationBuilder(
/// tween: Tween<double>(begin: 0, end: targetValue),
/// duration: Duration(seconds: 1),
/// builder: (BuildContext context, double size, Widget child) {
/// builder: (BuildContext context, double size, Widget
?
child) {
/// return IconButton(
/// iconSize: size,
/// color: Colors.blue,
/// icon: child,
/// icon: child
!
,
/// onPressed: () {
/// setState(() {
/// targetValue = targetValue == 24.0 ? 48.0 : 24.0;
...
...
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