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
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
...
...
@@ -25,7 +25,7 @@ export 'package:flutter/rendering.dart' show RelativeRect;
/// [AnimatedWidget] is most useful for widgets that are otherwise stateless. To
/// use [AnimatedWidget], simply subclass it and implement the build function.
///
///
{@tool dartpad --template=stateful_widget_material_ticker_no_null_safety
}
///
{@tool dartpad --template=stateful_widget_material_ticker
}
///
/// This code defines a widget called `Spinner` that spins a green square
/// continually. It is built with an [AnimatedWidget].
...
...
@@ -36,10 +36,12 @@ export 'package:flutter/rendering.dart' show RelativeRect;
///
/// ```dart preamble
/// class SpinningContainer extends AnimatedWidget {
/// const SpinningContainer({Key key, AnimationController controller})
/// : super(key: key, listenable: controller);
/// const SpinningContainer({
/// Key? key,
/// required AnimationController controller,
/// }) : super(key: key, listenable: controller);
///
/// Animation<double> get _progress => listenable;
/// Animation<double> get _progress => listenable
as Animation<double>
;
///
/// @override
/// Widget build(BuildContext context) {
...
...
@@ -52,16 +54,10 @@ export 'package:flutter/rendering.dart' show RelativeRect;
/// ```
///
/// ```dart
/// AnimationController _controller;
///
/// @override
/// void initState() {
/// super.initState();
/// _controller = AnimationController(
/// duration: const Duration(seconds: 10),
/// vsync: this,
/// )..repeat();
/// }
/// late AnimationController _controller = AnimationController(
/// duration: const Duration(seconds: 10),
/// vsync: this,
/// )..repeat();
///
/// @override
/// void dispose() {
...
...
@@ -195,30 +191,23 @@ class _AnimatedState extends State<AnimatedWidget> {
/// animated by a [CurvedAnimation] set to [Curves.elasticIn]:
/// {@animation 300 378 https://flutter.github.io/assets-for-api-docs/assets/widgets/slide_transition.mp4}
///
/// {@tool dartpad --template=stateful_widget_scaffold_center_freeform_state
_no_null_safety
}
/// {@tool dartpad --template=stateful_widget_scaffold_center_freeform_state}
/// The following code implements the [SlideTransition] as seen in the video
/// above:
///
/// ```dart
/// class _MyStatefulWidgetState extends State<MyStatefulWidget> with SingleTickerProviderStateMixin {
/// AnimationController _controller;
/// Animation<Offset> _offsetAnimation;
///
/// @override
/// void initState() {
/// super.initState();
/// _controller = AnimationController(
/// duration: const Duration(seconds: 2),
/// vsync: this,
/// )..repeat(reverse: true);
/// _offsetAnimation = Tween<Offset>(
/// begin: Offset.zero,
/// end: const Offset(1.5, 0.0),
/// ).animate(CurvedAnimation(
/// parent: _controller,
/// curve: Curves.elasticIn,
/// ));
/// }
/// late AnimationController _controller = AnimationController(
/// duration: const Duration(seconds: 2),
/// vsync: this,
/// )..repeat(reverse: true);
/// late Animation<Offset> _offsetAnimation = Tween<Offset>(
/// begin: Offset.zero,
/// end: const Offset(1.5, 0.0),
/// ).animate(CurvedAnimation(
/// parent: _controller,
/// curve: Curves.elasticIn,
/// ));
///
/// @override
/// void dispose() {
...
...
@@ -313,27 +302,20 @@ class SlideTransition extends AnimatedWidget {
/// animated by a [CurvedAnimation] set to [Curves.fastOutSlowIn]:
/// {@animation 300 378 https://flutter.github.io/assets-for-api-docs/assets/widgets/scale_transition.mp4}
///
/// {@tool dartpad --template=stateful_widget_material_ticker
_no_null_safety
}
/// {@tool dartpad --template=stateful_widget_material_ticker}
///
/// The following code implements the [ScaleTransition] as seen in the video
/// above:
///
/// ```dart
/// AnimationController _controller;
/// Animation<double> _animation;
///
/// @override
/// void initState() {
/// super.initState();
/// _controller = AnimationController(
/// duration: const Duration(seconds: 2),
/// vsync: this,
/// )..repeat(reverse: true);
/// _animation = CurvedAnimation(
/// parent: _controller,
/// curve: Curves.fastOutSlowIn,
/// );
/// }
/// late AnimationController _controller = AnimationController(
/// duration: const Duration(seconds: 2),
/// vsync: this,
/// )..repeat(reverse: true);
/// late Animation<double> _animation = CurvedAnimation(
/// parent: _controller,
/// curve: Curves.fastOutSlowIn,
/// );
///
/// @override
/// void dispose() {
...
...
@@ -416,27 +398,20 @@ class ScaleTransition extends AnimatedWidget {
/// animated by a [CurvedAnimation] set to [Curves.elasticOut]:
/// {@animation 300 378 https://flutter.github.io/assets-for-api-docs/assets/widgets/rotation_transition.mp4}
///
/// {@tool dartpad --template=stateful_widget_material_ticker
_no_null_safety
}
/// {@tool dartpad --template=stateful_widget_material_ticker}
///
/// The following code implements the [RotationTransition] as seen in the video
/// above:
///
/// ```dart
/// AnimationController _controller;
/// Animation<double> _animation;
///
/// @override
/// void initState() {
/// super.initState();
/// _controller = AnimationController(
/// duration: const Duration(seconds: 2),
/// vsync: this,
/// )..repeat(reverse: true);
/// _animation = CurvedAnimation(
/// parent: _controller,
/// curve: Curves.elasticOut,
/// );
/// }
/// late AnimationController _controller = AnimationController(
/// duration: const Duration(seconds: 2),
/// vsync: this,
/// )..repeat(reverse: true);
/// late Animation<double> _animation = CurvedAnimation(
/// parent: _controller,
/// curve: Curves.elasticOut,
/// );
///
/// @override
/// void dispose() {
...
...
@@ -525,28 +500,21 @@ class RotationTransition extends AnimatedWidget {
/// animated by a [CurvedAnimation] set to [Curves.fastOutSlowIn]:
/// {@animation 300 378 https://flutter.github.io/assets-for-api-docs/assets/widgets/size_transition.mp4}
///
/// {@tool dartpad --template=stateful_widget_material_ticker
_no_null_safety
}
/// {@tool dartpad --template=stateful_widget_material_ticker}
///
/// This code defines a widget that uses [SizeTransition] to change the size
/// of [FlutterLogo] continually. It is built with a [Scaffold]
/// where the internal widget has space to change its size.
///
/// ```dart
/// AnimationController _controller;
/// Animation<double> _animation;
///
/// @override
/// void initState() {
/// super.initState();
/// _controller = AnimationController(
/// duration: const Duration(seconds: 3),
/// vsync: this,
/// )..repeat();
/// _animation = CurvedAnimation(
/// parent: _controller,
/// curve: Curves.fastOutSlowIn,
/// );
/// }
/// late AnimationController _controller = AnimationController(
/// duration: const Duration(seconds: 3),
/// vsync: this,
/// )..repeat();
/// late Animation<double> _animation = CurvedAnimation(
/// parent: _controller,
/// curve: Curves.fastOutSlowIn,
/// );
///
/// @override
/// void dispose() {
...
...
@@ -658,27 +626,20 @@ class SizeTransition extends AnimatedWidget {
/// Here's an illustration of the [FadeTransition] widget, with it's [opacity]
/// animated by a [CurvedAnimation] set to [Curves.fastOutSlowIn]:
///
/// {@tool dartpad --template=stateful_widget_material_ticker
_no_null_safety
}
/// {@tool dartpad --template=stateful_widget_material_ticker}
///
/// The following code implements the [FadeTransition] using
/// the Flutter logo:
///
/// ```dart
/// AnimationController _controller;
/// Animation<double> _animation;
///
/// @override
/// void initState() {
/// super.initState();
/// _controller = AnimationController(
/// duration: const Duration(seconds: 2),
/// vsync: this,
/// )..repeat(reverse: true);
/// _animation = CurvedAnimation(
/// parent: _controller,
/// curve: Curves.easeIn,
/// );
/// }
/// late AnimationController _controller = AnimationController(
/// duration: const Duration(seconds: 2),
/// vsync: this,
/// )..repeat(reverse: true);
/// late Animation<double> _animation = CurvedAnimation(
/// parent: _controller,
/// curve: Curves.easeIn,
/// );
///
/// @override
/// void dispose() {
...
...
@@ -762,21 +723,23 @@ class FadeTransition extends SingleChildRenderObjectWidget {
/// Animates the opacity of a sliver widget.
///
/// {@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] that uses a
/// [SliverFadeTransition] to fade the list in and out.
///
/// ```dart
/// class _MyStatefulWidgetState extends State<MyStatefulWidget> with SingleTickerProviderStateMixin {
/// AnimationController controller;
/// Animation<double> animation;
/// late AnimationController controller = AnimationController(
/// duration: const Duration(milliseconds: 1000),
/// vsync: this,
/// );
/// late Animation<double> animation = CurvedAnimation(
/// parent: controller,
/// curve: Curves.easeIn,
/// );
///
/// initState() {
/// super.initState();
/// controller = AnimationController(
/// duration: const Duration(milliseconds: 1000), vsync: this);
/// animation = CurvedAnimation(parent: controller, curve: Curves.easeIn);
///
/// animation.addStatusListener((status) {
/// if (status == AnimationStatus.completed) {
/// controller.reverse();
...
...
@@ -904,22 +867,16 @@ class RelativeRectTween extends Tween<RelativeRect> {
/// animated by a [CurvedAnimation] set to [Curves.elasticInOut]:
/// {@animation 300 378 https://flutter.github.io/assets-for-api-docs/assets/widgets/positioned_transition.mp4}
///
/// {@tool dartpad --template=stateful_widget_material_ticker
_no_null_safety
}
/// {@tool dartpad --template=stateful_widget_material_ticker}
///
/// The following code implements the [PositionedTransition] as seen in the video
/// above:
///
/// ```dart
/// AnimationController _controller;
///
/// @override
/// void initState() {
/// super.initState();
/// _controller = AnimationController(
/// duration: const Duration(seconds: 2),
/// vsync: this,
/// )..repeat(reverse: true);
/// }
/// late AnimationController _controller = AnimationController(
/// duration: const Duration(seconds: 2),
/// vsync: this,
/// )..repeat(reverse: true);
///
/// @override
/// void dispose() {
...
...
@@ -1010,22 +967,16 @@ class PositionedTransition extends AnimatedWidget {
/// animated by a [CurvedAnimation] set to [Curves.elasticInOut]:
/// {@animation 300 378 https://flutter.github.io/assets-for-api-docs/assets/widgets/relative_positioned_transition.mp4}
///
/// {@tool dartpad --template=stateful_widget_material_ticker
_no_null_safety
}
/// {@tool dartpad --template=stateful_widget_material_ticker}
///
/// The following code implements the [RelativePositionedTransition] as seen in the video
/// above:
///
/// ```dart
/// AnimationController _controller;
///
/// @override
/// void initState() {
/// super.initState();
/// _controller = AnimationController(
/// duration: const Duration(seconds: 2),
/// vsync: this,
/// )..repeat(reverse: true);
/// }
/// late AnimationController _controller = AnimationController(
/// duration: const Duration(seconds: 2),
/// vsync: this,
/// )..repeat(reverse: true);
///
/// @override
/// void dispose() {
...
...
@@ -1051,7 +1002,7 @@ class PositionedTransition extends AnimatedWidget {
/// ).animate(CurvedAnimation(
/// parent: _controller,
/// curve: Curves.elasticInOut,
/// )),
/// ))
as Animation<Rect>
,
/// child: Padding(
/// padding: const EdgeInsets.all(8),
/// child: FlutterLogo()
...
...
@@ -1130,7 +1081,7 @@ class RelativePositionedTransition extends AnimatedWidget {
/// [decoration] animated by a [CurvedAnimation] set to [Curves.decelerate]:
/// {@animation 300 378 https://flutter.github.io/assets-for-api-docs/assets/widgets/decorated_box_transition.mp4}
///
/// {@tool dartpad --template=stateful_widget_material_ticker
_no_null_safety
}
/// {@tool dartpad --template=stateful_widget_material_ticker}
/// The following code implements the [DecoratedBoxTransition] as seen in the video
/// above:
///
...
...
@@ -1160,16 +1111,10 @@ class RelativePositionedTransition extends AnimatedWidget {
/// ),
/// );
///
/// AnimationController _controller;
///
/// @override
/// void initState() {
/// _controller = AnimationController(
/// vsync: this,
/// duration: const Duration(seconds: 3),
/// )..repeat(reverse: true);
/// super.initState();
/// }
/// late AnimationController _controller = AnimationController(
/// vsync: this,
/// duration: const Duration(seconds: 3),
/// )..repeat(reverse: true);
///
/// @override
/// void dispose() {
...
...
@@ -1310,15 +1255,15 @@ class AlignTransition extends AnimatedWidget {
/// Animated version of a [DefaultTextStyle] that animates the different properties
/// of its [TextStyle].
///
/// {@tool dartpad --template=stateful_widget_material_ticker
_no_null_safety
}
/// {@tool dartpad --template=stateful_widget_material_ticker}
///
/// The following code implements the [DefaultTextStyleTransition] that shows
/// a transition between thick blue font and thin red font.
///
/// ```dart
/// AnimationController _controller;
/// TextStyleTween _styleTween;
/// CurvedAnimation _curvedAnimation;
///
late
AnimationController _controller;
///
late
TextStyleTween _styleTween;
///
late
CurvedAnimation _curvedAnimation;
///
/// @override
/// void initState() {
...
...
@@ -1438,7 +1383,7 @@ class DefaultTextStyleTransition extends AnimatedWidget {
/// Using this pre-built child is entirely optional, but can improve
/// performance significantly in some cases and is therefore a good practice.
///
/// {@tool dartpad --template=stateful_widget_material_ticker
_no_null_safety
}
/// {@tool dartpad --template=stateful_widget_material_ticker}
///
/// This code defines a widget that spins a green square continually. It is
/// built with an [AnimatedBuilder] and makes use of the [child] feature to
...
...
@@ -1449,16 +1394,10 @@ class DefaultTextStyleTransition extends AnimatedWidget {
/// ```
///
/// ```dart
/// AnimationController _controller;
///
/// @override
/// void initState() {
/// super.initState();
/// _controller = AnimationController(
/// duration: const Duration(seconds: 10),
/// vsync: this,
/// )..repeat();
/// }
/// late AnimationController _controller = AnimationController(
/// duration: const Duration(seconds: 10),
/// vsync: this,
/// )..repeat();
///
/// @override
/// void dispose() {
...
...
@@ -1478,7 +1417,7 @@ class DefaultTextStyleTransition extends AnimatedWidget {
/// child: Text('Whee!'),
/// ),
/// ),
/// builder: (BuildContext context, Widget child) {
/// builder: (BuildContext context, Widget
?
child) {
/// return Transform.rotate(
/// angle: _controller.value * 2.0 * math.pi,
/// child: child,
...
...
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